‪TYPO3CMS  10.4
SiteConfigurationControllerTest.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 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪SiteConfigurationControllerTest extends UnitTestCase
28 {
29 
34  {
35  $mockedSiteConfigurationController = $this->getAccessibleMock(SiteConfigurationController::class, ['dummy'], [], '', false);
36 
37  $sites = [
38  new ‪Site('site-1', 1, [
39  'base' => '//domain1.tld',
40  'languages' => [
41  [
42  'languageId' => 0,
43  'base' => '/',
44  'locale' => 'de_DE.UTF-8',
45  ],
46  [
47  'languageId' => 1,
48  'base' => '/fr/',
49  'locale' => 'fr_FR.UTF-8',
50  ]
51  ]
52  ]),
53  new ‪Site('site-2', 1, [
54  'base' => '//domain2.tld',
55  'languages' => [
56  [
57  'languageId' => 0,
58  'base' => '/',
59  'locale' => 'de_DE.UTF-8',
60  ],
61  [
62  'languageId' => 1,
63  'base' => 'https://domain1.tld/',
64  'locale' => 'fr_FR.UTF-8',
65  ],
66  [
67  'languageId' => 2,
68  'base' => 'https://domain2.tld/en',
69  'locale' => 'fr_FR.UTF-8',
70  ]
71  ]
72  ]),
73  new ‪Site('site-3', 3, [
74  'base' => '/',
75  'languages' => [
76  [
77  'languageId' => 0,
78  'base' => 'http://domain1.tld/de',
79  'locale' => 'de_DE.UTF-8',
80  ],
81  [
82  'languageId' => 1,
83  'base' => 'https://domain3.tld',
84  'locale' => 'fr_FR.UTF-8',
85  ]
86  ]
87  ]),
88  new ‪Site('site-4', 4, [
89  'base' => '',
90  'languages' => [
91  [
92  'languageId' => 0,
93  'base' => 'http://domain1.tld/de/',
94  'locale' => 'de_DE.UTF-8',
95  ],
96  [
97  'languageId' => 1,
98  'base' => 'http://domain1.tld/',
99  'locale' => 'fr_FR.UTF-8',
100  ]
101  ]
102  ]),
103  new ‪Site('site-5', 5, [
104  'base' => '//domain2.tld/en/',
105  'languages' => [
106  [
107  'languageId' => 0,
108  'base' => '/',
109  'locale' => 'de_DE.UTF-8',
110  ],
111  ]
112  ])
113  ];
114  $rootPages = array_flip([1, 2, 3, 4, 5]);
115 
116  $expected = [
117  'domain1.tld' => [
118  '//domain1.tld' => 1,
119  'https://domain1.tld' => 1,
120  'http://domain1.tld' => 1,
121  ],
122  'domain2.tld/en' => [
123  'https://domain2.tld/en' => 1,
124  '//domain2.tld/en' => 1,
125  ],
126  'domain1.tld/de' => [
127  'http://domain1.tld/de' => 2,
128  ],
129  ];
130 
131  self::assertEquals($expected, $mockedSiteConfigurationController->_call('getDuplicatedEntryPoints', $sites, $rootPages));
132  }
133 }
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:40
‪TYPO3\CMS\Backend\Controller\SiteConfigurationController
Definition: SiteConfigurationController.php:61
‪TYPO3\CMS\Backend\Tests\Unit\Controller
Definition: EditDocumentControllerTest.php:16
‪TYPO3\CMS\Backend\Tests\Unit\Controller\SiteConfigurationControllerTest
Definition: SiteConfigurationControllerTest.php:28
‪TYPO3\CMS\Backend\Tests\Unit\Controller\SiteConfigurationControllerTest\duplicateEntryPointsAreRecognized
‪duplicateEntryPointsAreRecognized()
Definition: SiteConfigurationControllerTest.php:33