TYPO3 CMS  TYPO3_8-7
PageLinkHandlerTest.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 
18 
19 class PageLinkHandlerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
20 {
21 
28  {
29  return [
30  'current page - cool style' => [
31  [
32  'uid' => 'current'
33  ],
34  [
35  'pageuid' => 'current'
36  ],
37  't3://page?uid=current'
38  ],
39  'current empty page - cool style' => [
40  [
41 
42  ],
43  [
44  'pageuid' => 'current'
45  ],
46  't3://page?uid=current'
47  ],
48  'simple page - cool style' => [
49  [
50  'uid' => 13
51  ],
52  [
53  'pageuid' => 13
54  ],
55  't3://page?uid=13'
56  ],
57  'page with alias - cool style' => [
58  [
59  'alias' => 'alias13'
60  ],
61  [
62  'pagealias' => 'alias13'
63  ],
64  't3://page?alias=alias13'
65  ],
66  'page with alias and type - cool style' => [
67  [
68  'alias' => 'alias13',
69  'type' => 31
70  ],
71  [
72  'pagealias' => 'alias13',
73  'pagetype' => '31'
74  ],
75  't3://page?alias=alias13&type=31'
76  ],
77  'page with alias and parameters - cool style' => [
78  [
79  'alias' => 'alias13',
80  'my' => 'additional',
81  'parameter' => 'that',
82  'are' => 'nice'
83  ],
84  [
85  'pagealias' => 'alias13',
86  'parameters' => 'my=additional&parameter=that&are=nice'
87  ],
88  't3://page?alias=alias13&my=additional&parameter=that&are=nice',
89  ],
90  'page with alias and parameters and fragment - cool style' => [
91  [
92  'alias' => 'alias13',
93  'my' => 'additional',
94  'parameter' => 'that',
95  'are' => 'nice'
96  ],
97  [
98  'pagealias' => 'alias13',
99  'parameters' => 'my=additional&parameter=that&are=nice',
100  'fragment' => 'again'
101  ],
102  't3://page?alias=alias13&my=additional&parameter=that&are=nice#again',
103  ]
104  ];
105  }
106 
116  public function resolveReturnsSplitParameters($input, $expected, $finalString)
117  {
118  $subject = new PageLinkHandler();
119  // fragment it is processed outside handler data
120  if (isset($expected['fragment'])) {
121  unset($expected['fragment']);
122  }
123  $this->assertEquals($expected, $subject->resolveHandlerData($input));
124  }
125 
135  public function splitParametersToUnifiedIdentifier($input, $parameters, $expected)
136  {
137  $subject = new PageLinkHandler();
138  $this->assertEquals($expected, $subject->asString($parameters));
139  }
140 }