From aae435a62208a8ad43ee8f557f0b9a0c80c628da Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 27 Nov 2023 15:47:28 +0100 Subject: [PATCH] [!!!][TASK] Drop additional namespace segment for the Tea model The `Product` namespace segment in the domain model namespace `TTN\Tea\Domain\Model` currently serves no purpose and only adds confusion. So let's simply the extension structure accordingly. (I intended to use this to demonstrate DDD contexts, but never built enough models in the Tea extension for this to actually make sense.) Fixes #1008 --- .../Controller/FrontEndEditorController.php | 4 +-- Classes/Controller/TeaController.php | 4 +-- Classes/Domain/Model/{Product => }/Tea.php | 2 +- .../{Product => }/TeaRepository.php | 5 ++- Configuration/Extbase/Persistence/Classes.php | 2 +- ...ct_tea.php => tx_tea_domain_model_tea.php} | 30 ++++++++--------- .../Private/Language/de.locallang_db.xlf | 16 +++++----- Resources/Private/Language/locallang_db.xlf | 16 +++++----- .../Private/Language/pl.locallang_db.xlf | 14 ++++---- .../Controller/Fixtures/Database/Teas.csv | 2 +- .../Fixtures/{Product => }/PersistedTea.csv | 2 +- .../Fixtures/{Product => }/TeaOnPage.csv | 2 +- .../{Product => }/TeaWithAllScalarData.csv | 2 +- .../Fixtures/{Product => }/TeaWithImage.csv | 4 +-- .../Fixtures/{Product => }/TeaWithOwner.csv | 2 +- .../{Product => }/TeaWithoutOwner.csv | 2 +- .../{Product => }/TwoTeasWithOwner.csv | 2 +- .../{Product => }/TwoUnsortedTeas.csv | 2 +- .../{Product => }/TeaRepositoryTest.php | 32 +++++++++---------- .../FrontEndEditorControllerTest.php | 6 ++-- Tests/Unit/Controller/TeaControllerTest.php | 4 +-- .../Domain/Model/{Product => }/TeaTest.php | 9 +++--- .../{Product => }/TeaRepositoryTest.php | 8 ++--- ext_tables.sql | 2 +- 24 files changed, 86 insertions(+), 88 deletions(-) rename Classes/Domain/Model/{Product => }/Tea.php (98%) rename Classes/Domain/Repository/{Product => }/TeaRepository.php (86%) rename Configuration/TCA/{tx_tea_domain_model_product_tea.php => tx_tea_domain_model_tea.php} (90%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/PersistedTea.csv (54%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TeaOnPage.csv (52%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TeaWithAllScalarData.csv (69%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TeaWithImage.csv (59%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TeaWithOwner.csv (60%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TeaWithoutOwner.csv (58%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TwoTeasWithOwner.csv (64%) rename Tests/Functional/Domain/Repository/Fixtures/{Product => }/TwoUnsortedTeas.csv (60%) rename Tests/Functional/Domain/Repository/{Product => }/TeaRepositoryTest.php (75%) rename Tests/Unit/Domain/Model/{Product => }/TeaTest.php (91%) rename Tests/Unit/Domain/Repository/{Product => }/TeaRepositoryTest.php (79%) diff --git a/Classes/Controller/FrontEndEditorController.php b/Classes/Controller/FrontEndEditorController.php index 1e6ca691e..19e0fe1ff 100644 --- a/Classes/Controller/FrontEndEditorController.php +++ b/Classes/Controller/FrontEndEditorController.php @@ -5,8 +5,8 @@ namespace TTN\Tea\Controller; use Psr\Http\Message\ResponseInterface; -use TTN\Tea\Domain\Model\Product\Tea; -use TTN\Tea\Domain\Repository\Product\TeaRepository; +use TTN\Tea\Domain\Model\Tea; +use TTN\Tea\Domain\Repository\TeaRepository; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation as Extbase; diff --git a/Classes/Controller/TeaController.php b/Classes/Controller/TeaController.php index ed7a1b60c..46086ac80 100644 --- a/Classes/Controller/TeaController.php +++ b/Classes/Controller/TeaController.php @@ -5,8 +5,8 @@ namespace TTN\Tea\Controller; use Psr\Http\Message\ResponseInterface; -use TTN\Tea\Domain\Model\Product\Tea; -use TTN\Tea\Domain\Repository\Product\TeaRepository; +use TTN\Tea\Domain\Model\Tea; +use TTN\Tea\Domain\Repository\TeaRepository; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; /** diff --git a/Classes/Domain/Model/Product/Tea.php b/Classes/Domain/Model/Tea.php similarity index 98% rename from Classes/Domain/Model/Product/Tea.php rename to Classes/Domain/Model/Tea.php index 9060a55a2..7ce31a09b 100644 --- a/Classes/Domain/Model/Product/Tea.php +++ b/Classes/Domain/Model/Tea.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace TTN\Tea\Domain\Model\Product; +namespace TTN\Tea\Domain\Model; use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Domain\Model\FileReference; diff --git a/Classes/Domain/Repository/Product/TeaRepository.php b/Classes/Domain/Repository/TeaRepository.php similarity index 86% rename from Classes/Domain/Repository/Product/TeaRepository.php rename to Classes/Domain/Repository/TeaRepository.php index e2ba4b7af..3daf34bf0 100644 --- a/Classes/Domain/Repository/Product/TeaRepository.php +++ b/Classes/Domain/Repository/TeaRepository.php @@ -2,16 +2,15 @@ declare(strict_types=1); -namespace TTN\Tea\Domain\Repository\Product; +namespace TTN\Tea\Domain\Repository; -use TTN\Tea\Domain\Model\Product\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; /** - * @extends Repository + * @extends Repository<\TTN\Tea\Domain\Model\Tea> */ class TeaRepository extends Repository { diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php index 6b92623d0..6a59dd293 100644 --- a/Configuration/Extbase/Persistence/Classes.php +++ b/Configuration/Extbase/Persistence/Classes.php @@ -3,7 +3,7 @@ declare(strict_types=1); return [ - \TTN\Tea\Domain\Model\Product\Tea::class => [ + \TTN\Tea\Domain\Model\Tea::class => [ 'properties' => [ 'ownerUid' => ['fieldName' => 'owner'], ], diff --git a/Configuration/TCA/tx_tea_domain_model_product_tea.php b/Configuration/TCA/tx_tea_domain_model_tea.php similarity index 90% rename from Configuration/TCA/tx_tea_domain_model_product_tea.php rename to Configuration/TCA/tx_tea_domain_model_tea.php index 781270e57..ff1568c79 100644 --- a/Configuration/TCA/tx_tea_domain_model_product_tea.php +++ b/Configuration/TCA/tx_tea_domain_model_tea.php @@ -2,7 +2,7 @@ $tca = [ 'ctrl' => [ - 'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea', + 'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', @@ -26,7 +26,7 @@ 'showitem' => '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, title, description, image, owner, - --div--;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.tabs.access, + --div--;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.tabs.access, --palette--;;hidden, --palette--;;access,', ], @@ -34,11 +34,11 @@ 'palettes' => [ 'hidden' => [ 'showitem' => ' - hidden;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.hidden + hidden;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.hidden ', ], 'access' => [ - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.palettes.access', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.palettes.access', 'showitem' => ' starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel, @@ -50,7 +50,7 @@ 'columns' => [ 'hidden' => [ 'exclude' => true, - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.hidden', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.hidden', 'config' => [ 'type' => 'check', 'renderType' => 'checkboxToggle', @@ -107,10 +107,10 @@ 'value' => 0, ], ], - 'foreign_table' => 'tx_tea_domain_model_product_tea', + 'foreign_table' => 'tx_tea_domain_model_tea', 'foreign_table_where' => - 'AND {#tx_tea_domain_model_product_tea}.{#pid}=###CURRENT_PID### - AND {#tx_tea_domain_model_product_tea}.{#sys_language_uid} IN (-1,0)', + 'AND {#tx_tea_domain_model_tea}.{#pid}=###CURRENT_PID### + AND {#tx_tea_domain_model_tea}.{#sys_language_uid} IN (-1,0)', 'default' => 0, ], ], @@ -126,7 +126,7 @@ ], ], 'title' => [ - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.title', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.title', 'config' => [ 'type' => 'input', 'size' => 40, @@ -136,7 +136,7 @@ ], ], 'description' => [ - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.description', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.description', 'config' => [ 'type' => 'text', 'enableRichtext' => true, @@ -147,7 +147,7 @@ ], ], 'image' => [ - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.image', 'config' => [ 'type' => 'file', 'maxitems' => 1, @@ -164,7 +164,7 @@ 'fe_group' => [ 'exclude' => true, 'l10n_mode' => 'exclude', - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.fe_group', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.fe_group', 'config' => [ 'type' => 'select', 'renderType' => 'selectMultipleSideBySide', @@ -191,7 +191,7 @@ 'owner' => [ 'exclude' => true, 'l10n_mode' => 'exclude', - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.owner', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.owner', 'config' => [ 'type' => 'group', 'allowed' => 'fe_users', @@ -231,7 +231,7 @@ ], ]; $tca['columns']['image'] = [ - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.image', 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 'image', [ @@ -248,7 +248,7 @@ ]; $tca['columns']['hidden']['config'] = [ 'type' => 'check', - 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.hidden', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.hidden', 'items' => [ [ 0 => '', diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 939220c99..6a5f576a2 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -3,35 +3,35 @@
- + Tea Tee - + Access Zugriff - + Title Titel - + Description Beschreibung - + Image Bild - + Website user who created this record Website-Benutzer, der diesen Datensatz erstellt hat - + Usergroup Access Rights Zugriffsrechte für Benutzergruppen - + Visible Sichtbar diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index de64197f6..c736204c8 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -3,28 +3,28 @@
- + Tea - + Access - + Title - + Description - + Image - + Website user who created this record - + Usergroup Access Rights - + Visible diff --git a/Resources/Private/Language/pl.locallang_db.xlf b/Resources/Private/Language/pl.locallang_db.xlf index 0e1f0aed0..c964533ea 100644 --- a/Resources/Private/Language/pl.locallang_db.xlf +++ b/Resources/Private/Language/pl.locallang_db.xlf @@ -3,31 +3,31 @@
- + Tea Herbata - + Access Dostęp - + Title Tytuł - + Description Opis - + Image Obraz - + Website user who created this record Użytkownik strony, który utworzył ten rekord - + Usergroup Access Rights Prawa dostępu grupy użytkowników diff --git a/Tests/Functional/Controller/Fixtures/Database/Teas.csv b/Tests/Functional/Controller/Fixtures/Database/Teas.csv index be0b7d424..3448ca5a7 100644 --- a/Tests/Functional/Controller/Fixtures/Database/Teas.csv +++ b/Tests/Functional/Controller/Fixtures/Database/Teas.csv @@ -1,4 +1,4 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title" ,1,2,"Godesberger Burgtee" ,2,2,"Oolong" diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/PersistedTea.csv b/Tests/Functional/Domain/Repository/Fixtures/PersistedTea.csv similarity index 54% rename from Tests/Functional/Domain/Repository/Fixtures/Product/PersistedTea.csv rename to Tests/Functional/Domain/Repository/Fixtures/PersistedTea.csv index 6384ffe9c..73b63d337 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/PersistedTea.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/PersistedTea.csv @@ -1,3 +1,3 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","title" ,1,"Godesberger Burgtee" diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaOnPage.csv b/Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv similarity index 52% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TeaOnPage.csv rename to Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv index e185ada33..016a70f33 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaOnPage.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TeaOnPage.csv @@ -1,3 +1,3 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title" ,1,1,"Earl Grey" diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithAllScalarData.csv b/Tests/Functional/Domain/Repository/Fixtures/TeaWithAllScalarData.csv similarity index 69% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithAllScalarData.csv rename to Tests/Functional/Domain/Repository/Fixtures/TeaWithAllScalarData.csv index 4ee751bdb..5d620c5c9 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithAllScalarData.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TeaWithAllScalarData.csv @@ -1,3 +1,3 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title","description","owner" ,1,1,"Earl Grey","Fresh and hot.",2 diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithImage.csv b/Tests/Functional/Domain/Repository/Fixtures/TeaWithImage.csv similarity index 59% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithImage.csv rename to Tests/Functional/Domain/Repository/Fixtures/TeaWithImage.csv index e1412064d..825652ab1 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithImage.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TeaWithImage.csv @@ -1,7 +1,7 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title","image", ,1,1,"Gunpowder",1 "sys_file_reference" ,"uid","uid_foreign","tablenames","fieldname" -,1,1,"tx_tea_domain_model_product_tea","image" +,1,1,"tx_tea_domain_model_tea","image" diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithOwner.csv b/Tests/Functional/Domain/Repository/Fixtures/TeaWithOwner.csv similarity index 60% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithOwner.csv rename to Tests/Functional/Domain/Repository/Fixtures/TeaWithOwner.csv index ebd1252fd..eb97e8971 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithOwner.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TeaWithOwner.csv @@ -1,3 +1,3 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title","owner" ,"1","1","Earl Grey",1 diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithoutOwner.csv b/Tests/Functional/Domain/Repository/Fixtures/TeaWithoutOwner.csv similarity index 58% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithoutOwner.csv rename to Tests/Functional/Domain/Repository/Fixtures/TeaWithoutOwner.csv index 7ed315428..bad7f6cab 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TeaWithoutOwner.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TeaWithoutOwner.csv @@ -1,3 +1,3 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title","owner" ,1,1,"Earl Grey",0 diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TwoTeasWithOwner.csv b/Tests/Functional/Domain/Repository/Fixtures/TwoTeasWithOwner.csv similarity index 64% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TwoTeasWithOwner.csv rename to Tests/Functional/Domain/Repository/Fixtures/TwoTeasWithOwner.csv index 4bd125221..a23174e40 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TwoTeasWithOwner.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TwoTeasWithOwner.csv @@ -1,4 +1,4 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title","owner" ,1,1,"Earl Grey",1 ,2,1,"Assam",1 diff --git a/Tests/Functional/Domain/Repository/Fixtures/Product/TwoUnsortedTeas.csv b/Tests/Functional/Domain/Repository/Fixtures/TwoUnsortedTeas.csv similarity index 60% rename from Tests/Functional/Domain/Repository/Fixtures/Product/TwoUnsortedTeas.csv rename to Tests/Functional/Domain/Repository/Fixtures/TwoUnsortedTeas.csv index f0c574e41..eb4163d70 100644 --- a/Tests/Functional/Domain/Repository/Fixtures/Product/TwoUnsortedTeas.csv +++ b/Tests/Functional/Domain/Repository/Fixtures/TwoUnsortedTeas.csv @@ -1,4 +1,4 @@ -"tx_tea_domain_model_product_tea" +"tx_tea_domain_model_tea" ,"uid","pid","title" ,1,1,"Earl Grey" ,2,1,"Assam" diff --git a/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php b/Tests/Functional/Domain/Repository/TeaRepositoryTest.php similarity index 75% rename from Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php rename to Tests/Functional/Domain/Repository/TeaRepositoryTest.php index 5643214c9..e0a43631a 100644 --- a/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/TeaRepositoryTest.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace TTN\Tea\Tests\Functional\Domain\Repository\Product; +namespace TTN\Tea\Tests\Functional\Domain\Repository; -use TTN\Tea\Domain\Model\Product\Tea; -use TTN\Tea\Domain\Repository\Product\TeaRepository; +use TTN\Tea\Domain\Model\Tea; +use TTN\Tea\Domain\Repository\TeaRepository; use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; /** - * @covers \TTN\Tea\Domain\Repository\Product\TeaRepository - * @covers \TTN\Tea\Domain\Model\Product\Tea + * @covers \TTN\Tea\Domain\Repository\TeaRepository + * @covers \TTN\Tea\Domain\Model\Tea */ final class TeaRepositoryTest extends FunctionalTestCase { @@ -46,7 +46,7 @@ public function findAllForNoRecordsReturnsEmptyContainer(): void */ public function findAllWithRecordsFindsRecordsFromAllPages(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaOnPage.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaOnPage.csv'); $result = $this->subject->findAll(); @@ -58,7 +58,7 @@ public function findAllWithRecordsFindsRecordsFromAllPages(): void */ public function findAllSortsByTitleInAscendingOrder(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TwoUnsortedTeas.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TwoUnsortedTeas.csv'); $result = $this->subject->findAll(); @@ -81,7 +81,7 @@ public function findByUidForInexistentRecordReturnsNull(): void */ public function findByUidForExistingRecordReturnsModel(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithAllScalarData.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithAllScalarData.csv'); $model = $this->subject->findByUid(1); @@ -93,7 +93,7 @@ public function findByUidForExistingRecordReturnsModel(): void */ public function findByUidForExistingRecordMapsAllScalarData(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithAllScalarData.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithAllScalarData.csv'); $model = $this->subject->findByUid(1); self::assertInstanceOf(Tea::class, $model); @@ -108,7 +108,7 @@ public function findByUidForExistingRecordMapsAllScalarData(): void */ public function fillsImageRelation(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithImage.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithImage.csv'); $model = $this->subject->findByUid(1); @@ -123,13 +123,13 @@ public function fillsImageRelation(): void public function addAndPersistAllCreatesNewRecord(): void { $title = 'Godesberger Burgtee'; - $model = new Tea(); + $model = new \TTN\Tea\Domain\Model\Tea(); $model->setTitle($title); $this->subject->add($model); $this->persistenceManager->persistAll(); - $this->assertCSVDataSet(__DIR__ . '/../Fixtures/Product/PersistedTea.csv'); + $this->assertCSVDataSet(__DIR__ . '/Fixtures/PersistedTea.csv'); } /** @@ -137,7 +137,7 @@ public function addAndPersistAllCreatesNewRecord(): void */ public function findByOwnerUidFindsTeaWithTheGivenOwnerUid(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithOwner.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithOwner.csv'); $result = $this->subject->findByOwnerUid(1); @@ -149,7 +149,7 @@ public function findByOwnerUidFindsTeaWithTheGivenOwnerUid(): void */ public function findByOwnerUidFindsIgnoresTeaWithNonMatchingOwnerUid(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithOwner.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithOwner.csv'); $result = $this->subject->findByOwnerUid(2); @@ -161,7 +161,7 @@ public function findByOwnerUidFindsIgnoresTeaWithNonMatchingOwnerUid(): void */ public function findByOwnerUidFindsIgnoresTeaWithZeroOwnerUid(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithoutOwner.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithoutOwner.csv'); $result = $this->subject->findByOwnerUid(1); @@ -173,7 +173,7 @@ public function findByOwnerUidFindsIgnoresTeaWithZeroOwnerUid(): void */ public function findByOwnerUidSortsByTitleInAscendingOrder(): void { - $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TwoTeasWithOwner.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/TwoTeasWithOwner.csv'); $result = $this->subject->findByOwnerUid(1); diff --git a/Tests/Unit/Controller/FrontEndEditorControllerTest.php b/Tests/Unit/Controller/FrontEndEditorControllerTest.php index 7871f56b7..c36e65e74 100644 --- a/Tests/Unit/Controller/FrontEndEditorControllerTest.php +++ b/Tests/Unit/Controller/FrontEndEditorControllerTest.php @@ -6,8 +6,8 @@ use PHPUnit\Framework\MockObject\MockObject; use TTN\Tea\Controller\FrontEndEditorController; -use TTN\Tea\Domain\Model\Product\Tea; -use TTN\Tea\Domain\Repository\Product\TeaRepository; +use TTN\Tea\Domain\Model\Tea; +use TTN\Tea\Domain\Repository\TeaRepository; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\UserAspect; use TYPO3\CMS\Core\Http\HtmlResponse; @@ -39,7 +39,7 @@ final class FrontEndEditorControllerTest extends UnitTestCase private Context $context; /** - * @var TeaRepository&MockObject + * @var \TTN\Tea\Domain\Repository\TeaRepository&MockObject */ private TeaRepository $teaRepositoryMock; diff --git a/Tests/Unit/Controller/TeaControllerTest.php b/Tests/Unit/Controller/TeaControllerTest.php index a71c421a9..ed46a8f24 100644 --- a/Tests/Unit/Controller/TeaControllerTest.php +++ b/Tests/Unit/Controller/TeaControllerTest.php @@ -6,8 +6,8 @@ use PHPUnit\Framework\MockObject\MockObject; use TTN\Tea\Controller\TeaController; -use TTN\Tea\Domain\Model\Product\Tea; -use TTN\Tea\Domain\Repository\Product\TeaRepository; +use TTN\Tea\Domain\Model\Tea; +use TTN\Tea\Domain\Repository\TeaRepository; use TYPO3\CMS\Core\Http\HtmlResponse; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; diff --git a/Tests/Unit/Domain/Model/Product/TeaTest.php b/Tests/Unit/Domain/Model/TeaTest.php similarity index 91% rename from Tests/Unit/Domain/Model/Product/TeaTest.php rename to Tests/Unit/Domain/Model/TeaTest.php index 72e5bf867..2cdddc283 100644 --- a/Tests/Unit/Domain/Model/Product/TeaTest.php +++ b/Tests/Unit/Domain/Model/TeaTest.php @@ -2,25 +2,24 @@ declare(strict_types=1); -namespace TTN\Tea\Tests\Unit\Domain\Model\Product; +namespace TTN\Tea\Tests\Unit\Domain\Model; -use TTN\Tea\Domain\Model\Product\Tea; use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** - * @covers \TTN\Tea\Domain\Model\Product\Tea + * @covers \TTN\Tea\Domain\Model\Tea */ final class TeaTest extends UnitTestCase { - private Tea $subject; + private \TTN\Tea\Domain\Model\Tea $subject; protected function setUp(): void { parent::setUp(); - $this->subject = new Tea(); + $this->subject = new \TTN\Tea\Domain\Model\Tea(); } /** diff --git a/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php b/Tests/Unit/Domain/Repository/TeaRepositoryTest.php similarity index 79% rename from Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php rename to Tests/Unit/Domain/Repository/TeaRepositoryTest.php index 077917e78..0e91d33df 100644 --- a/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/TeaRepositoryTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace TTN\Tea\Tests\Unit\Domain\Repository\Product; +namespace TTN\Tea\Tests\Unit\Domain\Repository; -use TTN\Tea\Domain\Repository\Product\TeaRepository; +use TTN\Tea\Domain\Repository\TeaRepository; use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; use TYPO3\CMS\Extbase\Persistence\Repository; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** - * @covers \TTN\Tea\Domain\Repository\Product\TeaRepository + * @covers \TTN\Tea\Domain\Repository\TeaRepository */ final class TeaRepositoryTest extends UnitTestCase { @@ -25,7 +25,7 @@ protected function setUp(): void // @phpstan-ignore-next-line This line is 11LTS-specific, but we're running PHPStan on TYPO3 12. $this->subject = new TeaRepository($objectManagerStub); } else { - $this->subject = new TeaRepository(); + $this->subject = new \TTN\Tea\Domain\Repository\TeaRepository(); } } diff --git a/ext_tables.sql b/ext_tables.sql index d013de392..6021d71d7 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -1,4 +1,4 @@ -CREATE TABLE tx_tea_domain_model_product_tea ( +CREATE TABLE tx_tea_domain_model_tea ( title varchar(255) DEFAULT '' NOT NULL, description varchar(2000) DEFAULT '' NOT NULL, image int(11) unsigned DEFAULT '0' NOT NULL,