‪TYPO3CMS  10.4
DataMapFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
26 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
27 
28 class ‪DataMapFactoryTest extends FunctionalTestCase
29 {
33  protected ‪$dataMapFactory;
34 
38  protected ‪$testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example'];
39 
43  protected ‪$coreExtensionsToLoad = ['extbase', 'fluid'];
44 
48  protected ‪$objectManager;
49 
53  protected function ‪setUp(): void
54  {
55  parent::setUp();
56 
57  $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
58  $this->dataMapFactory = $this->objectManager->get(DataMapFactory::class);
59 
60  ‪$GLOBALS['BE_USER'] = new ‪BackendUserAuthentication();
61  }
62 
66  public function ‪classSettingsAreResolved()
67  {
68  $dataMap = $this->dataMapFactory->buildDataMap(Administrator::class);
69 
70  self::assertInstanceOf(DataMap::class, $dataMap);
71  self::assertEquals('ExtbaseTeam\BlogExample\Domain\Model\Administrator', $dataMap->getRecordType());
72  self::assertEquals('fe_users', $dataMap->getTableName());
73  }
74 
78  public function ‪columnMapPropertiesAreResolved()
79  {
80  $dataMap = $this->dataMapFactory->buildDataMap(TtContent::class);
81 
82  self::assertInstanceOf(DataMap::class, $dataMap);
83  self::assertNull($dataMap->getColumnMap('thisPropertyDoesNotExist'));
84 
85  $headerColumnMap = $dataMap->getColumnMap('header');
86 
87  self::assertInstanceOf(ColumnMap::class, $headerColumnMap);
88  self::assertEquals('header', $headerColumnMap->getPropertyName());
89  self::assertEquals('header', $headerColumnMap->getColumnName());
90  }
91 }
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap
Definition: DataMap.php:23
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\setUp
‪setUp()
Definition: DataMapFactoryTest.php:49
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\classSettingsAreResolved
‪classSettingsAreResolved()
Definition: DataMapFactoryTest.php:62
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap
Definition: ColumnMap.php:28
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper
Definition: DataMapFactoryTest.php:16
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: DataMapFactoryTest.php:36
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: DataMapFactoryTest.php:44
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory
Definition: DataMapFactory.php:42
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\columnMapPropertiesAreResolved
‪columnMapPropertiesAreResolved()
Definition: DataMapFactoryTest.php:74
‪ExtbaseTeam\BlogExample\Domain\Model\Administrator
Definition: Administrator.php:24
‪ExtbaseTeam\BlogExample\Domain\Model\TtContent
Definition: TtContent.php:29
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: DataMapFactoryTest.php:40
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest\$dataMapFactory
‪TYPO3 CMS Extbase Persistence Generic Mapper DataMapFactory $dataMapFactory
Definition: DataMapFactoryTest.php:32
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapFactoryTest
Definition: DataMapFactoryTest.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:28