| 1 | <?php |
||
| 8 | class ControllerTest extends \PHPUnit_Framework_TestCase { |
||
| 9 | |||
| 10 | public function testGetAction() { |
||
| 11 | $controller = new IndexController('myAction'); |
||
| 12 | $this->assertEquals('myAction', $controller->getAction()); |
||
| 13 | |||
| 14 | $controller2 = new IndexController('my-action'); |
||
| 15 | $this->assertEquals('myAction', $controller2->getAction()); |
||
| 16 | |||
| 17 | Url::instance()->setUrl('my-page/example-action'); |
||
| 18 | new Application(); |
||
| 19 | $controller3 = new IndexController(); |
||
| 20 | $this->assertEquals('exampleAction', $controller3->getAction()); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function testActionNotFound() { |
||
| 24 | $index = new IndexController('index'); |
||
| 25 | $index->thisActionDoentExist(); |
||
| 26 | $this->assertEquals('404', $index->app->getPage()); |
||
| 27 | } |
||
| 28 | |||
| 29 | } |
||
| 30 |