‪TYPO3CMS  9.5
CharsetConverterTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪CharsetConverterTest extends UnitTestCase
26 {
32  public function ‪validInputForSpecCharsToAscii(): array
33  {
34  return [
35  'scandinavian input' => [
36  'Näe ja koe',
37  // See issue #20612 - this is actually a wrong transition, but the way the method currently works
38  'Naee ja koe',
39  ],
40  'german input' => [
41  'Größere Änderungswünsche Weißräm',
42  'Groessere AEnderungswuensche Weissraem',
43  ],
44  ];
45  }
46 
54  string $input,
55  string $expectedString
56  ) {
57  $subject = new ‪CharsetConverter();
58  $this->assertSame($expectedString, $subject->specCharsToASCII('utf-8', $input));
59  }
60 
66  public function ‪invalidInputForSpecCharsToAscii(): array
67  {
68  return [
69  'integer input' => [
70  1,
71  ],
72  'null input' => [
73  null,
74  ],
75  'boolean input' => [
76  true,
77  ],
78  'floating point input' => [
79  3.14,
80  ],
81  ];
82  }
83 
90  {
91  $subject = new ‪CharsetConverter();
92  $this->assertSame('', $subject->specCharsToASCII('utf-8', $input));
93  }
94 }
‪TYPO3\CMS\Core\Tests\Unit\Charset\CharsetConverterTest\specCharsToAsciiConvertsUmlautsToAscii
‪specCharsToAsciiConvertsUmlautsToAscii(string $input, string $expectedString)
Definition: CharsetConverterTest.php:53
‪TYPO3\CMS\Core\Tests\Unit\Charset\CharsetConverterTest\invalidInputForSpecCharsToAscii
‪array[] invalidInputForSpecCharsToAscii()
Definition: CharsetConverterTest.php:66
‪TYPO3\CMS\Core\Tests\Unit\Charset\CharsetConverterTest\specCharsToAsciiConvertsInvalidInputToEmptyString
‪specCharsToAsciiConvertsInvalidInputToEmptyString($input)
Definition: CharsetConverterTest.php:89
‪TYPO3\CMS\Core\Charset\CharsetConverter
Definition: CharsetConverter.php:54
‪TYPO3\CMS\Core\Tests\Unit\Charset
Definition: CharsetConverterTest.php:4
‪TYPO3\CMS\Core\Tests\Unit\Charset\CharsetConverterTest\validInputForSpecCharsToAscii
‪string[][] validInputForSpecCharsToAscii()
Definition: CharsetConverterTest.php:32
‪TYPO3\CMS\Core\Tests\Unit\Charset\CharsetConverterTest
Definition: CharsetConverterTest.php:26