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

ViewFactoryTest::testCreateView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 11
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 15
rs 9.4285
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