[TASK] Add Unittests for Uri/PageViewHelper 96/39196/3
authordirk_juettner <dirk.juettner@gmail.com>
Sat, 2 May 2015 13:22:51 +0000 (15:22 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 2 May 2015 13:50:12 +0000 (15:50 +0200)
Releases: master
Resolves: #66743
Related: #66737
Change-Id: I043acf0d5d3a3c8be7756d94626611074199c13c
Reviewed-on: http://review.typo3.org/39196
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Uri/PageViewHelperTest.php [new file with mode: 0644]

diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Uri/PageViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Uri/PageViewHelperTest.php
new file mode 100644 (file)
index 0000000..9dfef2e
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Uri;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
+use TYPO3\CMS\Fluid\ViewHelpers\Uri\PageViewHelper;
+
+/**
+ * Test-case for Link\PageViewHelper
+ */
+class PageViewHelperTest extends ViewHelperBaseTestcase {
+
+       /**
+        * @var PageViewHelper
+        */
+       protected $viewHelper;
+
+       /**
+        * setUp function
+        */
+       protected function setUp() {
+               parent::setUp();
+               $this->viewHelper = $this->getAccessibleMock(PageViewHelper::class, array('renderChildren'));
+               $this->injectDependenciesIntoViewHelper($this->viewHelper);
+               $this->viewHelper->initializeArguments();
+       }
+
+       /**
+        * @test
+        */
+       public function renderProvidesUriForValidLinkTarget() {
+               $this->uriBuilder->expects($this->once())->method('build')->will($this->returnValue('index.php'));
+               $this->viewHelper->render();
+       }
+
+       /**
+        * @test
+        */
+       public function renderWillNotProvideUriForNonValidLinkTarget() {
+               $this->uriBuilder->expects($this->once())->method('build')->will($this->returnValue(NULL));
+               $this->viewHelper->render();
+       }
+
+}