‪TYPO3CMS  ‪main
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 PHPUnit\Framework\Attributes\Test;
25 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
26 
30 final class ‪BackendLayoutTest extends UnitTestCase
31 {
32  protected bool ‪$resetSingletonInstances = true;
33 
34  #[Test]
36  {
37  $this->expectException(\UnexpectedValueException::class);
38  $this->expectExceptionCode(1381597630);
40  $title = ‪StringUtility::getUniqueId('title');
41  $configuration = ‪StringUtility::getUniqueId('configuration');
42  new ‪BackendLayout(‪$identifier, $title, $configuration);
43  }
44 
45  #[Test]
46  public function ‪objectIsCreated(): void
47  {
48  $backendLayoutView = $this->createMock(BackendLayoutView::class);
49  $backendLayoutView->method('parseStructure')->with(self::anything())->willReturn([]);
50  GeneralUtility::setSingletonInstance(BackendLayoutView::class, $backendLayoutView);
51 
53  $title = ‪StringUtility::getUniqueId('title');
54  $configuration = ‪StringUtility::getUniqueId('configuration');
55  $backendLayout = new ‪BackendLayout(‪$identifier, $title, $configuration);
56 
57  self::assertEquals(‪$identifier, $backendLayout->getIdentifier());
58  self::assertEquals($title, $backendLayout->getTitle());
59  self::assertEquals($configuration, $backendLayout->getConfiguration());
60  }
61 }
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: BackendLayoutTest.php:32
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest\objectIsCreated
‪objectIsCreated()
Definition: BackendLayoutTest.php:46
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout
Definition: BackendLayoutCollectionTest.php:18
‪TYPO3\CMS\Backend\View\BackendLayoutView
Definition: BackendLayoutView.php:38
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout
Definition: BackendLayout.php:25
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest\invalidIdentifierIsRecognizedOnCreation
‪invalidIdentifierIsRecognizedOnCreation()
Definition: BackendLayoutTest.php:35
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout\BackendLayoutTest
Definition: BackendLayoutTest.php:31
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57