‪TYPO3CMS  9.5
SiteResolvingTest.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 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪SiteResolvingTest extends UnitTestCase
28 {
29  protected ‪$resetSingletonInstances = true;
30 
35  {
36  $siteMatcherProphecy = $this->prophesize(SiteMatcher::class);
37  GeneralUtility::setSingletonInstance(SiteMatcher::class, $siteMatcherProphecy->reveal());
38  $siteProphecy = $this->prophesize(Site::class);
39  $siteProphecyRevelation = $siteProphecy->reveal();
40  $siteMatcherProphecy->matchByPageId(23)->willReturn($siteProphecyRevelation);
41  $input = [
42  'defaultLanguagePageRow' => [
43  'uid' => 23,
44  ],
45  'effectivePid' => 42,
46  'site' => $siteProphecyRevelation,
47  ];
48  $expected = $input;
49  $expected['site'] = $siteProphecy->reveal();
50  $this->assertSame($expected, (new ‪SiteResolving())->addData($input));
51  }
52 
57  {
58  $siteMatcherProphecy = $this->prophesize(SiteMatcher::class);
59  GeneralUtility::setSingletonInstance(SiteMatcher::class, $siteMatcherProphecy->reveal());
60  $siteProphecy = $this->prophesize(Site::class);
61  $siteProphecyRevelation = $siteProphecy->reveal();
62  $siteMatcherProphecy->matchByPageId(42)->willReturn($siteProphecyRevelation);
63  $input = [
64  'effectivePid' => 42,
65  'site' => $siteProphecyRevelation,
66  ];
67  $expected = $input;
68  $expected['site'] = $siteProphecy->reveal();
69  $this->assertSame($expected, (new ‪SiteResolving())->addData($input));
70  }
71 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\SiteResolving
Definition: SiteResolving.php:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest
Definition: SiteResolvingTest.php:28
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:39
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\addDataAddsSiteObjectOfEffectivePid
‪addDataAddsSiteObjectOfEffectivePid()
Definition: SiteResolvingTest.php:56
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: SiteResolvingTest.php:29
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\addDataAddsSiteObjectOfDefaultLanguageRow
‪addDataAddsSiteObjectOfDefaultLanguageRow()
Definition: SiteResolvingTest.php:34
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Routing\SiteMatcher
Definition: SiteMatcher.php:53
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:3