From 248c7592065fa5a6df0cffee6a3f0b197f256abf Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 15 Apr 2024 11:13:57 +0200 Subject: [PATCH] [TASK][!!!] Require a storage PID for the tea list (#1223) Fixes #1024 Supersedes #1024 --- CHANGELOG.md | 1 + Classes/Domain/Repository/TeaRepository.php | 4 +--- .../Traits/StoragePageAgnosticTrait.php | 21 ------------------- .../Constants/PluginConfiguration.typoscript | 5 +++++ .../Controller/TeaControllerTest.php | 1 + .../Domain/Repository/Fixtures/TeaOnPage.csv | 3 --- .../Domain/Repository/TeaRepositoryTest.php | 12 ----------- 7 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php create mode 100644 Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript delete mode 100644 Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv diff --git a/CHANGELOG.md b/CHANGELOG.md index e267658..e0aa5ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Added ### Changed +- !!! Require a storage PID for the tea list (#1223) - Drop additional namespace segment for the Tea model (#1025) ### Deprecated diff --git a/Classes/Domain/Repository/TeaRepository.php b/Classes/Domain/Repository/TeaRepository.php index ba42234..f3dca4c 100644 --- a/Classes/Domain/Repository/TeaRepository.php +++ b/Classes/Domain/Repository/TeaRepository.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace TTN\Tea\Domain\Repository; use TTN\Tea\Domain\Model\Tea; -use TTN\Tea\Domain\Repository\Traits\StoragePageAgnosticTrait; use TYPO3\CMS\Extbase\Persistence\QueryInterface; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; use TYPO3\CMS\Extbase\Persistence\Repository; @@ -15,8 +14,6 @@ use TYPO3\CMS\Extbase\Persistence\Repository; */ class TeaRepository extends Repository { - use StoragePageAgnosticTrait; - protected $defaultOrderings = ['title' => QueryInterface::ORDER_ASCENDING]; /** @@ -25,6 +22,7 @@ class TeaRepository extends Repository public function findByOwnerUid(int $ownerUid): QueryResultInterface { $query = $this->createQuery(); + $query->setQuerySettings($query->getQuerySettings()->setRespectStoragePage(false)); $query->matching($query->equals('ownerUid', $ownerUid)); return $query->execute(); diff --git a/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php b/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php deleted file mode 100644 index 70a049a..0000000 --- a/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php +++ /dev/null @@ -1,21 +0,0 @@ -setRespectStoragePage(false); - $this->setDefaultQuerySettings($querySettings); - } -} diff --git a/Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript b/Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript new file mode 100644 index 0000000..e27e12d --- /dev/null +++ b/Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript @@ -0,0 +1,5 @@ +plugin.tx_tea { + persistence { + storagePid = 2 + } +} diff --git a/Tests/Functional/Controller/TeaControllerTest.php b/Tests/Functional/Controller/TeaControllerTest.php index d12d8d7..b0a8ec8 100644 --- a/Tests/Functional/Controller/TeaControllerTest.php +++ b/Tests/Functional/Controller/TeaControllerTest.php @@ -29,6 +29,7 @@ final class TeaControllerTest extends FunctionalTestCase 'constants' => [ 'EXT:fluid_styled_content/Configuration/TypoScript/constants.typoscript', 'EXT:tea/Configuration/TypoScript/constants.typoscript', + 'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript', ], 'setup' => [ 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript', diff --git a/Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv b/Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv deleted file mode 100644 index 016a70f..0000000 --- a/Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv +++ /dev/null @@ -1,3 +0,0 @@ -"tx_tea_domain_model_tea" -,"uid","pid","title" -,1,1,"Earl Grey" diff --git a/Tests/Functional/Domain/Repository/TeaRepositoryTest.php b/Tests/Functional/Domain/Repository/TeaRepositoryTest.php index f6aa642..d4a907b 100644 --- a/Tests/Functional/Domain/Repository/TeaRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/TeaRepositoryTest.php @@ -41,18 +41,6 @@ final class TeaRepositoryTest extends FunctionalTestCase self::assertCount(0, $result); } - /** - * @test - */ - public function findAllWithRecordsFindsRecordsFromAllPages(): void - { - $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaOnPage.csv'); - - $result = $this->subject->findAll(); - - self::assertCount(1, $result); - } - /** * @test */