‪TYPO3CMS  11.5
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 
20 use Prophecy\PhpUnit\ProphecyTrait;
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
29 class ‪SiteResolvingTest extends UnitTestCase
30 {
31  use ProphecyTrait;
32 
33  protected ‪$resetSingletonInstances = true;
34 
38  public function ‪addDataAddsSiteObjectOfDefaultLanguageRow(): void
39  {
40  $siteFinderProphecy = $this->prophesize(SiteFinder::class);
41  $siteProphecy = $this->prophesize(Site::class);
42  $siteProphecyRevelation = $siteProphecy->reveal();
43  $siteFinderProphecy->getSiteByPageId(23)->willReturn($siteProphecyRevelation);
44  $input = [
45  'defaultLanguagePageRow' => [
46  'uid' => 23,
47  ],
48  'effectivePid' => 42,
49  'site' => $siteProphecyRevelation,
50  ];
51  $expected = $input;
52  $expected['site'] = $siteProphecy->reveal();
53  self::assertSame($expected, (new ‪SiteResolving($siteFinderProphecy->reveal()))->addData($input));
54  }
55 
59  public function ‪addDataAddsSiteObjectOfEffectivePid(): void
60  {
61  $siteFinderProphecy = $this->prophesize(SiteFinder::class);
62  $siteProphecy = $this->prophesize(Site::class);
63  $siteProphecyRevelation = $siteProphecy->reveal();
64  $siteFinderProphecy->getSiteByPageId(42)->willReturn($siteProphecyRevelation);
65  $input = [
66  'effectivePid' => 42,
67  'site' => $siteProphecyRevelation,
68  ];
69  $expected = $input;
70  $expected['site'] = $siteProphecy->reveal();
71  self::assertSame($expected, (new ‪SiteResolving($siteFinderProphecy->reveal()))->addData($input));
72  }
73 }
‪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:30
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:42
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\addDataAddsSiteObjectOfEffectivePid
‪addDataAddsSiteObjectOfEffectivePid()
Definition: SiteResolvingTest.php:58
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: SiteResolvingTest.php:32
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\SiteResolvingTest\addDataAddsSiteObjectOfDefaultLanguageRow
‪addDataAddsSiteObjectOfDefaultLanguageRow()
Definition: SiteResolvingTest.php:37
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18