diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 2a0a67c..189cfd8 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -9,9 +9,6 @@ services: exclude: - '../Classes/Domain/Model/*' - WerkraumMedia\Watchlist\Domain\Items\Page\ItemHandler: - tags: ['watchlist.itemHandler'] - WerkraumMedia\Watchlist\Session\CookieSessionService: # Has state and needs to be shared in order to provide this state to middleware shared: true diff --git a/README.rst b/README.rst index d75ca09..d144e6c 100644 --- a/README.rst +++ b/README.rst @@ -42,18 +42,9 @@ The class needs to implement the ``WerkraumMedia\Watchlist\Domain\ItemHandlerInt The purpose is to convert an identifier of that item to an actual instance of that item. The Handler needs to be registered via Symfony Tags, e.g. via ``Services.yaml``: -.. code:: yam; +.. code:: yaml - services: - _defaults: - autowire: true - autoconfigure: true - public: false - - WerkraumMedia\Watchlist\: - resource: '../Classes/*' - - WerkraumMedia\Watchlist\Domain\Items\Page\ItemHandler: + WerkraumMedia\WatchlistExample\PageItem\ItemHandler: tags: ['watchlist.itemHandler'] ``Item`` @@ -66,9 +57,11 @@ Example The extension delivers an example implementation for testing purposes, check out: -- ``Classes/Domain/Items/Page/ItemHandler.php`` +- ``Tests/Fixtures/WatchlistExample/Classes/Domain/Items/Page/ItemHandler.php`` -- ``Classes/Domain/Items/Page/Page.php`` +- ``Tests/Fixtures/WatchlistExample/Classes/Domain/Items/Page/Page.php`` + +- ``Tests/Fixtures/WatchlistExample/Configuration/Services.yaml`` The example demonstrates how to fetch information from database, including file references. diff --git a/Tests/Acceptance/Support/Environment.php b/Tests/Acceptance/Support/Environment.php index 65abb36..ca554ca 100644 --- a/Tests/Acceptance/Support/Environment.php +++ b/Tests/Acceptance/Support/Environment.php @@ -47,6 +47,7 @@ class Environment extends BackendEnvironment ], 'testExtensionsToLoad' => [ 'typo3conf/ext/watchlist', + 'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example', ], 'csvDatabaseFixtures' => [ __DIR__ . '/../../Fixtures/BasicDatabase.csv', diff --git a/Classes/Domain/Items/Page/ItemHandler.php b/Tests/Fixtures/watchlist_example/Classes/ItemHandler.php similarity index 97% rename from Classes/Domain/Items/Page/ItemHandler.php rename to Tests/Fixtures/watchlist_example/Classes/ItemHandler.php index 9cd00b2..3137a20 100644 --- a/Classes/Domain/Items/Page/ItemHandler.php +++ b/Tests/Fixtures/watchlist_example/Classes/ItemHandler.php @@ -21,7 +21,7 @@ declare(strict_types=1); * 02110-1301, USA. */ -namespace WerkraumMedia\Watchlist\Domain\Items\Page; +namespace WerkraumMedia\WatchlistExample; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Resource\FileReference; diff --git a/Classes/Domain/Items/Page/Page.php b/Tests/Fixtures/watchlist_example/Classes/Page.php similarity index 96% rename from Classes/Domain/Items/Page/Page.php rename to Tests/Fixtures/watchlist_example/Classes/Page.php index 1415875..7a90385 100644 --- a/Classes/Domain/Items/Page/Page.php +++ b/Tests/Fixtures/watchlist_example/Classes/Page.php @@ -21,7 +21,7 @@ declare(strict_types=1); * 02110-1301, USA. */ -namespace WerkraumMedia\Watchlist\Domain\Items\Page; +namespace WerkraumMedia\WatchlistExample; use TYPO3\CMS\Core\Resource\FileInterface; use WerkraumMedia\Watchlist\Domain\Model\Item; diff --git a/Tests/Fixtures/watchlist_example/Configuration/Services.yaml b/Tests/Fixtures/watchlist_example/Configuration/Services.yaml new file mode 100644 index 0000000..a2ca427 --- /dev/null +++ b/Tests/Fixtures/watchlist_example/Configuration/Services.yaml @@ -0,0 +1,11 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + WerkraumMedia\WatchlistExample\: + resource: '../Classes/*' + + WerkraumMedia\WatchlistExample\ItemHandler: + tags: ['watchlist.itemHandler'] diff --git a/Tests/Fixtures/watchlist_example/composer.json b/Tests/Fixtures/watchlist_example/composer.json new file mode 100644 index 0000000..18f5357 --- /dev/null +++ b/Tests/Fixtures/watchlist_example/composer.json @@ -0,0 +1,14 @@ +{ + "name": "werkraummedia/watchlist_example", + "description": "Add a watchlist to frontend of TYPO3", + "type": "typo3-cms-extension", + "license": "GPL-2.0-or-later", + "require": { + "werkraummedia/watchlist": "*" + }, + "extra": { + "typo3/cms": { + "extension-key": "watchlist_example" + } + } +} diff --git a/Tests/Functional/BasicsTest.php b/Tests/Functional/BasicsTest.php index 5364219..fc9ba14 100644 --- a/Tests/Functional/BasicsTest.php +++ b/Tests/Functional/BasicsTest.php @@ -39,6 +39,7 @@ class BasicsTest extends FunctionalTestCase protected $testExtensionsToLoad = [ 'typo3conf/ext/watchlist', + 'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example', ]; protected $pathsToLinkInTestInstance = [ diff --git a/Tests/Unit/Domain/Model/WatchlistTest.php b/Tests/Unit/Domain/Model/WatchlistTest.php index a38b6a6..8047465 100644 --- a/Tests/Unit/Domain/Model/WatchlistTest.php +++ b/Tests/Unit/Domain/Model/WatchlistTest.php @@ -24,8 +24,8 @@ declare(strict_types=1); namespace WerkraumMedia\Watchlist\Tests\Unit\Domain\Model; use PHPUnit\Framework\TestCase; -use WerkraumMedia\Watchlist\Domain\Items\Page\Page; use WerkraumMedia\Watchlist\Domain\Model\Watchlist; +use WerkraumMedia\WatchlistExample\Page; /** * @covers \WerkraumMedia\Watchlist\Domain\Model\Watchlist diff --git a/composer.json b/composer.json index e8aa6bb..e9fad40 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ }, "autoload-dev": { "psr-4": { - "WerkraumMedia\\Watchlist\\Tests\\": "Tests/" + "WerkraumMedia\\Watchlist\\Tests\\": "Tests/", + "WerkraumMedia\\WatchlistExample\\": "Tests/Fixtures/watchlist_example/Classes/" } }, "require": {