Revert "[CLEANUP] Rework/simplify copyright header and remove @package"
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / Unit / ViewHelpers / Link / PageViewHelperTest.php
1 <?php
2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Link;
3
4 /* *
5 * This script is part of the TYPO3 project - inspiring people to share! *
6 * *
7 * TYPO3 is free software; you can redistribute it and/or modify it under *
8 * the terms of the GNU General Public License version 2 as published by *
9 * the Free Software Foundation. *
10 * *
11 * This script is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
14 * Public License for more details. *
15 * */
16
17 use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
18 use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
19 use TYPO3\CMS\Fluid\ViewHelpers\Link\PageViewHelper;
20
21 /**
22 * Test-case for Link\PageViewHelper
23 */
24 class PageViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase {
25
26 /**
27 * @var PageViewHelper
28 */
29 protected $viewHelper;
30
31 /**
32 * setUp function
33 */
34 public function setUp() {
35 parent::setUp();
36 $this->viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Link\\PageViewHelper', array('renderChildren'));
37 $this->injectDependenciesIntoViewHelper($this->viewHelper);
38 $this->viewHelper->initializeArguments();
39 }
40
41 /**
42 * @test
43 */
44 public function renderProvidesATagForValidLinkTarget() {
45 $this->uriBuilder->expects($this->once())->method('build')->will($this->returnValue('index.php'));
46 $this->tagBuilder->expects($this->once())->method('render');
47 $this->viewHelper->render();
48 }
49
50 /**
51 * @test
52 */
53 public function renderWillNotProvideATagForNonValidLinkTarget() {
54 $this->uriBuilder->expects($this->once())->method('build')->will($this->returnValue(NULL));
55 $this->tagBuilder->expects($this->never())->method('render');
56 $this->viewHelper->render();
57 }
58
59 }