Created
May 24, 2012 03:31
-
-
Save tareko/2779261 to your computer and use it in GitHub Desktop.
Broken function re: Testing the Calendar controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function: | |
| public function view($id = null) { | |
| $this->Calendar->id = $id; | |
| if (!$this->Calendar->exists()) { | |
| throw new NotFoundException(__('Invalid calendar')); | |
| } | |
| $this->set('calendar', $this->Calendar->read(null, $id)); | |
| } | |
| Test: | |
| public function testViewNoId() { | |
| $result = $this->testAction('/calendars/view'); | |
| $this->setExpectedException('NotFoundException'); | |
| } | |
| Result: | |
| NotFoundException | |
| Invalid calendar | |
| Test case: CalendarsControllerTestCase(testViewNoId) | |
| Stack trace: | |
| CalendarsController::view | |
| /var/www/kitab/lib/Cake/Controller/Controller.php : 485 | |
| /var/www/kitab/lib/Cake/Routing/Dispatcher.php : 103 | |
| /var/www/kitab/lib/Cake/Routing/Dispatcher.php : 85 | |
| /var/www/kitab/lib/Cake/TestSuite/ControllerTestCase.php : 266 | |
| ControllerTestCase::_testAction | |
| /var/www/kitab/lib/Cake/TestSuite/ControllerTestCase.php : 187 | |
| /var/www/kitab/app/Test/Case/Controller/CalendarsControllerTest.php : 60 | |
| /var/www/kitab/app/Test/Case/Controller/CalendarsControllerTest.php : 60 | |
| CalendarsControllerTestCase::testViewNoId | |
| /usr/share/php/PHPUnit/Framework/TestCase.php : 942 | |
| /usr/share/php/PHPUnit/Framework/TestCase.php : 804 | |
| /usr/share/php/PHPUnit/Framework/TestResult.php : 649 | |
| /usr/share/php/PHPUnit/Framework/TestCase.php : 751 | |
| /var/www/kitab/lib/Cake/TestSuite/CakeTestCase.php : 78 | |
| /usr/share/php/PHPUnit/Framework/TestSuite.php : 772 | |
| /usr/share/php/PHPUnit/Framework/TestSuite.php : 745 | |
| /usr/share/php/PHPUnit/TextUI/TestRunner.php : 325 | |
| /var/www/kitab/lib/Cake/TestSuite/CakeTestRunner.php : 57 | |
| /var/www/kitab/lib/Cake/TestSuite/CakeTestSuiteCommand.php : 111 | |
| /var/www/kitab/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php : 251 | |
| /var/www/kitab/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php : 99 | |
| /var/www/kitab/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php : 116 | |
| /var/www/kitab/app/webroot/test.php : 92 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment