2007-07-09 19:26:37 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
/**
|
|
|
|
* Short description for file.
|
|
|
|
*
|
|
|
|
* Long description for file
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
2008-01-01 22:18:17 +00:00
|
|
|
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
2007-07-09 19:26:37 +00:00
|
|
|
* 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
|
2008-01-01 22:18:17 +00:00
|
|
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
2007-07-09 19:26:37 +00:00
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
uses('debugger');
|
|
|
|
/**
|
|
|
|
* Short description for class.
|
|
|
|
*
|
|
|
|
* @package cake.tests
|
|
|
|
* @subpackage cake.tests.cases.libs
|
|
|
|
*/
|
|
|
|
class DebuggerTest extends UnitTestCase {
|
|
|
|
|
2007-12-23 21:25:30 +00:00
|
|
|
//do not move code below or it change line numbers which are used in the tests
|
|
|
|
function testOutput() {
|
|
|
|
|
|
|
|
Debugger::invoke(Debugger::getInstance());
|
|
|
|
$result = Debugger::output(false);
|
|
|
|
$this->assertEqual($result, '');
|
|
|
|
$out .= '';
|
|
|
|
$result = Debugger::output(true);
|
2007-12-24 23:47:46 +00:00
|
|
|
$expected = array(array(
|
|
|
|
'error' => 'Notice', 'code' => '8', 'description' => 'Undefined variable: out', 'line' => '44', 'file' => 'CORE/cake/tests/cases/libs/debugger.test.php',
|
|
|
|
'context' => array("\$result\t=\tnull"),
|
|
|
|
'trace' => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 44
|
|
|
|
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42
|
|
|
|
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591
|
|
|
|
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
|
|
|
|
[main] - CORE/app/webroot/test.php, line 240"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
|
|
|
|
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
|
2007-12-23 21:25:30 +00:00
|
|
|
$this->assertEqual($result, $expected);
|
|
|
|
ob_start();
|
|
|
|
Debugger::output('txt');
|
|
|
|
$other .= '';
|
|
|
|
$result = ob_get_clean();
|
2007-12-24 23:47:46 +00:00
|
|
|
$expected = "Notice: 8 :: Undefined variable: other on line 67 of CORE/cake/tests/cases/libs/debugger.test.php\n";
|
|
|
|
$expected .= 'Context:
|
|
|
|
$result = array(array("error" => "Notice","code" => 8,"description" => "Undefined variable: out","line" => 44,"file" => "CORE/cake/tests/cases/libs/debugger.test.php","context" => array("$result = null"),"trace" => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 44
|
|
|
|
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42
|
|
|
|
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591
|
|
|
|
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
|
|
|
|
[main] - CORE/app/webroot/test.php, line 240"))
|
2007-12-29 19:05:41 +00:00
|
|
|
$out = "[empty string]"
|
2007-12-24 23:47:46 +00:00
|
|
|
$expected = array(array("error" => "Notice","code" => "8","description" => "Undefined variable: out","line" => "44","file" => "CORE/cake/tests/cases/libs/debugger.test.php","context" => array("$result = null"),"trace" => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 44
|
|
|
|
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42
|
|
|
|
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591
|
|
|
|
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
|
|
|
|
[main] - CORE/app/webroot/test.php, line 240"))
|
|
|
|
';
|
|
|
|
$expected .= 'Trace:
|
|
|
|
DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 67
|
|
|
|
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48
|
|
|
|
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126
|
|
|
|
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42
|
|
|
|
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588
|
|
|
|
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591
|
|
|
|
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
|
|
|
|
[main] - CORE/app/webroot/test.php, line 240';
|
|
|
|
|
|
|
|
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
|
|
|
|
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
|
2007-12-23 21:25:30 +00:00
|
|
|
$this->assertEqual($result, $expected);
|
|
|
|
|
|
|
|
set_error_handler('simpleTestErrorHandler');
|
2007-07-09 19:26:37 +00:00
|
|
|
}
|
2007-12-23 21:25:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
function testExportVar() {
|
|
|
|
App::import('Controller');
|
|
|
|
$Controller = new Controller();
|
|
|
|
$Controller->helpers = array('Html', 'Form');
|
|
|
|
$View = new View($Controller);
|
|
|
|
$result = Debugger::exportVar($View);
|
2007-12-29 19:05:41 +00:00
|
|
|
$expected = 'ViewView::$base = NULL
|
|
|
|
View::$here = NULL
|
|
|
|
View::$plugin = NULL
|
2007-12-23 21:25:30 +00:00
|
|
|
View::$name = "[empty string]"
|
2007-12-29 19:05:41 +00:00
|
|
|
View::$action = NULL
|
2007-12-23 21:25:30 +00:00
|
|
|
View::$params = array()
|
|
|
|
View::$passedArgs = array()
|
|
|
|
View::$data = array()
|
|
|
|
View::$helpers = array("Html","Form")
|
|
|
|
View::$viewPath = "[empty string]"
|
|
|
|
View::$viewVars = array()
|
|
|
|
View::$layout = "default"
|
2007-12-29 19:05:41 +00:00
|
|
|
View::$layoutPath = NULL
|
|
|
|
View::$pageTitle = false
|
2007-12-23 21:25:30 +00:00
|
|
|
View::$autoRender = true
|
|
|
|
View::$autoLayout = true
|
|
|
|
View::$ext = ".ctp"
|
2007-12-29 19:05:41 +00:00
|
|
|
View::$subDir = NULL
|
|
|
|
View::$themeWeb = NULL
|
|
|
|
View::$cacheAction = false
|
2007-12-23 21:25:30 +00:00
|
|
|
View::$validationErrors = array()
|
2007-12-29 19:05:41 +00:00
|
|
|
View::$hasRendered = false
|
2007-12-23 21:25:30 +00:00
|
|
|
View::$loaded = array()
|
2007-12-29 19:05:41 +00:00
|
|
|
View::$modelScope = false
|
|
|
|
View::$model = NULL
|
|
|
|
View::$association = NULL
|
|
|
|
View::$field = NULL
|
|
|
|
View::$fieldSuffix = NULL
|
|
|
|
View::$modelId = NULL
|
2007-12-23 21:25:30 +00:00
|
|
|
View::$uuids = array()
|
|
|
|
View::$__passedVars = array("viewVars","action","autoLayout","autoRender","ext","base","webroot","helpers","here","layout","name","pageTitle","layoutPath","viewPath","params","data","webservices","plugin","passedArgs","cacheAction")
|
|
|
|
View::$__scripts = array()
|
|
|
|
View::$__paths = array()
|
2007-12-29 19:05:41 +00:00
|
|
|
View::$_log = NULL
|
|
|
|
View::$webroot = NULL
|
|
|
|
View::$webservices = NULL
|
2007-12-23 21:25:30 +00:00
|
|
|
View::element()
|
|
|
|
View::render()
|
|
|
|
View::renderElement()
|
|
|
|
View::renderLayout()
|
|
|
|
View::renderCache()
|
|
|
|
View::getVars()
|
|
|
|
View::getVar()
|
|
|
|
View::addScript()
|
|
|
|
View::uuid()
|
|
|
|
View::entity()
|
|
|
|
View::set()
|
|
|
|
View::error()
|
|
|
|
View::Object()
|
|
|
|
View::toString()
|
|
|
|
View::requestAction()
|
|
|
|
View::log()
|
|
|
|
View::cakeError()';
|
|
|
|
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
|
|
|
|
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
|
|
|
|
$this->assertEqual($result, $expected);
|
|
|
|
}
|
|
|
|
|
2007-07-09 19:26:37 +00:00
|
|
|
}
|
|
|
|
?>
|