[TASK] Add Unittests for Uri/PageViewHelper
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / Unit / ViewHelpers / Uri / PageViewHelperTest.php
1 <?php
2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Uri;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
18 use TYPO3\CMS\Fluid\ViewHelpers\Uri\PageViewHelper;
19
20 /**
21 * Test-case for Link\PageViewHelper
22 */
23 class PageViewHelperTest extends ViewHelperBaseTestcase {
24
25 /**
26 * @var PageViewHelper
27 */
28 protected $viewHelper;
29
30 /**
31 * setUp function
32 */
33 protected function setUp() {
34 parent::setUp();
35 $this->viewHelper = $this->getAccessibleMock(PageViewHelper::class, array('renderChildren'));
36 $this->injectDependenciesIntoViewHelper($this->viewHelper);
37 $this->viewHelper->initializeArguments();
38 }
39
40 /**
41 * @test
42 */
43 public function renderProvidesUriForValidLinkTarget() {
44 $this->uriBuilder->expects($this->once())->method('build')->will($this->returnValue('index.php'));
45 $this->viewHelper->render();
46 }
47
48 /**
49 * @test
50 */
51 public function renderWillNotProvideUriForNonValidLinkTarget() {
52 $this->uriBuilder->expects($this->once())->method('build')->will($this->returnValue(NULL));
53 $this->viewHelper->render();
54 }
55
56 }