Completed
Push — master ( baf9c0...cf2f5b )
by Wanderson
02:20
created

ControllerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 22
rs 10
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAction() 0 12 1
A testActionNotFound() 0 5 1
1
<?php
2
3
namespace Win\Mvc;
4
5
use controller\IndexController;
6
use Win\Helper\Url;
7
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