Completed
Push — master ( cf2f5b...2b18f3 )
by Wanderson
02:54
created

ControllerFactoryTest::testControllerIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace Win\Mvc;
4
5
use Win\Mvc\Application;
6
use Win\Mvc\ControllerFactory;
7
use Win\Mvc\DefaultController;
8
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