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