Move example code to example fixture extension (#4)

This commit is contained in:
Daniel Siepmann 2022-09-28 13:51:34 +02:00 committed by GitHub
parent 85b132e759
commit 64c230589f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 20 deletions

View file

@ -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

View file

@ -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.

View file

@ -47,6 +47,7 @@ class Environment extends BackendEnvironment
],
'testExtensionsToLoad' => [
'typo3conf/ext/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
],
'csvDatabaseFixtures' => [
__DIR__ . '/../../Fixtures/BasicDatabase.csv',

View file

@ -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;

View file

@ -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;

View file

@ -0,0 +1,11 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false
WerkraumMedia\WatchlistExample\:
resource: '../Classes/*'
WerkraumMedia\WatchlistExample\ItemHandler:
tags: ['watchlist.itemHandler']

View file

@ -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"
}
}
}

View file

@ -39,6 +39,7 @@ class BasicsTest extends FunctionalTestCase
protected $testExtensionsToLoad = [
'typo3conf/ext/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
];
protected $pathsToLinkInTestInstance = [

View file

@ -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

View file

@ -25,7 +25,8 @@
},
"autoload-dev": {
"psr-4": {
"WerkraumMedia\\Watchlist\\Tests\\": "Tests/"
"WerkraumMedia\\Watchlist\\Tests\\": "Tests/",
"WerkraumMedia\\WatchlistExample\\": "Tests/Fixtures/watchlist_example/Classes/"
}
},
"require": {