‪TYPO3CMS  10.4
SiteResolvingTest.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 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 class ‪SiteResolvingTest extends UnitTestCase
29 {
30  protected ‪$resetSingletonInstances = true;
31 
36  {
37  $siteFinderProphecy = $this->prophesize(SiteFinder::class);
38  $siteProphecy = $this->prophesize(Site::class);
39  $siteProphecyRevelation = $siteProphecy->reveal();
40  $siteFinderProphecy->getSiteByPageId(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  self::assertSame($expected, (new ‪SiteResolving($siteFinderProphecy->reveal()))->addData($input));
51  }
52 
57  {
58  $siteFinderProphecy = $this->prophesize(SiteFinder::class);
59  $siteProphecy = $this->prophesize(Site::class);
60  $siteProphecyRevelation = $siteProphecy->reveal();
61  $siteFinderProphecy->getSiteByPageId(42)->willReturn($siteProphecyRevelation);
62  $input = [
63  'effectivePid' => 42,
64  'site' => $siteProphecyRevelation,
65  ];
66  $expected = $input;
67  $expected['site'] = $siteProphecy->reveal();
68  self::assertSame($expected, (new ‪SiteResolving($siteFinderProphecy->reveal()))->addData($input));
69  }
70 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\SiteResolving
Definition: SiteResolving.php:35
‪TYPO3\CMS\Core\Site\SiteFinder
Definition: SiteFinder.php:31
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest
Definition: SiteResolvingTest.php:29
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:40
‪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:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\addDataAddsSiteObjectOfDefaultLanguageRow
‪addDataAddsSiteObjectOfDefaultLanguageRow()
Definition: SiteResolvingTest.php:35
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18