| 1 | <?php |
||
| 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 |