"Fixing paths in debugger tests"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6310 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-01-02 05:52:53 +00:00
parent 30f4f74199
commit 44fe1da19b

View file

@ -37,24 +37,28 @@ class DebuggerTest extends UnitTestCase {
//do not move code below or it change line numbers which are used in the tests //do not move code below or it change line numbers which are used in the tests
function testOutput() { function testOutput() {
if (file_exists(APP . DS . 'vendors' . DS . 'simpletest' . DS . 'reporter.php')) {
define('SIMPLETESTVENDORPATH', 'APP' . DS . 'vendors');
} else {
define('SIMPLETESTVENDORPATH', 'CORE' . DS . 'vendors');
}
Debugger::invoke(Debugger::getInstance()); Debugger::invoke(Debugger::getInstance());
$result = Debugger::output(false); $result = Debugger::output(false);
$this->assertEqual($result, ''); $this->assertEqual($result, '');
$out .= ''; $out .= '';
$result = Debugger::output(true); $result = Debugger::output(true);
$expected = array(array( $expected = array(array(
'error' => 'Notice', 'code' => '8', 'description' => 'Undefined variable: out', 'line' => '44', 'file' => 'CORE/cake/tests/cases/libs/debugger.test.php', 'error' => 'Notice', 'code' => '8', 'description' => 'Undefined variable: out', 'line' => '48', 'file' => 'CORE/cake/tests/cases/libs/debugger.test.php',
'context' => array("\$result\t=\tnull"), 'context' => array("\$result\t=\tnull"),
'trace' => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 44 'trace' => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 48
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68 SimpleInvoker::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48 SimpleErrorTrappingInvoker::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42 SimpleExceptionTrappingInvoker::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/exceptions.php, line 42
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135 SimpleTestCase::run() - " . SIMPLETESTVENDORPATH . "/simpletest/test_case.php, line 135
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588 TestSuite::run() - " . SIMPLETESTVENDORPATH . "/simpletest/test_case.php, line 588
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591 TestSuite::run() - " . SIMPLETESTVENDORPATH . "/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93 TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240" [main] - APP/webroot/test.php, line 240"
) )
@ -66,49 +70,48 @@ TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
Debugger::output('txt'); Debugger::output('txt');
$other .= ''; $other .= '';
$result = ob_get_clean(); $result = ob_get_clean();
$expected = "Notice: 8 :: Undefined variable: other on line 67 of CORE/cake/tests/cases/libs/debugger.test.php\n"; $expected = "Notice: 8 :: Undefined variable: other on line 71 of CORE/cake/tests/cases/libs/debugger.test.php\n";
$expected .= 'Context: $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 $result = array(array("error" => "Notice","code" => 8,"description" => "Undefined variable: out","line" => 48,"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 48
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68 SimpleInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48 SimpleErrorTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42 SimpleExceptionTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/exceptions.php, line 42
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135 SimpleTestCase::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 135
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588 TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 588
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591 TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93 TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240")) [main] - APP/webroot/test.php, line 240"))
$out = "[empty string]" $out = "[empty string]"
$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 $expected = array(array("error" => "Notice","code" => "8","description" => "Undefined variable: out","line" => "48","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 48
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68 SimpleInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48 SimpleErrorTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42 SimpleExceptionTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/exceptions.php, line 42
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135 SimpleTestCase::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 135
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588 TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 588
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591 TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93 TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240")) [main] - APP/webroot/test.php, line 240"))
'; ';
$expected .= 'Trace: $expected .= 'Trace:
DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 67 DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 71
SimpleInvoker::invoke() - CORE/vendors/simpletest/invoker.php, line 68 SimpleInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - CORE/vendors/simpletest/errors.php, line 48 SimpleErrorTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - CORE/vendors/simpletest/invoker.php, line 126 SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - CORE/vendors/simpletest/exceptions.php, line 42 SimpleExceptionTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/exceptions.php, line 42
SimpleTestCase::run() - CORE/vendors/simpletest/test_case.php, line 135 SimpleTestCase::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 135
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 588 TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 588
TestSuite::run() - CORE/vendors/simpletest/test_case.php, line 591 TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93 TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240'; [main] - APP/webroot/test.php, line 240';
$result = str_replace(array("\t", "\r\n", "\n"), "", $result); $result = str_replace(array("\t", "\r\n", "\n"), "", $result);
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected); $expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
set_error_handler('simpleTestErrorHandler'); set_error_handler('simpleTestErrorHandler');
} }