Completed
Push — master ( 659231...788af6 )
by Wanderson
05:06
created

ViewFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateView() 0 15 1
A testCreateViewWithParams() 0 7 1
1
<?php
2
3
namespace Win\Mvc;
4
5
use Win\Mvc\ViewFactory;
6
use Win\Helper\Url;
7
8
class ViewFactoryTest extends \PHPUnit_Framework_TestCase {
9
10
	public function testCreateView() {
11
		$defaultView = ViewFactory::create('this-page-doent-exist');
12
		$this->assertFalse($defaultView->exists());
13
14
		$indexView = ViewFactory::create('index');
15
		$this->assertTrue($indexView->exists());
16
17
		$urlFragments = ['index'];
18
		$otherView = ViewFactory::create('this-page-doent-exist', $urlFragments);
19
		$this->assertTrue($otherView->exists());
20
21
		$urlFragments2 = ['index', 'this-subpage-doent-exit'];
22
		$otherView2 = ViewFactory::create('this-page-doent-exist', $urlFragments2);
23
		$this->assertFalse($otherView2->exists());
24
	}
25
26
	public function testCreateViewWithParams() {
27
		$view = ViewFactory::create('this-page-doent-exist', ['index']);
28
		$this->assertTrue($view->exists());
29
30
		$viewInexistent = ViewFactory::create('this-page-doent-exist', ['page-doent-exist']);
31
		$this->assertFalse($viewInexistent->exists());
32
	}
33
34
}
35