TYPO3 CMS  TYPO3_6-2
ExternalViewHelperTest.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
18 
22  protected $viewHelper;
23 
24  public function setUp() {
25  parent::setUp();
26  $this->viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\Uri\ExternalViewHelper();
27  $this->injectDependenciesIntoViewHelper($this->viewHelper);
28  $this->viewHelper->initializeArguments();
29  }
30 
34  public function renderReturnsSpecifiedUri() {
35  $this->viewHelper->initialize();
36  $actualResult = $this->viewHelper->render('http://www.some-domain.tld');
37 
38  $this->assertEquals('http://www.some-domain.tld', $actualResult);
39  }
40 
45  $this->viewHelper->initialize();
46  $actualResult = $this->viewHelper->render('www.some-domain.tld');
47 
48  $this->assertEquals('http://www.some-domain.tld', $actualResult);
49  }
50 
55  $this->viewHelper->initialize();
56  $actualResult = $this->viewHelper->render('some-domain.tld', 'ftp');
57 
58  $this->assertEquals('ftp://some-domain.tld', $actualResult);
59  }
60 
64  public function renderDoesNotAddEmptyScheme() {
65  $this->viewHelper->initialize();
66  $actualResult = $this->viewHelper->render('some-domain.tld', '');
67 
68  $this->assertEquals('some-domain.tld', $actualResult);
69  }
70 }
injectDependenciesIntoViewHelper(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper)