mirror of
https://github.com/werkraum-media/watchlist.git
synced 2024-12-25 09:16:09 +01:00
Move example code to example fixture extension (#4)
This commit is contained in:
parent
85b132e759
commit
64c230589f
10 changed files with 38 additions and 20 deletions
|
@ -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
|
||||
|
|
19
README.rst
19
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.
|
||||
|
|
|
@ -47,6 +47,7 @@ class Environment extends BackendEnvironment
|
|||
],
|
||||
'testExtensionsToLoad' => [
|
||||
'typo3conf/ext/watchlist',
|
||||
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
|
||||
],
|
||||
'csvDatabaseFixtures' => [
|
||||
__DIR__ . '/../../Fixtures/BasicDatabase.csv',
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
11
Tests/Fixtures/watchlist_example/Configuration/Services.yaml
Normal file
11
Tests/Fixtures/watchlist_example/Configuration/Services.yaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
services:
|
||||
_defaults:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
public: false
|
||||
|
||||
WerkraumMedia\WatchlistExample\:
|
||||
resource: '../Classes/*'
|
||||
|
||||
WerkraumMedia\WatchlistExample\ItemHandler:
|
||||
tags: ['watchlist.itemHandler']
|
14
Tests/Fixtures/watchlist_example/composer.json
Normal file
14
Tests/Fixtures/watchlist_example/composer.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ class BasicsTest extends FunctionalTestCase
|
|||
|
||||
protected $testExtensionsToLoad = [
|
||||
'typo3conf/ext/watchlist',
|
||||
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
|
||||
];
|
||||
|
||||
protected $pathsToLinkInTestInstance = [
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"WerkraumMedia\\Watchlist\\Tests\\": "Tests/"
|
||||
"WerkraumMedia\\Watchlist\\Tests\\": "Tests/",
|
||||
"WerkraumMedia\\WatchlistExample\\": "Tests/Fixtures/watchlist_example/Classes/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
|
|
Loading…
Reference in a new issue