mirror of
https://github.com/DanielSiepmann/legacy-collections.git
synced 2024-11-21 23:16:11 +01:00
[!!!][TASK] Support TYPO3 12.4 and PHP 8.1
Drop Support for TYPO3 v11 and other PHP versions.
This commit is contained in:
parent
e4c52ff059
commit
1bd15f0259
11 changed files with 105 additions and 82 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
||||||
/Documentation-GENERATED-temp/
|
/Documentation-GENERATED-temp/
|
||||||
|
/.Build/
|
||||||
|
/vendor/
|
||||||
|
/composer.lock
|
||||||
|
|
|
@ -17,6 +17,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace FriendsOfTYPO3\LegacyCollections\Collection;
|
namespace FriendsOfTYPO3\LegacyCollections\Collection;
|
||||||
|
|
||||||
|
use TYPO3\CMS\Core\Collection\AbstractRecordCollection;
|
||||||
|
use TYPO3\CMS\Core\Context\Context;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
|
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
|
||||||
use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
|
use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
|
||||||
|
@ -54,7 +56,7 @@ class RecordCollectionRepository
|
||||||
* Finds a record collection by uid.
|
* Finds a record collection by uid.
|
||||||
*
|
*
|
||||||
* @param int $uid The uid to be looked up
|
* @param int $uid The uid to be looked up
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection|null
|
* @return AbstractRecordCollection|null
|
||||||
*/
|
*/
|
||||||
public function findByUid($uid)
|
public function findByUid($uid)
|
||||||
{
|
{
|
||||||
|
@ -70,9 +72,7 @@ class RecordCollectionRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $queryBuilder->select('*')
|
$data = $queryBuilder->select('*')
|
||||||
->from($this->table)
|
->from($this->table)->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)))->executeQuery()
|
||||||
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)))
|
|
||||||
->execute()
|
|
||||||
->fetch();
|
->fetch();
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
$result = $this->createDomainObject($data);
|
$result = $this->createDomainObject($data);
|
||||||
|
@ -83,7 +83,7 @@ class RecordCollectionRepository
|
||||||
/**
|
/**
|
||||||
* Finds all record collections.
|
* Finds all record collections.
|
||||||
*
|
*
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection[]|null
|
* @return AbstractRecordCollection[]|null
|
||||||
*/
|
*/
|
||||||
public function findAll()
|
public function findAll()
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ class RecordCollectionRepository
|
||||||
* Finds record collections by table name.
|
* Finds record collections by table name.
|
||||||
*
|
*
|
||||||
* @param string $tableName Name of the table to be looked up
|
* @param string $tableName Name of the table to be looked up
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection[]
|
* @return AbstractRecordCollection[]
|
||||||
*/
|
*/
|
||||||
public function findByTableName($tableName)
|
public function findByTableName($tableName)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ class RecordCollectionRepository
|
||||||
* Finds record collection by type.
|
* Finds record collection by type.
|
||||||
*
|
*
|
||||||
* @param string $type Type to be looked up
|
* @param string $type Type to be looked up
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection[]|null
|
* @return AbstractRecordCollection[]|null
|
||||||
*/
|
*/
|
||||||
public function findByType($type)
|
public function findByType($type)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ class RecordCollectionRepository
|
||||||
*
|
*
|
||||||
* @param string $type Type to be looked up
|
* @param string $type Type to be looked up
|
||||||
* @param string $tableName Name of the table to be looked up
|
* @param string $tableName Name of the table to be looked up
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection[]|null
|
* @return AbstractRecordCollection[]|null
|
||||||
*/
|
*/
|
||||||
public function findByTypeAndTableName($type, $tableName)
|
public function findByTypeAndTableName($type, $tableName)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ class RecordCollectionRepository
|
||||||
->getConnectionForTable($this->table)
|
->getConnectionForTable($this->table)
|
||||||
->update(
|
->update(
|
||||||
$this->table,
|
$this->table,
|
||||||
['deleted' => 1, 'tstamp' => (int)$GLOBALS['EXEC_TIME']],
|
['deleted' => 1, 'tstamp' => (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp')],
|
||||||
['uid' => (int)$uid]
|
['uid' => (int)$uid]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ class RecordCollectionRepository
|
||||||
* Queries for multiple records for the given conditions.
|
* Queries for multiple records for the given conditions.
|
||||||
*
|
*
|
||||||
* @param array $conditions Conditions concatenated with AND for query
|
* @param array $conditions Conditions concatenated with AND for query
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection[]|null
|
* @return AbstractRecordCollection[]|null
|
||||||
*/
|
*/
|
||||||
protected function queryMultipleRecords(array $conditions = [])
|
protected function queryMultipleRecords(array $conditions = [])
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ class RecordCollectionRepository
|
||||||
$queryBuilder->where(...$conditions);
|
$queryBuilder->where(...$conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $queryBuilder->execute()->fetchAll();
|
$data = $queryBuilder->executeQuery()->fetchAll();
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
$result = $this->createMultipleDomainObjects($data);
|
$result = $this->createMultipleDomainObjects($data);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ class RecordCollectionRepository
|
||||||
* Creates a record collection domain object.
|
* Creates a record collection domain object.
|
||||||
*
|
*
|
||||||
* @param array $record Database record to be reconstituted
|
* @param array $record Database record to be reconstituted
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection
|
* @return AbstractRecordCollection
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function createDomainObject(array $record)
|
protected function createDomainObject(array $record)
|
||||||
|
@ -212,7 +212,7 @@ class RecordCollectionRepository
|
||||||
* Creates multiple record collection domain objects.
|
* Creates multiple record collection domain objects.
|
||||||
*
|
*
|
||||||
* @param array $data Array of multiple database records to be reconstituted
|
* @param array $data Array of multiple database records to be reconstituted
|
||||||
* @return \TYPO3\CMS\Core\Collection\AbstractRecordCollection[]
|
* @return AbstractRecordCollection[]
|
||||||
*/
|
*/
|
||||||
protected function createMultipleDomainObjects(array $data)
|
protected function createMultipleDomainObjects(array $data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,7 +194,7 @@ class StaticRecordCollection extends AbstractRecordCollection implements Editabl
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->orderBy('sys_collection_entries.sorting')
|
->orderBy('sys_collection_entries.sorting')
|
||||||
->execute();
|
->executeQuery();
|
||||||
$relatedRecords = [];
|
$relatedRecords = [];
|
||||||
while ($record = $statement->fetch()) {
|
while ($record = $statement->fetch()) {
|
||||||
$relatedRecords[] = $record;
|
$relatedRecords[] = $record;
|
||||||
|
|
|
@ -5,7 +5,6 @@ return [
|
||||||
'label' => 'title',
|
'label' => 'title',
|
||||||
'tstamp' => 'tstamp',
|
'tstamp' => 'tstamp',
|
||||||
'crdate' => 'crdate',
|
'crdate' => 'crdate',
|
||||||
'cruser_id' => 'cruser_id',
|
|
||||||
'descriptionColumn' => 'description',
|
'descriptionColumn' => 'description',
|
||||||
'versioningWS' => true,
|
'versioningWS' => true,
|
||||||
'origUid' => 't3_origuid',
|
'origUid' => 't3_origuid',
|
||||||
|
@ -34,21 +33,7 @@ return [
|
||||||
'sys_language_uid' => [
|
'sys_language_uid' => [
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
|
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
|
||||||
'config' => [
|
'config' => ['type' => 'language']
|
||||||
'type' => 'select',
|
|
||||||
'renderType' => 'selectSingle',
|
|
||||||
'foreign_table' => 'sys_language',
|
|
||||||
'items' => [
|
|
||||||
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1],
|
|
||||||
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0]
|
|
||||||
],
|
|
||||||
'default' => 0,
|
|
||||||
'fieldWizard' => [
|
|
||||||
'selectIcons' => [
|
|
||||||
'disabled' => false,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
'l10n_parent' => [
|
'l10n_parent' => [
|
||||||
'displayCond' => 'FIELD:sys_language_uid:>:0',
|
'displayCond' => 'FIELD:sys_language_uid:>:0',
|
||||||
|
@ -57,7 +42,7 @@ return [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'renderType' => 'selectSingle',
|
'renderType' => 'selectSingle',
|
||||||
'items' => [
|
'items' => [
|
||||||
['', 0]
|
['label' => '', 'value' => 0]
|
||||||
],
|
],
|
||||||
'foreign_table' => 'sys_file_collection',
|
'foreign_table' => 'sys_file_collection',
|
||||||
'foreign_table_where' => 'AND sys_file_collection.pid=###CURRENT_PID### AND sys_file_collection.sys_language_uid IN (-1,0)'
|
'foreign_table_where' => 'AND sys_file_collection.pid=###CURRENT_PID### AND sys_file_collection.sys_language_uid IN (-1,0)'
|
||||||
|
@ -78,7 +63,7 @@ return [
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
'items' => [
|
'items' => [
|
||||||
[
|
[
|
||||||
0 => '',
|
'label' => '',
|
||||||
1 => '',
|
1 => '',
|
||||||
'invertStateDisplay' => true
|
'invertStateDisplay' => true
|
||||||
]
|
]
|
||||||
|
@ -89,9 +74,7 @@ return [
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
|
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
|
||||||
'config' => [
|
'config' => [
|
||||||
'type' => 'input',
|
'type' => 'datetime',
|
||||||
'renderType' => 'inputDateTime',
|
|
||||||
'eval' => 'date,int',
|
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
@ -99,9 +82,7 @@ return [
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
|
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
|
||||||
'config' => [
|
'config' => [
|
||||||
'type' => 'input',
|
'type' => 'datetime',
|
||||||
'renderType' => 'inputDateTime',
|
|
||||||
'eval' => 'date,int',
|
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
'range' => [
|
'range' => [
|
||||||
'upper' => mktime(0, 0, 0, 1, 1, 2038),
|
'upper' => mktime(0, 0, 0, 1, 1, 2038),
|
||||||
|
@ -115,10 +96,10 @@ return [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'renderType' => 'selectSingle',
|
'renderType' => 'selectSingle',
|
||||||
'items' => [
|
'items' => [
|
||||||
['', 0],
|
['label' => '', 'value' => 0],
|
||||||
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', -1],
|
['label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', 'value' => -1],
|
||||||
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', -2],
|
['label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', 'value' => -2],
|
||||||
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', '--div--']
|
['label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', 'value' => '--div--']
|
||||||
],
|
],
|
||||||
'foreign_table' => 'fe_groups'
|
'foreign_table' => 'fe_groups'
|
||||||
]
|
]
|
||||||
|
@ -135,7 +116,6 @@ return [
|
||||||
'label' => 'LLL:EXT:legacy_collections/Resources/Private/Language/locallang_tca.xlf:sys_collection.items',
|
'label' => 'LLL:EXT:legacy_collections/Resources/Private/Language/locallang_tca.xlf:sys_collection.items',
|
||||||
'config' => [
|
'config' => [
|
||||||
'type' => 'group',
|
'type' => 'group',
|
||||||
'internal_type' => 'db',
|
|
||||||
'prepend_tname' => true,
|
'prepend_tname' => true,
|
||||||
'allowed' => '*',
|
'allowed' => '*',
|
||||||
'MM' => 'sys_collection_entries',
|
'MM' => 'sys_collection_entries',
|
||||||
|
@ -149,7 +129,7 @@ return [
|
||||||
'config' => [
|
'config' => [
|
||||||
'type' => 'input',
|
'type' => 'input',
|
||||||
'size' => 60,
|
'size' => 60,
|
||||||
'eval' => 'required'
|
'required' => true
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
|
@ -166,7 +146,7 @@ return [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'renderType' => 'selectSingle',
|
'renderType' => 'selectSingle',
|
||||||
'items' => [
|
'items' => [
|
||||||
['LLL:EXT:legacy_collections/Resources/Private/Language/locallang_tca.xlf:sys_collection.type.static', 'static']
|
['label' => 'LLL:EXT:legacy_collections/Resources/Private/Language/locallang_tca.xlf:sys_collection.type.static', 'value' => 'static']
|
||||||
],
|
],
|
||||||
'default' => 'static'
|
'default' => 'static'
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
return [
|
|
||||||
'TYPO3\\CMS\\Core\\Collection\\StaticRecordCollection' => \FriendsOfTYPO3\LegacyCollections\Collection\StaticRecordCollection::class,
|
|
||||||
'TYPO3\\CMS\\Core\\Collection\\RecordCollectionRepository' => \FriendsOfTYPO3\LegacyCollections\Collection\RecordCollectionRepository::class,
|
|
||||||
];
|
|
|
@ -17,6 +17,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace FriendsOfTYPO3\LegacyCollections\Tests\Functional\Collection;
|
namespace FriendsOfTYPO3\LegacyCollections\Tests\Functional\Collection;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use Doctrine\DBAL\DBALException;
|
use Doctrine\DBAL\DBALException;
|
||||||
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||||
use FriendsOfTYPO3\LegacyCollections\Collection\RecordCollectionRepository;
|
use FriendsOfTYPO3\LegacyCollections\Collection\RecordCollectionRepository;
|
||||||
|
@ -31,8 +32,12 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||||
*/
|
*/
|
||||||
class RecordCollectionRepositoryTest extends FunctionalTestCase
|
class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
protected array $testExtensionsToLoad = [
|
||||||
|
'typo3conf/ext/legacy_collections',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RecordCollectionRepository|\PHPUnit\Framework\MockObject\MockObject
|
* @var RecordCollectionRepository|MockObject
|
||||||
*/
|
*/
|
||||||
protected $subject;
|
protected $subject;
|
||||||
|
|
||||||
|
@ -49,7 +54,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->subject = $this->getMockBuilder(RecordCollectionRepository::class)
|
$this->subject = $this->getMockBuilder(RecordCollectionRepository::class)
|
||||||
->setMethods(['getEnvironmentMode'])
|
->onlyMethods(['getEnvironmentMode'])
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->testTableName = StringUtility::getUniqueId('tx_testtable');
|
$this->testTableName = StringUtility::getUniqueId('tx_testtable');
|
||||||
}
|
}
|
||||||
|
@ -66,7 +71,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByTypeReturnNull()
|
public function doesFindByTypeReturnNull(): void
|
||||||
{
|
{
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
$objects = $this->subject->findByType($type);
|
$objects = $this->subject->findByType($type);
|
||||||
|
@ -76,7 +81,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByTypeReturnObjects()
|
public function doesFindByTypeReturnObjects(): void
|
||||||
{
|
{
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
$this->insertTestData([
|
$this->insertTestData([
|
||||||
|
@ -93,7 +98,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByTableNameReturnNull()
|
public function doesFindByTableNameReturnNull(): void
|
||||||
{
|
{
|
||||||
$objects = $this->subject->findByTableName($this->testTableName);
|
$objects = $this->subject->findByTableName($this->testTableName);
|
||||||
self::assertNull($objects);
|
self::assertNull($objects);
|
||||||
|
@ -102,7 +107,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByTableNameReturnObjects()
|
public function doesFindByTableNameReturnObjects(): void
|
||||||
{
|
{
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
$this->insertTestData([
|
$this->insertTestData([
|
||||||
|
@ -119,7 +124,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByTypeAndTableNameReturnNull()
|
public function doesFindByTypeAndTableNameReturnNull(): void
|
||||||
{
|
{
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
$objects = $this->subject->findByTypeAndTableName($type, $this->testTableName);
|
$objects = $this->subject->findByTypeAndTableName($type, $this->testTableName);
|
||||||
|
@ -130,7 +135,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByTypeAndTableNameReturnObjects()
|
public function doesFindByTypeAndTableNameReturnObjects(): void
|
||||||
{
|
{
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
$this->insertTestData([
|
$this->insertTestData([
|
||||||
|
@ -147,7 +152,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByUidReturnAnObjectInBackendMode()
|
public function doesFindByUidReturnAnObjectInBackendMode(): void
|
||||||
{
|
{
|
||||||
$this->subject->method('getEnvironmentMode')->willReturn('BE');
|
$this->subject->method('getEnvironmentMode')->willReturn('BE');
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
|
@ -170,7 +175,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByUidRespectDeletedFieldInBackendMode()
|
public function doesFindByUidRespectDeletedFieldInBackendMode(): void
|
||||||
{
|
{
|
||||||
$this->subject->method('getEnvironmentMode')->willReturn('BE');
|
$this->subject->method('getEnvironmentMode')->willReturn('BE');
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
|
@ -193,7 +198,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByUidIgnoreOtherEnableFieldsInBackendMode()
|
public function doesFindByUidIgnoreOtherEnableFieldsInBackendMode(): void
|
||||||
{
|
{
|
||||||
$this->subject->method('getEnvironmentMode')->willReturn('BE');
|
$this->subject->method('getEnvironmentMode')->willReturn('BE');
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
|
@ -229,7 +234,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByUidReturnAnObjectInFrontendMode()
|
public function doesFindByUidReturnAnObjectInFrontendMode(): void
|
||||||
{
|
{
|
||||||
$this->subject->method('getEnvironmentMode')->willReturn('FE');
|
$this->subject->method('getEnvironmentMode')->willReturn('FE');
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
|
@ -252,7 +257,7 @@ class RecordCollectionRepositoryTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesFindByUidRespectEnableFieldsInFrontendMode()
|
public function doesFindByUidRespectEnableFieldsInFrontendMode(): void
|
||||||
{
|
{
|
||||||
$this->subject->method('getEnvironmentMode')->willReturn('FE');
|
$this->subject->method('getEnvironmentMode')->willReturn('FE');
|
||||||
$type = RecordCollectionRepository::TYPE_Static;
|
$type = RecordCollectionRepository::TYPE_Static;
|
||||||
|
|
3
Tests/Functional/Fixtures/BackendUser.csv
Normal file
3
Tests/Functional/Fixtures/BackendUser.csv
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
be_users
|
||||||
|
,uid,pid,username,password,admin
|
||||||
|
,1,0,admin,$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1,1,1
|
|
|
@ -18,12 +18,16 @@ declare(strict_types=1);
|
||||||
namespace FriendsOfTYPO3\LegacyCollections\Tests\Functional\Tca;
|
namespace FriendsOfTYPO3\LegacyCollections\Tests\Functional\Tca;
|
||||||
|
|
||||||
use TYPO3\CMS\Backend\Tests\Functional\Form\FormTestService;
|
use TYPO3\CMS\Backend\Tests\Functional\Form\FormTestService;
|
||||||
use TYPO3\CMS\Core\Localization\LanguageService;
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||||
|
|
||||||
class CollectionVisibleFieldsTest extends FunctionalTestCase
|
class CollectionVisibleFieldsTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
protected array $testExtensionsToLoad = [
|
||||||
|
'typo3conf/ext/legacy_collections',
|
||||||
|
];
|
||||||
|
|
||||||
protected static $collectionFields = [
|
protected static $collectionFields = [
|
||||||
'title',
|
'title',
|
||||||
'sys_language_uid',
|
'sys_language_uid',
|
||||||
|
@ -39,12 +43,13 @@ class CollectionVisibleFieldsTest extends FunctionalTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function collectionFormContainsExpectedFields()
|
public function collectionFormContainsExpectedFields(): void
|
||||||
{
|
{
|
||||||
$this->setUpBackendUserFromFixture(1);
|
$this->importCSVDataSet(__DIR__ . '/../Fixtures/BackendUser.csv');
|
||||||
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
|
$this->setUpBackendUser(1);
|
||||||
|
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->create('en_EN');
|
||||||
|
|
||||||
$formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
|
$formEngineTestService = new FormTestService();
|
||||||
$formResult = $formEngineTestService->createNewRecordForm('sys_collection');
|
$formResult = $formEngineTestService->createNewRecordForm('sys_collection');
|
||||||
|
|
||||||
foreach (static::$collectionFields as $expectedField) {
|
foreach (static::$collectionFields as $expectedField) {
|
||||||
|
|
|
@ -10,21 +10,18 @@
|
||||||
},
|
},
|
||||||
"license": ["GPL-2.0+"],
|
"license": ["GPL-2.0+"],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2 || ^8.0",
|
"php": "8.1.*",
|
||||||
"typo3/cms-core": "^10.0 || ^11.5",
|
"typo3/cms-core": "^12.4",
|
||||||
"typo3/cms-frontend": "^10.0 || ^11.5"
|
"typo3/cms-frontend": "^12.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"typo3/testing-framework": "^6.3.2"
|
"typo3/testing-framework": "^8.0"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"typo3/class-alias-loader": {
|
|
||||||
"class-alias-maps": [
|
|
||||||
"Migrations/Code/ClassAliasMap.php"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"typo3/cms": {
|
"typo3/cms": {
|
||||||
"extension-key": "legacy_collections"
|
"extension-key": "legacy_collections",
|
||||||
|
"app-dir": ".Build",
|
||||||
|
"web-dir": ".Build/Web"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -34,7 +31,17 @@
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"FriendsOfTYPO3\\LegacyCollections\\Tests\\": "Tests/"
|
"FriendsOfTYPO3\\LegacyCollections\\Tests\\": "Tests/",
|
||||||
|
"TYPO3\\CMS\\Backend\\Tests\\": "vendor/typo3/cms-backend/Tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"preferred-install": {
|
||||||
|
"typo3/cms-backend": "source"
|
||||||
|
},
|
||||||
|
"allow-plugins": {
|
||||||
|
"typo3/class-alias-loader": true,
|
||||||
|
"typo3/cms-composer-installers": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@ $EM_CONF[$_EXTKEY] = [
|
||||||
'author' => 'Benni Mack',
|
'author' => 'Benni Mack',
|
||||||
'author_email' => 'benni@typo3.org',
|
'author_email' => 'benni@typo3.org',
|
||||||
'author_company' => '',
|
'author_company' => '',
|
||||||
'version' => '1.0.1',
|
'version' => '2.0.0',
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
'depends' => [
|
'depends' => [
|
||||||
'typo3' => '10.4.0-11.5.99',
|
'typo3' => '12.4.0-12.4.99',
|
||||||
'frontend' => '10.4.0-11.5.99',
|
'frontend' => '12.4.0-12.4.99',
|
||||||
],
|
],
|
||||||
'conflicts' => [],
|
'conflicts' => [],
|
||||||
'suggests' => [],
|
'suggests' => [],
|
||||||
|
|
25
phpunit.xml.dist
Normal file
25
phpunit.xml.dist
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<phpunit
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
|
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
|
||||||
|
colors="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnError="false"
|
||||||
|
stopOnFailure="false"
|
||||||
|
stopOnIncomplete="false"
|
||||||
|
stopOnSkipped="false"
|
||||||
|
cacheDirectory=".phpunit.cache"
|
||||||
|
backupStaticProperties="false"
|
||||||
|
requireCoverageMetadata="false"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="functional">
|
||||||
|
<directory>Tests/Functional/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<php>
|
||||||
|
<env name="typo3DatabaseDriver" value="pdo_sqlite"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
Loading…
Reference in a new issue