Added the debug toolkit plugin, found on the bakery website.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@92 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 21:12:59 +00:00
parent 18b928411b
commit 8ab8d087e6
41 changed files with 4502 additions and 0 deletions

View File

@@ -0,0 +1,323 @@
<?php
/* SVN FILE: $Id$ */
/**
* DebugToolbar Test
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2006-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.cake.libs.
* @since CakePHP v 1.2.0.4487
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Component', 'DebugKit.Toolbar');
class TestToolbarComponent extends ToolbarComponent {
function loadPanels($panels) {
$this->_loadPanels($panels);
}
}
Mock::generate('DebugPanel');
/**
* DebugToolbar Test case
*/
class DebugToolbarTestCase extends CakeTestCase {
function setUp() {
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::parse('/');
$this->Controller =& ClassRegistry::init('Controller');
$this->Controller->Component =& ClassRegistry::init('Component');
$this->Controller->Toolbar =& ClassRegistry::init('TestToolBarComponent', 'Component');
}
/**
* test Loading of panel classes
*
* @return void
**/
function testLoadPanels() {
$this->Controller->Toolbar->loadPanels(array('session', 'request'));
$this->assertTrue(is_a($this->Controller->Toolbar->panels['session'], 'SessionPanel'));
$this->assertTrue(is_a($this->Controller->Toolbar->panels['request'], 'RequestPanel'));
$this->expectError();
$this->Controller->Toolbar->loadPanels(array('randomNonExisting', 'request'));
}
/**
* test loading of vendor panels from test_app folder
*
* @access public
* @return void
*/
function testVendorPanels() {
$_back = Configure::read('vendorPaths');
Configure::write('vendorPaths', array(APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'test_app' . DS . 'vendors' . DS));
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'panels' => array('test'),
)
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->assertTrue(isset($this->Controller->Toolbar->panels['test']));
$this->assertTrue(is_a($this->Controller->Toolbar->panels['test'], 'TestPanel'));
Configure::write('vendorPaths', $_back);
}
/**
* test initialize
*
* @return void
* @access public
**/
function testInitialize() {
$this->Controller->components = array('DebugKit.Toolbar');
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->assertFalse(empty($this->Controller->Toolbar->panels));
$timers = DebugKitDebugger::getTimers();
$this->assertTrue(isset($timers['componentInit']));
}
/**
* test startup
*
* @return void
**/
function testStartup() {
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'panels' => array('MockDebug')
)
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Toolbar->panels['MockDebug']->expectOnce('startup');
$this->Controller->Toolbar->startup($this->Controller);
$this->assertEqual(count($this->Controller->Toolbar->panels), 1);
$this->assertTrue(isset($this->Controller->helpers['DebugKit.Toolbar']));
$this->assertEqual($this->Controller->helpers['DebugKit.Toolbar'], array('output' => 'DebugKit.HtmlToolbar'));
$timers = DebugKitDebugger::getTimers();
$this->assertTrue(isset($timers['controllerAction']));
}
/**
* Test Before Render callback
*
* @return void
**/
function testBeforeRender() {
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'panels' => array('MockDebug', 'session')
)
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Toolbar->panels['MockDebug']->expectOnce('beforeRender');
$this->Controller->Toolbar->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarPanels']));
$vars = $this->Controller->viewVars['debugToolbarPanels'];
$expected = array(
'plugin' => 'debug_kit',
'elementName' => 'session_panel',
'content' => $this->Controller->Session->read(),
'disableTimer' => true,
);
$this->assertEqual($expected, $vars['session']);
}
/**
* test alternate javascript library use
*
* @return void
**/
function testAlternateJavascript() {
$this->Controller->components = array(
'DebugKit.Toolbar'
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array(
'behavior' => '/debug_kit/js/js_debug_toolbar',
);
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'javascript' => 'jquery',
),
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array(
'behavior' => '/debug_kit/js/jquery_debug_toolbar.js',
);
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'javascript' => false
)
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array();
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'javascript' => array('my_library'),
),
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array(
'behavior' => 'my_library_debug_toolbar'
);
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'javascript' => array('/my/path/to/file')
),
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array(
'behavior' => '/my/path/to/file',
);
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'javascript' => '/js/custom_behavior',
),
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array(
'behavior' => '/js/custom_behavior',
);
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
}
/**
* Test alternate javascript existing in the plugin.
*
* @return void
**/
function testExistingAlterateJavascript() {
$filename = APP . 'plugins' . DS . 'debug_kit' . DS . 'vendors' . DS . 'js' . DS . 'test_alternate_debug_toolbar.js';
$this->skipIf(!is_writable(dirname($filename)), 'Skipping existing javascript test, debug_kit/vendors/js must be writable');
@touch($filename);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'javascript' => 'test_alternate',
),
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript']));
$expected = array(
'behavior' => '/debug_kit/js/test_alternate_debug_toolbar.js',
);
$this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected);
@unlink($filename);
}
/**
* test the Log panel log reading.
*
* @return void
**/
function testLogPanel() {
usleep(20);
$this->Controller->log('This is a log I made this request');
$this->Controller->log('This is the second log I made this request');
$this->Controller->log('This time in the debug log!', LOG_DEBUG);
$this->Controller->components = array(
'DebugKit.Toolbar' => array(
'panels' => array('log', 'session')
)
);
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$result = $this->Controller->viewVars['debugToolbarPanels']['log'];
$this->assertEqual(count($result['content']), 2);
$this->assertEqual(count($result['content']['error.log']), 4);
$this->assertEqual(count($result['content']['debug.log']), 2);
$this->assertEqual(trim($result['content']['debug.log'][1]), 'Debug: This time in the debug log!');
$this->assertEqual(trim($result['content']['error.log'][1]), 'Error: This is a log I made this request');
}
/**
* teardown
*
* @return void
**/
function tearDown() {
unset($this->Controller);
if (class_exists('DebugKitDebugger')) {
DebugKitDebugger::clearTimers();
}
}
}
?>

View File

View File

@@ -0,0 +1,62 @@
<?php
/* SVN FILE: $Id$ */
/**
* Common test objects used in DebugKit tests
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* TestFireCake class allows for testing of FireCake
*
* @package debug_kit.tests.
*/
class TestFireCake extends FireCake {
var $sentHeaders = array();
function _sendHeader($name, $value) {
$_this = FireCake::getInstance();
$_this->sentHeaders[$name] = $value;
}
/**
* skip client detection as headers are not being sent.
*
* @access public
* @return void
*/
function detectClientExtension() {
return true;
}
/**
* Reset the fireCake
*
* @return void
**/
function reset() {
$_this = FireCake::getInstance();
$_this->sentHeaders = array();
$_this->_messageIndex = 1;
}
}
?>

View File

@@ -0,0 +1,157 @@
<?php
/* SVN FILE: $Id$ */
/**
* DebugKit Debugger Test Case File
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'Debugger');
App::import('Vendor', 'DebugKit.DebugKitDebugger');
require_once APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'cases' . DS . 'test_objects.php';
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs
*/
class DebugKitDebuggerTest extends CakeTestCase {
/**
* setUp method
*
* @access public
* @return void
*/
function setUp() {
Configure::write('log', false);
if (!defined('SIMPLETESTVENDORPATH')) {
if (file_exists(APP . DS . 'vendors' . DS . 'simpletest' . DS . 'reporter.php')) {
define('SIMPLETESTVENDORPATH', 'APP' . DS . 'vendors');
} else {
define('SIMPLETESTVENDORPATH', 'CORE' . DS . 'vendors');
}
}
}
/**
* Start Timer test
*
* @return void
**/
function testTimers() {
$this->assertTrue(DebugKitDebugger::startTimer('test1', 'this is my first test'));
usleep(5000);
$this->assertTrue(DebugKitDebugger::stopTimer('test1'));
$elapsed = DebugKitDebugger::elapsedTime('test1');
$this->assertTrue($elapsed > 0.0050);
$this->assertTrue(DebugKitDebugger::startTimer('test2', 'this is my second test'));
sleep(1);
$this->assertTrue(DebugKitDebugger::stopTimer('test2'));
$elapsed = DebugKitDebugger::elapsedTime('test2');
$this->assertTrue($elapsed > 1);
DebugKitDebugger::startTimer('test3');
$this->assertFalse(DebugKitDebugger::elapsedTime('test3'));
$this->assertFalse(DebugKitDebugger::stopTimer('wrong'));
}
/**
* testRequestTime
*
* @access public
* @return void
*/
function testRequestTime() {
$result1 = DebugKitDebugger::requestTime();
usleep(50);
$result2 = DebugKitDebugger::requestTime();
$this->assertTrue($result1 < $result2);
}
/**
* test getting all the set timers.
*
* @return void
**/
function testGetTimers() {
DebugKitDebugger::clearTimers();
DebugKitDebugger::startTimer('test1', 'this is my first test');
DebugKitDebugger::stopTimer('test1');
usleep(50);
DebugKitDebugger::startTimer('test2');
DebugKitDebugger::stopTimer('test2');
$timers = DebugKitDebugger::getTimers();
$this->assertEqual(count($timers), 2);
$this->assertTrue(is_float($timers['test1']['time']));
$this->assertTrue(isset($timers['test1']['message']));
$this->assertTrue(isset($timers['test2']['message']));
}
/**
* test memory usage
*
* @return void
**/
function testMemoryUsage() {
$result = DebugKitDebugger::getMemoryUse();
$this->assertTrue(is_int($result));
$result = DebugKitDebugger::getPeakMemoryUse();
$this->assertTrue(is_int($result));
}
/**
* test _output switch to firePHP
*
* @return void
*/
function testOutput() {
$firecake =& FireCake::getInstance('TestFireCake');
Debugger::invoke(DebugKitDebugger::getInstance('DebugKitDebugger'));
Debugger::output('fb');
$foo .= '';
$result = $firecake->sentHeaders;
$this->assertPattern('/GROUP_START/', $result['X-Wf-1-1-1-1']);
$this->assertPattern('/ERROR/', $result['X-Wf-1-1-1-2']);
$this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-5']);
Debugger::invoke(Debugger::getInstance('Debugger'));
Debugger::output();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Configure::write('log', true);
}
}
?>

View File

@@ -0,0 +1,336 @@
<?php
/* SVN FILE: $Id$ */
/**
* CakeFirePHP test case
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2006-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package debug_kit
* @subpackage cake.debug_kit.tests
* @since CakePHP v 1.2.0.4487
* @version
* @modifiedby
* @lastmodified
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Vendor', 'DebugKit.FireCake');
require_once APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'cases' . DS . 'test_objects.php';
/**
* Test Case For FireCake
*
* @package debug_kit.tests
*/
class FireCakeTestCase extends CakeTestCase {
/**
* setup test
*
* Fill FireCake with TestFireCake instance.
*
* @access public
* @return void
*/
function setUp() {
$this->firecake =& FireCake::getInstance('TestFireCake');
}
/**
* test getInstance cheat.
*
* If this fails the rest of the test is going to fail too.
*
* @return void
**/
function testGetInstanceOverride() {
$instance =& FireCake::getInstance();
$instance2 =& FireCake::getInstance();
$this->assertReference($instance, $instance2);
$this->assertIsA($instance, 'FireCake');
$this->assertIsA($instance, 'TestFireCake', 'Stored instance is not a copy of TestFireCake, test case is broken.');
}
/**
* testsetoption
*
* @return void
**/
function testSetOptions() {
FireCake::setOptions(array('includeLineNumbers' => false));
$this->assertEqual($this->firecake->options['includeLineNumbers'], false);
}
/**
* test Log()
*
* @access public
* @return void
*/
function testLog() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::log('Testing');
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1']));
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1);
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '26|[{"Type":"LOG"},"Testing"]|');
FireCake::log('Testing', 'log-info');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '45|[{"Type":"LOG","Label":"log-info"},"Testing"]|');
}
/**
* test info()
*
* @access public
* @return void
*/
function testInfo() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::info('I have information');
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1']));
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1);
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '38|[{"Type":"INFO"},"I have information"]|');
FireCake::info('I have information', 'info-label');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '59|[{"Type":"INFO","Label":"info-label"},"I have information"]|');
}
/**
* test info()
*
* @access public
* @return void
*/
function testWarn() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::warn('A Warning');
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1']));
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1);
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '29|[{"Type":"WARN"},"A Warning"]|');
FireCake::warn('A Warning', 'Bzzz');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '44|[{"Type":"WARN","Label":"Bzzz"},"A Warning"]|');
}
/**
* test error()
*
* @access public
* @return void
**/
function testError() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::error('An error');
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1']));
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1);
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '29|[{"Type":"ERROR"},"An error"]|');
FireCake::error('An error', 'wonky');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '45|[{"Type":"ERROR","Label":"wonky"},"An error"]|');
}
/**
* test dump()
*
* @return void
**/
function testDump() {
FireCake::dump('mydump', array('one' => 1, 'two' => 2));
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-2-1-1'], '28|{"mydump":{"one":1,"two":2}}|');
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-2']));
}
/**
* test table() generation
*
* @return void
**/
function testTable() {
$table[] = array('Col 1 Heading','Col 2 Heading');
$table[] = array('Row 1 Col 1','Row 1 Col 2');
$table[] = array('Row 2 Col 1','Row 2 Col 2');
$table[] = array('Row 3 Col 1','Row 3 Col 2');
FireCake::table('myTrace', $table);
$expected = '162|[{"Type":"TABLE","Label":"myTrace"},[["Col 1 Heading","Col 2 Heading"],["Row 1 Col 1","Row 1 Col 2"],["Row 2 Col 1","Row 2 Col 2"],["Row 3 Col 1","Row 3 Col 2"]]]|';
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], $expected);
}
/**
* testStringEncoding
*
* @return void
**/
function testStringEncode() {
$result = $this->firecake->stringEncode(array(1,2,3));
$this->assertEqual($result, array(1,2,3));
$this->firecake->setOptions(array('maxArrayDepth' => 3));
$deep = array(1 => array(2 => array(3)));
$result = $this->firecake->stringEncode($deep);
$this->assertEqual($result, array(1 => array(2 => '** Max Array Depth (3) **')));
$obj =& FireCake::getInstance();
$result = $this->firecake->stringEncode($obj);
$this->assertTrue(is_array($result));
$this->assertEqual($result['_defaultOptions']['useNativeJsonEncode'], true);
$this->assertEqual($result['_log'], null);
$this->assertEqual($result['_encodedObjects'][0], '** Recursion (TestFireCake) **');
}
/**
* test trace()
*
* @return void
**/
function testTrace() {
FireCake::trace('myTrace');
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1']));
$this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1']));
$dump = $this->firecake->sentHeaders['X-Wf-1-1-1-1'];
$this->assertPattern('/"Message":"myTrace"/', $dump);
$this->assertPattern('/"Trace":\[/', $dump);
}
/**
* test enabling and disabling of FireCake output
*
* @return void
**/
function testEnableDisable() {
FireCake::disable();
FireCake::trace('myTrace');
$this->assertTrue(empty($this->firecake->sentHeaders));
FireCake::enable();
FireCake::trace('myTrace');
$this->assertFalse(empty($this->firecake->sentHeaders));
}
/**
* test correct line continuation markers on multi line headers.
*
* @access public
* @return void
*/
function testMultiLineOutput() {
FireCake::trace('myTrace');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3);
$header = $this->firecake->sentHeaders['X-Wf-1-1-1-1'];
$this->assertEqual(substr($header, -2), '|\\');
$header = $this->firecake->sentHeaders['X-Wf-1-1-1-2'];
$this->assertEqual(substr($header, -2), '|\\');
$header = $this->firecake->sentHeaders['X-Wf-1-1-1-3'];
$this->assertEqual(substr($header, -1), '|');
}
/**
* test inclusion of line numbers
*
* @return void
**/
function testIncludeLineNumbers() {
FireCake::setOptions(array('includeLineNumbers' => true));
FireCake::info('Testing');
$result = $this->firecake->sentHeaders['X-Wf-1-1-1-1'];
$this->assertPattern('/"File"\:"APP.*fire_cake.test.php/', $result);
$this->assertPattern('/"Line"\:\d+/', $result);
}
/**
* test Group messages
*
* @return void
**/
function testGroup() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::group('test');
FireCake::info('my info');
FireCake::groupEnd();
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '44|[{"Type":"GROUP_START","Label":"test"},null]|');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-3'], '27|[{"Type":"GROUP_END"},null]|');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3);
}
/**
* test fb() parameter parsing
*
* @return void
**/
function testFbParameterParsing() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::fb('Test');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '23|[{"Type":"LOG"},"Test"]|');
FireCake::fb('Test', 'warn');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '24|[{"Type":"WARN"},"Test"]|');
FireCake::fb('Test', 'Custom label', 'warn');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-3'], '47|[{"Type":"WARN","Label":"Custom label"},"Test"]|');
$this->expectError();
$this->assertFalse(FireCake::fb('Test', 'Custom label', 'warn', 'more parameters'));
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3);
}
/**
* Test defaulting to log if incorrect message type is used
*
* @return void
**/
function testIncorrectMessageType() {
FireCake::setOptions(array('includeLineNumbers' => false));
FireCake::fb('Hello World', 'foobared');
$this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '30|[{"Type":"LOG"},"Hello World"]|');
}
/**
* testClientExtensionDetection.
*
* @return void
**/
function testDetectClientExtension() {
$back = env('HTTP_USER_AGENT');
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 FirePHP/0.2.1';
$this->assertTrue(FireCake::detectClientExtension());
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 FirePHP/0.0.4';
$this->assertFalse(FireCake::detectClientExtension());
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4';
$this->assertFalse(FireCake::detectClientExtension());
$_SERVER['HTTP_USER_AGENT'] = $back;
}
/**
* test of Non Native JSON encoding.
*
* @return void
**/
function testNonNativeEncoding() {
FireCake::setOptions(array('useNativeJsonEncode' => false));
$json = FireCake::jsonEncode(array('one' => 1, 'two' => 2));
$this->assertEqual($json, '{"one":1,"two":2}');
$json = FireCake::jsonEncode(array(1,2,3));
$this->assertEqual($json, '[1,2,3]');
$json = FireCake::jsonEncode(FireCake::getInstance());
$this->assertPattern('/"options"\:\{"maxObjectDepth"\:\d*,/', $json);
}
/**
* reset the FireCake counters and headers.
*
* @access public
* @return void
*/
function tearDown() {
TestFireCake::reset();
}
}
?>

View File

@@ -0,0 +1,144 @@
<?php
/* SVN FILE: $Id$ */
/**
* DebugView test Case
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2006-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.cake.libs.
* @since CakePHP v 1.2.0.4487
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'View');
if (!class_exists('DoppelGangerView')) {
class DoppelGangerView extends View {}
}
App::import('View', 'DebugKit.Debug');
App::import('Vendor', 'DebugKit.DebugKitDebugger');
/**
* Debug View Test Case
*
* @package debug_kit.tests
*/
class DebugViewTestCase extends CakeTestCase {
/**
* set Up test case
*
* @return void
**/
function setUp() {
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::parse('/');
$this->Controller =& ClassRegistry::init('Controller');
$this->View =& new DebugView($this->Controller, false);
$this->_debug = Configure::read('debug');
}
/**
* start Case - switch view paths
*
* @return void
**/
function startCase() {
$this->_viewPaths = Configure::read('viewPaths');
Configure::write('viewPaths', array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS,
APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS,
ROOT . DS . LIBS . 'view' . DS
));
}
/**
* test that element timers are working
*
* @return void
**/
function testElementTimers() {
$result = $this->View->element('test_element');
$this->assertPattern('/^this is the test element$/', $result);
$result = DebugKitDebugger::getTimers();
$this->assertTrue(isset($result['render_test_element.ctp']));
}
/**
* test rendering and ensure that timers are being set.
*
* @access public
* @return void
*/
function testRenderTimers() {
$this->Controller->viewPath = 'posts';
$this->Controller->action = 'index';
$this->Controller->params = array(
'action' => 'index',
'controller' => 'posts',
'plugin' => null,
'url' => array('url' => 'posts/index'),
'base' => null,
'here' => '/posts/index',
);
$this->Controller->layout = 'default';
$View =& new DebugView($this->Controller, false);
$View->render('index');
$result = DebugKitDebugger::getTimers();
$this->assertEqual(count($result), 3);
$this->assertTrue(isset($result['viewRender']));
$this->assertTrue(isset($result['render_default.ctp']));
$this->assertTrue(isset($result['render_index.ctp']));
}
/**
* Test for correct loading of helpers into custom view
*
* @return void
*/
function testLoadHelpers() {
$loaded = array();
$result = $this->View->_loadHelpers($loaded, array('Html', 'Javascript', 'Number'));
$this->assertTrue(is_object($result['Html']));
$this->assertTrue(is_object($result['Javascript']));
$this->assertTrue(is_object($result['Number']));
}
/**
* reset the view paths
*
* @return void
**/
function endCase() {
Configure::write('viewPaths', $this->_viewPaths);
}
/**
* tear down function
*
* @return void
**/
function tearDown() {
unset($this->View, $this->Controller);
DebugKitDebugger::clearTimers();
Configure::write('debug', $this->_debug);
}
}
?>

View File

@@ -0,0 +1,137 @@
<?php
/* SVN FILE: $Id$ */
/**
* Toolbar Abstract Helper Test Case
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2006-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage debug_kit.tests.views.helpers
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Helper', 'DebugKit.FirePhpToolbar');
App::import('Core', array('View', 'Controller'));
require_once APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'cases' . DS . 'test_objects.php';
FireCake::getInstance('TestFireCake');
class FirePhpToolbarHelperTestCase extends CakeTestCase {
/**
* setUp
*
* @return void
**/
function setUp() {
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::parse('/');
$this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.FirePhpToolbar'));
$this->Toolbar->FirePhpToolbar =& new FirePhpToolbarHelper();
$this->Controller =& ClassRegistry::init('Controller');
if (isset($this->_debug)) {
Configure::write('debug', $this->_debug);
}
}
/**
* start Case - switch view paths
*
* @return void
**/
function startCase() {
$this->_viewPaths = Configure::read('viewPaths');
Configure::write('viewPaths', array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS,
APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS,
ROOT . DS . LIBS . 'view' . DS
));
$this->_debug = Configure::read('debug');
$this->firecake =& FireCake::getInstance();
}
/**
* test neat array (dump)creation
*
* @return void
*/
function testMakeNeatArray() {
$this->Toolbar->makeNeatArray(array(1,2,3));
$result = $this->firecake->sentHeaders;
$this->assertTrue(isset($result['X-Wf-1-1-1-1']));
$this->assertPattern('/\[1,2,3\]/', $result['X-Wf-1-1-1-1']);
}
/**
* testAfterlayout element rendering
*
* @return void
*/
function testAfterLayout(){
$this->Controller->viewPath = 'posts';
$this->Controller->action = 'index';
$this->Controller->params = array(
'action' => 'index',
'controller' => 'posts',
'plugin' => null,
'url' => array('url' => 'posts/index', 'ext' => 'xml'),
'base' => null,
'here' => '/posts/index',
);
$this->Controller->layout = 'default';
$this->Controller->uses = null;
$this->Controller->components = array('DebugKit.Toolbar');
$this->Controller->constructClasses();
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$result = $this->Controller->render();
$this->assertNoPattern('/debug-toolbar/', $result);
$result = $this->firecake->sentHeaders;
$this->assertTrue(is_array($result));
}
/**
* endTest()
*
* @return void
*/
function endTest() {
TestFireCake::reset();
}
/**
* reset the view paths
*
* @return void
**/
function endCase() {
Configure::write('viewPaths', $this->_viewPaths);
}
/**
* tearDown
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Toolbar, $this->Controller);
ClassRegistry::removeObject('view');
ClassRegistry::flush();
Router::reload();
}
}
?>

View File

@@ -0,0 +1,358 @@
<?php
/* SVN FILE: $Id$ */
/**
* Toolbar HTML Helper Test Case
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2006-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage debug_kit.tests.views.helpers
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Helper', array('DebugKit.HtmlToolbar', 'Html', 'Javascript'));
App::import('Core', array('View', 'Controller'));
class HtmlToolbarHelperTestCase extends CakeTestCase {
/**
* setUp
*
* @return void
**/
function setUp() {
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::parse('/');
$this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.HtmlToolbar'));
$this->Toolbar->HtmlToolbar =& new HtmlToolbarHelper();
$this->Toolbar->HtmlToolbar->Html =& new HtmlHelper();
$this->Toolbar->HtmlToolbar->Javascript =& new JavascriptHelper();
$this->Controller =& ClassRegistry::init('Controller');
if (isset($this->_debug)) {
Configure::write('debug', $this->_debug);
}
}
/**
* start Case - switch view paths
*
* @return void
**/
function startCase() {
$this->_viewPaths = Configure::read('viewPaths');
Configure::write('viewPaths', array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS,
APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS,
ROOT . DS . LIBS . 'view' . DS
));
$this->_debug = Configure::read('debug');
}
/**
* test Neat Array formatting
*
* @return void
**/
function testMakeNeatArray() {
$in = false;
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', '0' , '/strong', '(false)', '/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = null;
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', '0' , '/strong', '(null)', '/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = true;
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', '0' , '/strong', '(true)', '/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = array('key' => 'value');
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', 'key', '/strong', 'value', '/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = array('key' => null);
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', 'key', '/strong', '(null)', '/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = array('key' => 'value', 'foo' => 'bar');
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', 'key', '/strong', 'value', '/li',
'<li', '<strong', 'foo', '/strong', 'bar', '/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = array(
'key' => 'value',
'foo' => array(
'this' => 'deep',
'another' => 'value'
)
);
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', 'key', '/strong', 'value', '/li',
'<li', '<strong', 'foo', '/strong',
array('ul' => array('class' => 'neat-array depth-1')),
'<li', '<strong', 'this', '/strong', 'deep', '/li',
'<li', '<strong', 'another', '/strong', 'value', '/li',
'/ul',
'/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = array(
'key' => 'value',
'foo' => array(
'this' => 'deep',
'another' => 'value'
),
'lotr' => array(
'gandalf' => 'wizard',
'bilbo' => 'hobbit'
)
);
$result = $this->Toolbar->makeNeatArray($in, 1);
$expected = array(
'ul' => array('class' => 'neat-array depth-0 expanded'),
'<li', '<strong', 'key', '/strong', 'value', '/li',
'<li', '<strong', 'foo', '/strong',
array('ul' => array('class' => 'neat-array depth-1')),
'<li', '<strong', 'this', '/strong', 'deep', '/li',
'<li', '<strong', 'another', '/strong', 'value', '/li',
'/ul',
'/li',
'<li', '<strong', 'lotr', '/strong',
array('ul' => array('class' => 'neat-array depth-1')),
'<li', '<strong', 'gandalf', '/strong', 'wizard', '/li',
'<li', '<strong', 'bilbo', '/strong', 'hobbit', '/li',
'/ul',
'/li',
'/ul'
);
$this->assertTags($result, $expected);
$result = $this->Toolbar->makeNeatArray($in, 2);
$expected = array(
'ul' => array('class' => 'neat-array depth-0 expanded'),
'<li', '<strong', 'key', '/strong', 'value', '/li',
'<li', '<strong', 'foo', '/strong',
array('ul' => array('class' => 'neat-array depth-1 expanded')),
'<li', '<strong', 'this', '/strong', 'deep', '/li',
'<li', '<strong', 'another', '/strong', 'value', '/li',
'/ul',
'/li',
'<li', '<strong', 'lotr', '/strong',
array('ul' => array('class' => 'neat-array depth-1 expanded')),
'<li', '<strong', 'gandalf', '/strong', 'wizard', '/li',
'<li', '<strong', 'bilbo', '/strong', 'hobbit', '/li',
'/ul',
'/li',
'/ul'
);
$this->assertTags($result, $expected);
$in = array('key' => 'value', 'array' => array());
$result = $this->Toolbar->makeNeatArray($in);
$expected = array(
'ul' => array('class' => 'neat-array depth-0'),
'<li', '<strong', 'key', '/strong', 'value', '/li',
'<li', '<strong', 'array', '/strong', '(empty)', '/li',
'/ul'
);
$this->assertTags($result, $expected);
}
/**
* Test injection of toolbar
*
* @return void
**/
function testInjectToolbar() {
$this->Controller->viewPath = 'posts';
$this->Controller->action = 'index';
$this->Controller->params = array(
'action' => 'index',
'controller' => 'posts',
'plugin' => null,
'url' => array('url' => 'posts/index'),
'base' => null,
'here' => '/posts/index',
);
$this->Controller->helpers = array('Html', 'Javascript', 'DebugKit.Toolbar');
$this->Controller->layout = 'default';
$this->Controller->uses = null;
$this->Controller->components = array('DebugKit.Toolbar');
$this->Controller->constructClasses();
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$result = $this->Controller->render();
$result = str_replace(array("\n", "\r"), '', $result);
$this->assertPattern('#<div id\="debug-kit-toolbar">.+</div></body>#', $result);
}
/**
* test injection of javascript
*
* @return void
**/
function testJavascriptInjection() {
$this->Controller->viewPath = 'posts';
$this->Controller->uses = null;
$this->Controller->action = 'index';
$this->Controller->params = array(
'action' => 'index',
'controller' => 'posts',
'plugin' => null,
'url' => array('url' => 'posts/index'),
'base' => '/',
'here' => '/posts/index',
);
$this->Controller->helpers = array('Javascript', 'Html');
$this->Controller->components = array('DebugKit.Toolbar');
$this->Controller->layout = 'default';
$this->Controller->constructClasses();
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$result = $this->Controller->render();
$result = str_replace(array("\n", "\r"), '', $result);
$this->assertPattern('#<script\s*type="text/javascript"\s*src="/debug_kit/js/js_debug_toolbar.js"\s*>\s?</script>#', $result);
}
/**
* test Injection of user defined javascript
*
* @return void
**/
function testCustomJavascriptInjection() {
$this->Controller->viewPath = 'posts';
$this->Controller->uses = null;
$this->Controller->action = 'index';
$this->Controller->params = array(
'action' => 'index',
'controller' => 'posts',
'plugin' => null,
'url' => array('url' => 'posts/index'),
'base' => '/',
'here' => '/posts/index',
);
$this->Controller->helpers = array('Javascript', 'Html');
$this->Controller->components = array('DebugKit.Toolbar' => array('javascript' => array('my_custom')));
$this->Controller->layout = 'default';
$this->Controller->constructClasses();
$this->Controller->Component->initialize($this->Controller);
$this->Controller->Component->startup($this->Controller);
$this->Controller->Component->beforeRender($this->Controller);
$result = $this->Controller->render();
$result = str_replace(array("\n", "\r"), '', $result);
$this->assertPattern('#<script\s*type="text/javascript"\s*src="js/my_custom_debug_toolbar.js"\s*>\s?</script>#', $result);
}
/**
* test message creation
*
* @return void
*/
function testMessage() {
$result = $this->Toolbar->message('test', 'one, two');
$expected = array(
'<p',
'<strong', 'test', '/strong',
' one, two',
'/p',
);
$this->assertTags($result, $expected);
}
/**
* Test Table generation
*
* @return void
*/
function testTable() {
$rows = array(
array(1,2),
array(3,4),
);
$result = $this->Toolbar->table($rows);
$expected = array(
'table' => array('class' =>'debug-table'),
array('tr' => array('class' => 'odd')),
'<td', '1', '/td',
'<td', '2', '/td',
'/tr',
array('tr' => array('class' => 'even')),
'<td', '3', '/td',
'<td', '4', '/td',
'/tr',
'/table'
);
$this->assertTags($result, $expected);
}
/**
* reset the view paths
*
* @return void
**/
function endCase() {
Configure::write('viewPaths', $this->_viewPaths);
}
/**
* tearDown
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Toolbar, $this->Controller);
ClassRegistry::removeObject('view');
ClassRegistry::flush();
}
}
?>