‪TYPO3CMS  9.5
InputSlugElementTest.php
Go to the documentation of this file.
1 <?php
2 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 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪InputSlugElementTest extends UnitTestCase
26 {
31  {
32  $languages = [
33  [
34  'languageId' => 0,
35  'locale' => 'en_US.UTF-8',
36  'base' => '/en/'
37  ],
38  [
39  'languageId' => 1,
40  'locale' => 'de_DE.UTF-8',
41  'base' => '/de/'
42  ]
43  ];
44 
45  $site = new ‪Site('www.foo.de', 0, [
46  'languages' => $languages
47  ]);
48 
49  $subject = $this->getAccessibleMock(
50  InputSlugElement::class,
51  ['dummy'],
52  [],
53  '',
54  false
55  );
56 
57  static::assertSame('/en', $subject->_call('getPrefix', $site, -1));
58  static::assertSame('/en', $subject->_call('getPrefix', $site, 0));
59  static::assertSame('/de', $subject->_call('getPrefix', $site, 1));
60  }
61 
66  {
67  $site = new ‪Site('www.foo.de', 0, []);
68 
69  $subject = $this->getAccessibleMock(
70  InputSlugElement::class,
71  ['dummy'],
72  [],
73  '',
74  false
75  );
76 
77  self::assertSame('', $subject->_call('getPrefix', $site, 99));
78  }
79 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\Element\InputSlugElementTest\getPrefixReturnsEmptyStringForUndefinedLanguages
‪getPrefixReturnsEmptyStringForUndefinedLanguages()
Definition: InputSlugElementTest.php:65
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:39
‪TYPO3\CMS\Backend\Form\Element\InputSlugElement
Definition: InputSlugElement.php:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\Element\InputSlugElementTest\getPrefixReturnsDefaultBaseUrlForAllDefinedLanguagesAndMinusOne
‪getPrefixReturnsDefaultBaseUrlForAllDefinedLanguagesAndMinusOne()
Definition: InputSlugElementTest.php:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\Element
Definition: AbstractFormElementTest.php:2
‪TYPO3\CMS\Backend\Tests\Unit\Form\Element\InputSlugElementTest
Definition: InputSlugElementTest.php:26