‪TYPO3CMS  ‪main
DataMapFactoryTest.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\Functional\FunctionalTestCase;
28 
29 final class ‪DataMapFactoryTest extends FunctionalTestCase
30 {
31  protected bool ‪$initializeDatabase = false;
32 
33  protected array ‪$testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example'];
34 
36 
37  protected function ‪setUp(): void
38  {
39  parent::setUp();
40  $this->dataMapFactory = $this->get(DataMapFactory::class);
41  ‪$GLOBALS['BE_USER'] = new ‪BackendUserAuthentication();
42  }
43 
44  #[Test]
45  public function ‪classSettingsAreResolved(): void
46  {
47  $dataMap = $this->dataMapFactory->buildDataMap(Administrator::class);
48 
49  self::assertInstanceOf(DataMap::class, $dataMap);
50  self::assertEquals('TYPO3Tests\BlogExample\Domain\Model\Administrator', $dataMap->getRecordType());
51  self::assertEquals('fe_users', $dataMap->getTableName());
52  }
53 
54  #[Test]
55  public function ‪columnMapPropertiesAreResolved(): void
56  {
57  $dataMap = $this->dataMapFactory->buildDataMap(TtContent::class);
58 
59  self::assertInstanceOf(DataMap::class, $dataMap);
60  self::assertNull($dataMap->getColumnMap('thisPropertyDoesNotExist'));
61 
62  $headerColumnMap = $dataMap->getColumnMap('header');
63 
64  self::assertInstanceOf(ColumnMap::class, $headerColumnMap);
65  self::assertEquals('header', $headerColumnMap->getColumnName());
66  }
67 }
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap
Definition: DataMap.php:25
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\setUp
‪setUp()
Definition: DataMapFactoryTest.php:37
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\classSettingsAreResolved
‪classSettingsAreResolved()
Definition: DataMapFactoryTest.php:45
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$initializeDatabase
‪bool $initializeDatabase
Definition: DataMapFactoryTest.php:31
‪TYPO3Tests\BlogExample\Domain\Model\Administrator
Definition: Administrator.php:28
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$dataMapFactory
‪DataMapFactory $dataMapFactory
Definition: DataMapFactoryTest.php:35
‪TYPO3Tests\BlogExample\Domain\Model\TtContent
Definition: TtContent.php:26
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper
Definition: ColumnMapFactoryTest.php:18
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: DataMapFactoryTest.php:33
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory
Definition: DataMapFactory.php:34
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\columnMapPropertiesAreResolved
‪columnMapPropertiesAreResolved()
Definition: DataMapFactoryTest.php:55
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest
Definition: DataMapFactoryTest.php:30
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap
Definition: Relation.php:18