‪TYPO3CMS  10.4
TelephoneLinkHandlerTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪TelephoneLinkHandlerTest extends UnitTestCase
27 {
28 
35  {
36  return [
37  'telephone number with protocol' => [
38  [
39  'telephone' => 'tel:012345678'
40  ],
41  [
42  'telephone' => '012345678'
43  ],
44  'tel:012345678'
45  ],
46  'telephone number with protocol and spaces' => [
47  [
48  'telephone' => 'tel:+49 123 45 56 78'
49  ],
50  [
51  'telephone' => '+49 123 45 56 78'
52  ],
53  'tel:+49123455678'
54  ],
55  'invalid telephone number' => [
56  [
57  'telephone' => 'tel:+43-hello-world'
58  ],
59  [
60  'telephone' => '+43-hello-world'
61  ],
62  'tel:+43'
63  ],
64  'telephone number with weird characters' => [
65  [
66  'telephone' => 'tel:+43/123!45&56%78'
67  ],
68  [
69  'telephone' => '+43/123!45&56%78'
70  ],
71  'tel:+43123455678'
72  ],
73  ];
74  }
75 
84  public function ‪resolveReturnsSplitParameters($input, $expected): void
85  {
86  $subject = new ‪TelephoneLinkHandler();
87  self::assertEquals($expected, $subject->resolveHandlerData($input));
88  }
89 
99  public function ‪splitParametersToUnifiedIdentifier($input, $parameters, $expected)
100  {
101  $subject = new ‪TelephoneLinkHandler();
102  self::assertEquals($expected, $subject->asString($parameters));
103  }
104 }