From 8b230fa61f280979cd5b5ee88891e5f04673ab74 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 | 4 +-- 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 | 30 +++++++++---------- .../FrontEndEditorControllerTest.php | 6 ++-- Tests/Unit/Controller/TeaControllerTest.php | 4 +-- .../Domain/Model/{Product => }/TeaTest.php | 8 ++--- .../{Product => }/TeaRepositoryTest.php | 8 ++--- ext_tables.sql | 2 +- 24 files changed, 85 insertions(+), 85 deletions(-) rename Classes/Domain/Model/{Product => }/Tea.php (98%) rename Classes/Domain/Repository/{Product => }/TeaRepository.php (89%) 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 (76%) rename Tests/Unit/Domain/Model/{Product => }/TeaTest.php (92%) rename Tests/Unit/Domain/Repository/{Product => }/TeaRepositoryTest.php (79%) diff --git a/Classes/Controller/FrontEndEditorController.php b/Classes/Controller/FrontEndEditorController.php index 1e6ca691..19e0fe1f 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 ed7a1b60..46086ac8 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 9060a55a..7ce31a09 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 89% rename from Classes/Domain/Repository/Product/TeaRepository.php rename to Classes/Domain/Repository/TeaRepository.php index e2ba4b7a..ba42234a 100644 --- a/Classes/Domain/Repository/Product/TeaRepository.php +++ b/Classes/Domain/Repository/TeaRepository.php @@ -2,9 +2,9 @@ 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\Model\Tea; use TTN\Tea\Domain\Repository\Traits\StoragePageAgnosticTrait; use TYPO3\CMS\Extbase\Persistence\QueryInterface; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php index 6b92623d..6a59dd29 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 781270e5..ff1568c7 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 939220c9..6a5f576a 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 de64197f..c736204c 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 0e1f0aed..c964533e 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 be0b7d42..3448ca5a 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 6384ffe9..73b63d33 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 e185ada3..016a70f3 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 4ee751bd..5d620c5c 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 e1412064..825652ab 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 ebd1252f..eb97e897 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 7ed31542..bad7f6ca 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 4bd12522..a23174e4 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 f0c574e4..eb4163d7 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 76% rename from Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php rename to Tests/Functional/Domain/Repository/TeaRepositoryTest.php index 5643214c..3ef2f33c 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); @@ -129,7 +129,7 @@ public function addAndPersistAllCreatesNewRecord(): void $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 7871f56b..c36e65e7 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 a71c421a..ed46a8f2 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 92% rename from Tests/Unit/Domain/Model/Product/TeaTest.php rename to Tests/Unit/Domain/Model/TeaTest.php index 72e5bf86..d3956eda 100644 --- a/Tests/Unit/Domain/Model/Product/TeaTest.php +++ b/Tests/Unit/Domain/Model/TeaTest.php @@ -2,19 +2,19 @@ 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 TTN\Tea\Domain\Model\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 { 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 077917e7..0e91d33d 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 d013de39..6021d71d 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,