TYPO3 CMS  TYPO3_8-7
TypolinkViewHelperTest.php
Go to the documentation of this file.
1 <?php
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 
19 
23 class TypolinkViewHelperTest extends ViewHelperBaseTestcase
24 {
28  public function typoScriptConfigurationData()
29  {
30  return [
31  'empty input' => [
32  '', // input from link field
33  '', // additional parameters from fluid
34  '', //expected typolink
35  ],
36  'simple id input' => [
37  19,
38  '',
39  '19',
40  ],
41  'external url with target' => [
42  'www.web.de _blank',
43  '',
44  'www.web.de _blank',
45  ],
46  'page with class' => [
47  '42 - css-class',
48  '',
49  '42 - css-class',
50  ],
51  'page with title' => [
52  '42 - - "a link title"',
53  '',
54  '42 - - "a link title"',
55  ],
56  'page with title and parameters' => [
57  '42 - - "a link title" &x=y',
58  '',
59  '42 - - "a link title" &x=y',
60  ],
61  'page with title and extended parameters' => [
62  '42 - - "a link title" &x=y',
63  '&a=b',
64  '42 - - "a link title" &x=y&a=b',
65  ],
66  'only page id and overwrite' => [
67  '42',
68  '&a=b',
69  '42 - - - &a=b',
70  ],
71  ];
72  }
73 
82  public function createTypolinkParameterFromArgumentsReturnsExpectedArray($input, $additionalParametersFromFluid, $expected)
83  {
85  $subject = $this->getAccessibleMock(TypolinkViewHelper::class, ['dummy']);
86  $result = $subject->_call('createTypolinkParameterFromArguments', $input, $additionalParametersFromFluid);
87  $this->assertSame($expected, $result);
88  }
89 }