1 | <?php |
||
9 | class ControllerFactoryTest extends \PHPUnit_Framework_TestCase { |
||
10 | |||
11 | public function testControllerNotFound() { |
||
12 | new Application(); |
||
13 | $controller = ControllerFactory::create('this-controller-doent-exit'); |
||
14 | $notFound = $controller instanceof DefaultController || $controller instanceof Error404Controller; |
||
15 | $this->assertTrue($notFound); |
||
16 | } |
||
17 | |||
18 | public function testControllerIndex() { |
||
19 | new Application(); |
||
20 | $controller = ControllerFactory::create('index'); |
||
21 | $notFound = $controller instanceof DefaultController; |
||
22 | $this->assertFalse($notFound); |
||
23 | } |
||
24 | |||
25 | public function testAutomaticActionName() { |
||
26 | new Application(); |
||
27 | $controller = ControllerFactory::create('index', 'my-example-action'); |
||
28 | $this->assertEquals('myExampleAction', $controller->getAction()); |
||
29 | } |
||
30 | |||
31 | } |
||
32 |