From eeda862e77e6847d78ae1c914736f6775bed42a1 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Tue, 16 Jan 2024 15:21:21 +0100 Subject: [PATCH] [!!!][TASK] Drop additional namespace segment for the Tea model (#1025) The `Product` namespace segment in the domain model namespace `TTN\Tea\Domain\Model` currently serves no purpose and only adds confusion. So let's simplify 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 --- CHANGELOG.md | 1 + .../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 | 4 +-- Tests/Unit/Controller/TeaControllerTest.php | 4 +-- .../Domain/Model/{Product => }/TeaTest.php | 8 ++--- .../{Product => }/TeaRepositoryTest.php | 6 ++-- ext_tables.sql | 2 +- 25 files changed, 84 insertions(+), 83 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 (84%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a44cd..c6f5ac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Added ### Changed +- Drop additional namespace segment for the Tea model (#1025) ### Deprecated diff --git a/Classes/Controller/FrontEndEditorController.php b/Classes/Controller/FrontEndEditorController.php index 1e6ca69..19e0fe1 100644 --- a/Classes/Controller/FrontEndEditorController.php +++ b/Classes/Controller/FrontEndEditorController.php @@ -5,8 +5,8 @@ declare(strict_types=1); 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 ed7a1b6..46086ac 100644 --- a/Classes/Controller/TeaController.php +++ b/Classes/Controller/TeaController.php @@ -5,8 +5,8 @@ declare(strict_types=1); 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 9060a55..7ce31a0 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 e2ba4b7..ba42234 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 6b92623..6a59dd2 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 781270e..ff1568c 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 @@ $tca = [ '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 @@ $tca = [ '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 @@ $tca = [ '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 @@ $tca = [ '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 @@ $tca = [ ], ], '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 @@ $tca = [ ], ], '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 @@ $tca = [ ], ], '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 @@ $tca = [ '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 @@ $tca = [ '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 @@ if ($typo3Version->getMajorVersion() < 12) { ], ]; $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 @@ if ($typo3Version->getMajorVersion() < 12) { ]; $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 939220c..6a5f576 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 de64197..c736204 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 0e1f0ae..c964533 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 be0b7d4..3448ca5 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 6384ffe..73b63d3 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 e185ada..016a70f 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 4ee751b..5d620c5 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 e141206..825652a 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 ebd1252..eb97e89 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 7ed3154..bad7f6c 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 4bd1252..a23174e 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 f0c574e..eb4163d 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 5643214..3ef2f33 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase $this->subject->add($model); $this->persistenceManager->persistAll(); - $this->assertCSVDataSet(__DIR__ . '/../Fixtures/Product/PersistedTea.csv'); + $this->assertCSVDataSet(__DIR__ . '/Fixtures/PersistedTea.csv'); } /** @@ -137,7 +137,7 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 @@ final class TeaRepositoryTest extends FunctionalTestCase */ 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 7871f56..45c7737 100644 --- a/Tests/Unit/Controller/FrontEndEditorControllerTest.php +++ b/Tests/Unit/Controller/FrontEndEditorControllerTest.php @@ -6,8 +6,8 @@ namespace TTN\Tea\Tests\Unit\Controller; 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; diff --git a/Tests/Unit/Controller/TeaControllerTest.php b/Tests/Unit/Controller/TeaControllerTest.php index a71c421..ed46a8f 100644 --- a/Tests/Unit/Controller/TeaControllerTest.php +++ b/Tests/Unit/Controller/TeaControllerTest.php @@ -6,8 +6,8 @@ namespace TTN\Tea\Tests\Unit\Controller; 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 72e5bf8..d3956ed 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 84% rename from Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php rename to Tests/Unit/Domain/Repository/TeaRepositoryTest.php index 077917e..c7e9e8b 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 { diff --git a/ext_tables.sql b/ext_tables.sql index d013de3..6021d71 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,