‪TYPO3CMS  11.5
BackendLayoutTest.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\Argument;
21 use Prophecy\PhpUnit\ProphecyTrait;
26 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
27 
31 class ‪BackendLayoutTest extends UnitTestCase
32 {
33  use ProphecyTrait;
34 
35  protected ‪$resetSingletonInstances = true;
36 
40  public function ‪invalidIdentifierIsRecognizedOnCreation(): void
41  {
42  $this->expectException(\UnexpectedValueException::class);
43  $this->expectExceptionCode(1381597630);
44  $identifier = ‪StringUtility::getUniqueId('identifier__');
45  $title = ‪StringUtility::getUniqueId('title');
46  $configuration = ‪StringUtility::getUniqueId('configuration');
47  new ‪BackendLayout($identifier, $title, $configuration);
48  }
49 
53  public function ‪objectIsCreated(): void
54  {
55  $backendLayoutView = $this->prophesize(BackendLayoutView::class);
56  $backendLayoutView->parseStructure(Argument::any())->willReturn([]);
57  GeneralUtility::setSingletonInstance(BackendLayoutView::class, $backendLayoutView->reveal());
58 
59  $identifier = ‪StringUtility::getUniqueId('identifier');
60  $title = ‪StringUtility::getUniqueId('title');
61  $configuration = ‪StringUtility::getUniqueId('configuration');
62  $backendLayout = new ‪BackendLayout($identifier, $title, $configuration);
63 
64  self::assertEquals($identifier, $backendLayout->getIdentifier());
65  self::assertEquals($title, $backendLayout->getTitle());
66  self::assertEquals($configuration, $backendLayout->getConfiguration());
67  }
68 }
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: BackendLayoutTest.php:34
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest\objectIsCreated
‪objectIsCreated()
Definition: BackendLayoutTest.php:52
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout
Definition: BackendLayoutCollectionTest.php:18
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static string getUniqueId($prefix='')
Definition: StringUtility.php:128
‪TYPO3\CMS\Backend\View\BackendLayoutView
Definition: BackendLayoutView.php:37
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout
Definition: BackendLayout.php:25
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest\invalidIdentifierIsRecognizedOnCreation
‪invalidIdentifierIsRecognizedOnCreation()
Definition: BackendLayoutTest.php:39
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:22
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest
Definition: BackendLayoutTest.php:32