Passed
Branch master (71c281)
by Wanderson
01:19
created

ControllerFactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0
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