* Add first basic CI with defaults.
* Add ecs for coding guideline.
* Fix invalid xliff files.
This commit is contained in:
Daniel Siepmann 2021-09-07 09:03:02 +02:00
parent 27e5bb129a
commit cbe4eda380
49 changed files with 287 additions and 2075 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
/composer.lock /composer.lock
/public/ /.Build/
/vendor/ /vendor/

44
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,44 @@
stages:
- test
before_script:
- apk add zip
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php --filename composer --install-dir /bin
- php -r "unlink('composer-setup.php');"
test:composer:
image: php:7.4-alpine
stage: test
script:
- composer validate --no-check-publish --strict
test:php:7.4:
image: php:7.4-alpine
stage: test
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
test:php:7.3:
image: php:7.3-alpine
stage: test
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
test:xml:
image: php:7.3-alpine
stage: test
before_script:
script:
- apk add libxml2-utils wget
- composer install --prefer-dist --no-progress
- wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd
- xmllint --schema .Build/xliff-core-1.2-strict.xsd --noout $(find Resources -name '*.xlf')
test:cgl:
image: php:7.3-alpine
stage: test
before_script:
script:
- composer install --prefer-dist --no-progress
- ./vendor/bin/ecs check --no-progress-bar --clear-cache --fix

View file

@ -13,7 +13,6 @@ use Wrm\Events\Service\DestinationDataImportService;
class DestinationDataImportCommand extends Command class DestinationDataImportCommand extends Command
{ {
public function configure() public function configure()
{ {
$this->setDescription('Import Destination Data Events'); $this->setDescription('Import Destination Data Events');

View file

@ -18,7 +18,6 @@ use Wrm\Events\Service\DataProcessingForModels;
*/ */
class DateController extends AbstractController class DateController extends AbstractController
{ {
/** /**
* @var dateRepository * @var dateRepository
*/ */

View file

@ -9,7 +9,6 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
*/ */
class Date extends AbstractEntity class Date extends AbstractEntity
{ {
/** /**
* @var \DateTime * @var \DateTime
*/ */

View file

@ -6,7 +6,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class DateDemand class DateDemand
{ {
/** /**
* @var string * @var string
*/ */

View file

@ -4,7 +4,6 @@ namespace Wrm\Events\Domain\Model\Dto;
class EventDemand class EventDemand
{ {
/** /**
* @var string * @var string
*/ */

View file

@ -3,8 +3,8 @@
namespace Wrm\Events\Domain\Model; namespace Wrm\Events\Domain\Model;
use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use Wrm\Events\Domain\Repository\DateRepository; use Wrm\Events\Domain\Repository\DateRepository;
@ -15,7 +15,6 @@ use Wrm\Events\Service\DataProcessingForModels;
*/ */
class Event extends AbstractEntity class Event extends AbstractEntity
{ {
/** /**
* title * title
* *

View file

@ -20,7 +20,6 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
*/ */
class Organizer extends AbstractEntity class Organizer extends AbstractEntity
{ {
/** /**
* name * name
* *

View file

@ -21,8 +21,8 @@ namespace Wrm\Events\Domain\Model;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
class Partner extends AbstractEntity class Partner extends AbstractEntity

View file

@ -20,7 +20,6 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
*/ */
class Region extends AbstractEntity class Region extends AbstractEntity
{ {
/** /**
* title * title
* *

View file

@ -13,7 +13,6 @@ use Wrm\Events\Service\CategoryService;
class DateRepository extends Repository class DateRepository extends Repository
{ {
/** /**
* Find all dates based on selected uids * Find all dates based on selected uids
* @param string $uids * @param string $uids
@ -164,7 +163,6 @@ class DateRepository extends Repository
*/ */
public function findSearchWord($search) public function findSearchWord($search)
{ {
$connection = GeneralUtility::makeInstance(ConnectionPool::class) $connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_events_domain_model_date'); ->getConnectionForTable('tx_events_domain_model_date');

View file

@ -19,5 +19,4 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
class OrganizerRepository extends Repository class OrganizerRepository extends Repository
{ {
} }

View file

@ -19,5 +19,4 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
class RegionRepository extends Repository class RegionRepository extends Repository
{ {
} }

View file

@ -11,7 +11,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class CategoryService class CategoryService
{ {
/** @var TimeTracker */ /** @var TimeTracker */
protected $timeTracker; protected $timeTracker;

View file

@ -28,9 +28,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class Database class Database
{ {
const DATE_TABLE = 'tx_events_domain_model_date'; public const DATE_TABLE = 'tx_events_domain_model_date';
const EVENT_TABLE = 'tx_events_domain_model_event'; public const EVENT_TABLE = 'tx_events_domain_model_event';
const ORGANIZER_TABLE = 'tx_events_domain_model_organizer'; public const ORGANIZER_TABLE = 'tx_events_domain_model_organizer';
public function truncateTables(string ...$tableNames): void public function truncateTables(string ...$tableNames): void
{ {

View file

@ -63,7 +63,7 @@ class Files
$uidsToRemove[] = $fileToDelete['uid']; $uidsToRemove[] = $fileToDelete['uid'];
} }
$this->deleteFromDb(... $uidsToRemove); $this->deleteFromDb(...$uidsToRemove);
} }
private function getFilesFromDb(callable $whereGenerator = null): array private function getFilesFromDb(callable $whereGenerator = null): array

View file

@ -27,14 +27,14 @@ class CleanupService
public function deleteAllData() public function deleteAllData()
{ {
$this->database->truncateTables(... [Database::DATE_TABLE, Database::ORGANIZER_TABLE]); $this->database->truncateTables(...[Database::DATE_TABLE, Database::ORGANIZER_TABLE]);
$this->removeViaDataHandler($this->database->getDeletionStructureForEvents()); $this->removeViaDataHandler($this->database->getDeletionStructureForEvents());
$this->files->deleteAll(); $this->files->deleteAll();
} }
public function deletePastData() public function deletePastData()
{ {
$this->database->deleteDates(... $this->database->getPastDates()); $this->database->deleteDates(...$this->database->getPastDates());
$this->removeViaDataHandler($this->database->getDeletionStructureForEventsWithoutDates()); $this->removeViaDataHandler($this->database->getDeletionStructureForEventsWithoutDates());
$this->files->deleteDangling(); $this->files->deleteDangling();
} }

View file

@ -3,9 +3,9 @@
namespace Wrm\Events\Service; namespace Wrm\Events\Service;
use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\DataHandling\SlugHelper; use TYPO3\CMS\Core\DataHandling\SlugHelper;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException; use TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException;
use TYPO3\CMS\Core\Resource\FileRepository; use TYPO3\CMS\Core\Resource\FileRepository;
@ -29,7 +29,6 @@ use Wrm\Events\Domain\Repository\RegionRepository;
class DestinationDataImportService class DestinationDataImportService
{ {
/** /**
* @var * @var
*/ */
@ -211,7 +210,6 @@ class DestinationDataImportService
*/ */
public function import($restExperience, $storagePid, $regionUid, $filesFolder) public function import($restExperience, $storagePid, $regionUid, $filesFolder)
{ {
$this->restExperience = $restExperience; $this->restExperience = $restExperience;
$this->storagePid = $storagePid; $this->storagePid = $storagePid;
$this->regionUid = $regionUid; $this->regionUid = $regionUid;
@ -252,7 +250,6 @@ class DestinationDataImportService
*/ */
public function processData($data) public function processData($data)
{ {
$this->logger->info('Processing json ' . count($data['items'])); $this->logger->info('Processing json ' . count($data['items']));
// Get selected region // Get selected region
@ -546,7 +543,6 @@ class DestinationDataImportService
*/ */
protected function multi_array_key_exists($needle, $haystack) protected function multi_array_key_exists($needle, $haystack)
{ {
foreach ($haystack as $key => $value) { foreach ($haystack as $key => $value) {
if ($needle == $key) { if ($needle == $key) {
return true; return true;
@ -596,7 +592,6 @@ class DestinationDataImportService
*/ */
protected function getOrCreateEvent(string $globalId, string $title) protected function getOrCreateEvent(string $globalId, string $title)
{ {
$event = $this->eventRepository->findOneByGlobalId($globalId); $event = $this->eventRepository->findOneByGlobalId($globalId);
if ($event) { if ($event) {
@ -623,7 +618,6 @@ class DestinationDataImportService
*/ */
protected function setAssets(array $assets) protected function setAssets(array $assets)
{ {
$this->logger->info("Set assets"); $this->logger->info("Set assets");
$error = false; $error = false;
@ -716,7 +710,6 @@ class DestinationDataImportService
*/ */
protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid) protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid)
{ {
$newId = 'NEW1234'; $newId = 'NEW1234';
$data = array(); $data = array();

View file

@ -68,5 +68,4 @@ call_user_func(function () {
'events_selected', 'events_selected',
'FILE:EXT:events/Configuration/FlexForms/Selected.xml' 'FILE:EXT:events/Configuration/FlexForms/Selected.xml'
); );
}); });

View file

@ -210,7 +210,7 @@ return [
'size' => 1, 'size' => 1,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
'readOnly' =>1, 'readOnly' => 1,
) )
) )
], ],

View file

@ -1,4 +1,5 @@
<?php <?php
return [ return [
'ctrl' => [ 'ctrl' => [
'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_organizer.xlf:tx_events_domain_model_organizer', 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_organizer.xlf:tx_events_domain_model_organizer',

View file

@ -1,4 +1,5 @@
<?php <?php
return [ return [
'ctrl' => [ 'ctrl' => [
'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_region.xlf:tx_events_domain_model_region', 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_region.xlf:tx_events_domain_model_region',

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events.searchform"> <trans-unit id="tx_events.searchform">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_date"> <trans-unit id="tx_events_domain_model_date">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events.name"> <trans-unit id="tx_events.name">

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_organizer"> <trans-unit id="tx_events_domain_model_organizer">
<source>Organizer</source> <source>Organizer</source>
<target>Organisator</target> <target>Organisator</target>
</trans-unit> </trans-unit>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_partner"> <trans-unit id="tx_events_domain_model_partner">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_region"> <trans-unit id="tx_events_domain_model_region">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events.name"> <trans-unit id="tx_events.name">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events.searchform"> <trans-unit id="tx_events.searchform">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_date"> <trans-unit id="tx_events_domain_model_date">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events.name"> <trans-unit id="tx_events.name">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_organizer"> <trans-unit id="tx_events_domain_model_organizer">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_partner"> <trans-unit id="tx_events_domain_model_partner">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2021-09-07T09:15:42Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events_domain_model_region"> <trans-unit id="tx_events_domain_model_region">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events"> <file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="Events">
<header/> <header/>
<body> <body>
<trans-unit id="tx_events.name"> <trans-unit id="tx_events.name">

View file

@ -1,63 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Controller;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Controller\DateController
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\DateController::class)
->setMethods(['redirect', 'forward', 'addFlashMessage'])
->disableOriginalConstructor()
->getMock();
}
/**
* @test
*/
public function listActionFetchesAllDatesFromRepositoryAndAssignsThemToView()
{
$allDates = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->disableOriginalConstructor()
->getMock();
// $dateRepository = $this->getMockBuilder(\::class)
// ->setMethods(['findAll'])
// ->disableOriginalConstructor()
// ->getMock();
$dateRepository->expects(self::once())->method('findAll')->will(self::returnValue($allDates));
$this->inject($this->subject, 'dateRepository', $dateRepository);
$view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock();
$view->expects(self::once())->method('assign')->with('dates', $allDates);
$this->inject($this->subject, 'view', $view);
$this->subject->listAction();
}
/**
* @test
*/
public function showActionAssignsTheGivenDateToView()
{
$date = new \Wrm\Events\Domain\Model\Date();
$view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock();
$this->inject($this->subject, 'view', $view);
$view->expects(self::once())->method('assign')->with('date', $date);
$this->subject->showAction($date);
}
}

View file

@ -1,63 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Controller;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Controller\EventController
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventController::class)
->setMethods(['redirect', 'forward', 'addFlashMessage'])
->disableOriginalConstructor()
->getMock();
}
/**
* @test
*/
public function listActionFetchesAllEventsFromRepositoryAndAssignsThemToView()
{
$allEvents = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->disableOriginalConstructor()
->getMock();
// $eventRepository = $this->getMockBuilder(\::class)
// ->setMethods(['findAll'])
// ->disableOriginalConstructor()
// ->getMock();
$eventRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEvents));
$this->inject($this->subject, 'eventRepository', $eventRepository);
$view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock();
$view->expects(self::once())->method('assign')->with('events', $allEvents);
$this->inject($this->subject, 'view', $view);
$this->subject->listAction();
}
/**
* @test
*/
public function showActionAssignsTheGivenEventToView()
{
$event = new \Wrm\Events\Domain\Model\Event();
$view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock();
$this->inject($this->subject, 'view', $view);
$view->expects(self::once())->method('assign')->with('event', $event);
$this->subject->showAction($event);
}
}

View file

@ -1,63 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Controller;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Controller\EventsController
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventsController::class)
->setMethods(['redirect', 'forward', 'addFlashMessage'])
->disableOriginalConstructor()
->getMock();
}
/**
* @test
*/
public function listActionFetchesAllEventssFromRepositoryAndAssignsThemToView()
{
$allEventss = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->disableOriginalConstructor()
->getMock();
// $eventsRepository = $this->getMockBuilder(\::class)
// ->setMethods(['findAll'])
// ->disableOriginalConstructor()
// ->getMock();
$eventsRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEventss));
$this->inject($this->subject, 'eventsRepository', $eventsRepository);
$view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock();
$view->expects(self::once())->method('assign')->with('eventss', $allEventss);
$this->inject($this->subject, 'view', $view);
$this->subject->listAction();
}
/**
* @test
*/
public function showActionAssignsTheGivenEventsToView()
{
$events = new \Wrm\Events\Domain\Model\Events();
$view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock();
$this->inject($this->subject, 'view', $view);
$view->expects(self::once())->method('assign')->with('events', $events);
$this->subject->showAction($events);
}
}

View file

@ -1,74 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Domain\Model;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class DateTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Domain\Model\Date
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = new \Wrm\Events\Domain\Model\Date();
}
/**
* @test
*/
public function getStartReturnsInitialValueForDateTime()
{
self::assertEquals(
null,
$this->subject->getStart()
);
}
/**
* @test
*/
public function setStartForDateTimeSetsStart()
{
$dateTimeFixture = new \DateTime();
$this->subject->setStart($dateTimeFixture);
self::assertAttributeEquals(
$dateTimeFixture,
'start',
$this->subject
);
}
/**
* @test
*/
public function getEndReturnsInitialValueForDateTime()
{
self::assertEquals(
null,
$this->subject->getEnd()
);
}
/**
* @test
*/
public function setEndForDateTimeSetsEnd()
{
$dateTimeFixture = new \DateTime();
$this->subject->setEnd($dateTimeFixture);
self::assertAttributeEquals(
$dateTimeFixture,
'end',
$this->subject
);
}
}

View file

@ -1,663 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Domain\Model;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class EventTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Domain\Model\Event
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = new \Wrm\Events\Domain\Model\Event();
}
/**
* @test
*/
public function getTitleReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function setTitleForStringSetsTitle()
{
$this->subject->setTitle('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'title',
$this->subject
);
}
/**
* @test
*/
public function getGlobalIdReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getGlobalId()
);
}
/**
* @test
*/
public function setGlobalIdForStringSetsGlobalId()
{
$this->subject->setGlobalId('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'globalId',
$this->subject
);
}
/**
* @test
*/
public function getSlugReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getSlug()
);
}
/**
* @test
*/
public function setSlugForStringSetsSlug()
{
$this->subject->setSlug('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'slug',
$this->subject
);
}
/**
* @test
*/
public function getHighlightReturnsInitialValueForBool()
{
self::assertSame(
false,
$this->subject->getHighlight()
);
}
/**
* @test
*/
public function setHighlightForBoolSetsHighlight()
{
$this->subject->setHighlight(true);
self::assertAttributeEquals(
true,
'highlight',
$this->subject
);
}
/**
* @test
*/
public function getTeaserReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTeaser()
);
}
/**
* @test
*/
public function setTeaserForStringSetsTeaser()
{
$this->subject->setTeaser('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'teaser',
$this->subject
);
}
/**
* @test
*/
public function getDetailsReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getDetails()
);
}
/**
* @test
*/
public function setDetailsForStringSetsDetails()
{
$this->subject->setDetails('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'details',
$this->subject
);
}
/**
* @test
*/
public function getPriceInfoReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getPriceInfo()
);
}
/**
* @test
*/
public function setPriceInfoForStringSetsPriceInfo()
{
$this->subject->setPriceInfo('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'priceInfo',
$this->subject
);
}
/**
* @test
*/
public function getStreetReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getStreet()
);
}
/**
* @test
*/
public function setStreetForStringSetsStreet()
{
$this->subject->setStreet('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'street',
$this->subject
);
}
/**
* @test
*/
public function getDistrictReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getDistrict()
);
}
/**
* @test
*/
public function setDistrictForStringSetsDistrict()
{
$this->subject->setDistrict('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'district',
$this->subject
);
}
/**
* @test
*/
public function getCityReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getCity()
);
}
/**
* @test
*/
public function setCityForStringSetsCity()
{
$this->subject->setCity('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'city',
$this->subject
);
}
/**
* @test
*/
public function getZipReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getZip()
);
}
/**
* @test
*/
public function setZipForStringSetsZip()
{
$this->subject->setZip('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'zip',
$this->subject
);
}
/**
* @test
*/
public function getCountryReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getCountry()
);
}
/**
* @test
*/
public function setCountryForStringSetsCountry()
{
$this->subject->setCountry('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'country',
$this->subject
);
}
/**
* @test
*/
public function getWebReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getWeb()
);
}
/**
* @test
*/
public function setWebForStringSetsWeb()
{
$this->subject->setWeb('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'web',
$this->subject
);
}
/**
* @test
*/
public function getBookingReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getBooking()
);
}
/**
* @test
*/
public function setBookingForStringSetsBooking()
{
$this->subject->setBooking('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'booking',
$this->subject
);
}
/**
* @test
*/
public function getTicketReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTicket()
);
}
/**
* @test
*/
public function setTicketForStringSetsTicket()
{
$this->subject->setTicket('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'ticket',
$this->subject
);
}
/**
* @test
*/
public function getFacebookReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getFacebook()
);
}
/**
* @test
*/
public function setFacebookForStringSetsFacebook()
{
$this->subject->setFacebook('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'facebook',
$this->subject
);
}
/**
* @test
*/
public function getYoutubeReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getYoutube()
);
}
/**
* @test
*/
public function setYoutubeForStringSetsYoutube()
{
$this->subject->setYoutube('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'youtube',
$this->subject
);
}
/**
* @test
*/
public function getLatitudeReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getLatitude()
);
}
/**
* @test
*/
public function setLatitudeForStringSetsLatitude()
{
$this->subject->setLatitude('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'latitude',
$this->subject
);
}
/**
* @test
*/
public function getLongitudeReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getLongitude()
);
}
/**
* @test
*/
public function setLongitudeForStringSetsLongitude()
{
$this->subject->setLongitude('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'longitude',
$this->subject
);
}
/**
* @test
*/
public function getImagesReturnsInitialValueForFileReference()
{
self::assertEquals(
null,
$this->subject->getImages()
);
}
/**
* @test
*/
public function setImagesForFileReferenceSetsImages()
{
$fileReferenceFixture = new \TYPO3\CMS\Extbase\Domain\Model\FileReference();
$this->subject->setImages($fileReferenceFixture);
self::assertAttributeEquals(
$fileReferenceFixture,
'images',
$this->subject
);
}
/**
* @test
*/
public function getCategoriesReturnsInitialValueForInt()
{
self::assertSame(
0,
$this->subject->getCategories()
);
}
/**
* @test
*/
public function setCategoriesForIntSetsCategories()
{
$this->subject->setCategories(12);
self::assertAttributeEquals(
12,
'categories',
$this->subject
);
}
/**
* @test
*/
public function getDatesReturnsInitialValueForDate()
{
$newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
self::assertEquals(
$newObjectStorage,
$this->subject->getDates()
);
}
/**
* @test
*/
public function setDatesForObjectStorageContainingDateSetsDates()
{
$date = new \Wrm\Events\Domain\Model\Date();
$objectStorageHoldingExactlyOneDates = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$objectStorageHoldingExactlyOneDates->attach($date);
$this->subject->setDates($objectStorageHoldingExactlyOneDates);
self::assertAttributeEquals(
$objectStorageHoldingExactlyOneDates,
'dates',
$this->subject
);
}
/**
* @test
*/
public function addDateToObjectStorageHoldingDates()
{
$date = new \Wrm\Events\Domain\Model\Date();
$datesObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->setMethods(['attach'])
->disableOriginalConstructor()
->getMock();
$datesObjectStorageMock->expects(self::once())->method('attach')->with(self::equalTo($date));
$this->inject($this->subject, 'dates', $datesObjectStorageMock);
$this->subject->addDate($date);
}
/**
* @test
*/
public function removeDateFromObjectStorageHoldingDates()
{
$date = new \Wrm\Events\Domain\Model\Date();
$datesObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->setMethods(['detach'])
->disableOriginalConstructor()
->getMock();
$datesObjectStorageMock->expects(self::once())->method('detach')->with(self::equalTo($date));
$this->inject($this->subject, 'dates', $datesObjectStorageMock);
$this->subject->removeDate($date);
}
/**
* @test
*/
public function getOrganizerReturnsInitialValueForOrganizer()
{
self::assertEquals(
null,
$this->subject->getOrganizer()
);
}
/**
* @test
*/
public function setOrganizerForOrganizerSetsOrganizer()
{
$organizerFixture = new \Wrm\Events\Domain\Model\Organizer();
$this->subject->setOrganizer($organizerFixture);
self::assertAttributeEquals(
$organizerFixture,
'organizer',
$this->subject
);
}
/**
* @test
*/
public function getRegionReturnsInitialValueForRegion()
{
self::assertEquals(
null,
$this->subject->getRegion()
);
}
/**
* @test
*/
public function setRegionForRegionSetsRegion()
{
$regionFixture = new \Wrm\Events\Domain\Model\Region();
$this->subject->setRegion($regionFixture);
self::assertAttributeEquals(
$regionFixture,
'region',
$this->subject
);
}
}

View file

@ -1,613 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Domain\Model;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Domain\Model\Events
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = new \Wrm\Events\Domain\Model\Events();
}
/**
* @test
*/
public function getGlobalIdReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getGlobalId()
);
}
/**
* @test
*/
public function setGlobalIdForStringSetsGlobalId()
{
$this->subject->setGlobalId('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'globalId',
$this->subject
);
}
/**
* @test
*/
public function getTitleReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function setTitleForStringSetsTitle()
{
$this->subject->setTitle('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'title',
$this->subject
);
}
/**
* @test
*/
public function getTeaserReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTeaser()
);
}
/**
* @test
*/
public function setTeaserForStringSetsTeaser()
{
$this->subject->setTeaser('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'teaser',
$this->subject
);
}
/**
* @test
*/
public function getDetailsReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getDetails()
);
}
/**
* @test
*/
public function setDetailsForStringSetsDetails()
{
$this->subject->setDetails('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'details',
$this->subject
);
}
/**
* @test
*/
public function getPriceInfoReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getPriceInfo()
);
}
/**
* @test
*/
public function setPriceInfoForStringSetsPriceInfo()
{
$this->subject->setPriceInfo('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'priceInfo',
$this->subject
);
}
/**
* @test
*/
public function getStreetReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getStreet()
);
}
/**
* @test
*/
public function setStreetForStringSetsStreet()
{
$this->subject->setStreet('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'street',
$this->subject
);
}
/**
* @test
*/
public function getDistrictReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getDistrict()
);
}
/**
* @test
*/
public function setDistrictForStringSetsDistrict()
{
$this->subject->setDistrict('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'district',
$this->subject
);
}
/**
* @test
*/
public function getCityReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getCity()
);
}
/**
* @test
*/
public function setCityForStringSetsCity()
{
$this->subject->setCity('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'city',
$this->subject
);
}
/**
* @test
*/
public function getZipReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getZip()
);
}
/**
* @test
*/
public function setZipForStringSetsZip()
{
$this->subject->setZip('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'zip',
$this->subject
);
}
/**
* @test
*/
public function getWebReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getWeb()
);
}
/**
* @test
*/
public function setWebForStringSetsWeb()
{
$this->subject->setWeb('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'web',
$this->subject
);
}
/**
* @test
*/
public function getBookingReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getBooking()
);
}
/**
* @test
*/
public function setBookingForStringSetsBooking()
{
$this->subject->setBooking('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'booking',
$this->subject
);
}
/**
* @test
*/
public function getTicketReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTicket()
);
}
/**
* @test
*/
public function setTicketForStringSetsTicket()
{
$this->subject->setTicket('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'ticket',
$this->subject
);
}
/**
* @test
*/
public function getFacebookReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getFacebook()
);
}
/**
* @test
*/
public function setFacebookForStringSetsFacebook()
{
$this->subject->setFacebook('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'facebook',
$this->subject
);
}
/**
* @test
*/
public function getYoutubeReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getYoutube()
);
}
/**
* @test
*/
public function setYoutubeForStringSetsYoutube()
{
$this->subject->setYoutube('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'youtube',
$this->subject
);
}
/**
* @test
*/
public function getLatitudeReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getLatitude()
);
}
/**
* @test
*/
public function setLatitudeForStringSetsLatitude()
{
$this->subject->setLatitude('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'latitude',
$this->subject
);
}
/**
* @test
*/
public function getLongitudeReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getLongitude()
);
}
/**
* @test
*/
public function setLongitudeForStringSetsLongitude()
{
$this->subject->setLongitude('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'longitude',
$this->subject
);
}
/**
* @test
*/
public function getImagesReturnsInitialValueForFileReference()
{
self::assertEquals(
null,
$this->subject->getImages()
);
}
/**
* @test
*/
public function setImagesForFileReferenceSetsImages()
{
$fileReferenceFixture = new \TYPO3\CMS\Extbase\Domain\Model\FileReference();
$this->subject->setImages($fileReferenceFixture);
self::assertAttributeEquals(
$fileReferenceFixture,
'images',
$this->subject
);
}
/**
* @test
*/
public function getSlugReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getSlug()
);
}
/**
* @test
*/
public function setSlugForStringSetsSlug()
{
$this->subject->setSlug('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'slug',
$this->subject
);
}
/**
* @test
*/
public function getOrganizerReturnsInitialValueFor()
{
}
/**
* @test
*/
public function setOrganizerForSetsOrganizer()
{
}
/**
* @test
*/
public function getDateReturnsInitialValueFor()
{
$newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
self::assertEquals(
$newObjectStorage,
$this->subject->getDate()
);
}
/**
* @test
*/
public function setDateForObjectStorageContainingSetsDate()
{
// $date = new ();
$objectStorageHoldingExactlyOneDate = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$objectStorageHoldingExactlyOneDate->attach($date);
$this->subject->setDate($objectStorageHoldingExactlyOneDate);
self::assertAttributeEquals(
$objectStorageHoldingExactlyOneDate,
'date',
$this->subject
);
}
/**
* @test
*/
public function addDateToObjectStorageHoldingDate()
{
// $date = new ();
$dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->setMethods(['attach'])
->disableOriginalConstructor()
->getMock();
$dateObjectStorageMock->expects(self::once())->method('attach')->with(self::equalTo($date));
$this->inject($this->subject, 'date', $dateObjectStorageMock);
$this->subject->addDate($date);
}
/**
* @test
*/
public function removeDateFromObjectStorageHoldingDate()
{
// $date = new ();
$dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->setMethods(['detach'])
->disableOriginalConstructor()
->getMock();
$dateObjectStorageMock->expects(self::once())->method('detach')->with(self::equalTo($date));
$this->inject($this->subject, 'date', $dateObjectStorageMock);
$this->subject->removeDate($date);
}
/**
* @test
*/
public function getRegionReturnsInitialValueFor()
{
$newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
self::assertEquals(
$newObjectStorage,
$this->subject->getRegion()
);
}
/**
* @test
*/
public function setRegionForObjectStorageContainingSetsRegion()
{
// $region = new ();
$objectStorageHoldingExactlyOneRegion = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$objectStorageHoldingExactlyOneRegion->attach($region);
$this->subject->setRegion($objectStorageHoldingExactlyOneRegion);
self::assertAttributeEquals(
$objectStorageHoldingExactlyOneRegion,
'region',
$this->subject
);
}
/**
* @test
*/
public function addRegionToObjectStorageHoldingRegion()
{
// $region = new ();
$regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->setMethods(['attach'])
->disableOriginalConstructor()
->getMock();
$regionObjectStorageMock->expects(self::once())->method('attach')->with(self::equalTo($region));
$this->inject($this->subject, 'region', $regionObjectStorageMock);
$this->subject->addRegion($region);
}
/**
* @test
*/
public function removeRegionFromObjectStorageHoldingRegion()
{
// $region = new ();
$regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
->setMethods(['detach'])
->disableOriginalConstructor()
->getMock();
$regionObjectStorageMock->expects(self::once())->method('detach')->with(self::equalTo($region));
$this->inject($this->subject, 'region', $regionObjectStorageMock);
$this->subject->removeRegion($region);
}
}

View file

@ -1,222 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Domain\Model;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class OrganizerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Domain\Model\Organizer
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = new \Wrm\Events\Domain\Model\Organizer();
}
/**
* @test
*/
public function getNameReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getName()
);
}
/**
* @test
*/
public function setNameForStringSetsName()
{
$this->subject->setName('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'name',
$this->subject
);
}
/**
* @test
*/
public function getStreetReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getStreet()
);
}
/**
* @test
*/
public function setStreetForStringSetsStreet()
{
$this->subject->setStreet('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'street',
$this->subject
);
}
/**
* @test
*/
public function getDistrictReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getDistrict()
);
}
/**
* @test
*/
public function setDistrictForStringSetsDistrict()
{
$this->subject->setDistrict('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'district',
$this->subject
);
}
/**
* @test
*/
public function getCityReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getCity()
);
}
/**
* @test
*/
public function setCityForStringSetsCity()
{
$this->subject->setCity('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'city',
$this->subject
);
}
/**
* @test
*/
public function getZipReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getZip()
);
}
/**
* @test
*/
public function setZipForStringSetsZip()
{
$this->subject->setZip('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'zip',
$this->subject
);
}
/**
* @test
*/
public function getPhoneReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getPhone()
);
}
/**
* @test
*/
public function setPhoneForStringSetsPhone()
{
$this->subject->setPhone('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'phone',
$this->subject
);
}
/**
* @test
*/
public function getWebReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getWeb()
);
}
/**
* @test
*/
public function setWebForStringSetsWeb()
{
$this->subject->setWeb('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'web',
$this->subject
);
}
/**
* @test
*/
public function getEmailReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getEmail()
);
}
/**
* @test
*/
public function setEmailForStringSetsEmail()
{
$this->subject->setEmail('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'email',
$this->subject
);
}
}

View file

@ -1,47 +0,0 @@
<?php
namespace Wrm\Events\Tests\Unit\Domain\Model;
/**
* Test case.
*
* @author Dirk Koritnik <koritnik@werkraum-media.de>
*/
class RegionTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* @var \Wrm\Events\Domain\Model\Region
*/
protected $subject = null;
protected function setUp(): void
{
parent::setUp();
$this->subject = new \Wrm\Events\Domain\Model\Region();
}
/**
* @test
*/
public function getTitleReturnsInitialValueForString()
{
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function setTitleForStringSetsTitle()
{
$this->subject->setTitle('Conceived at T3CON10');
self::assertAttributeEquals(
'Conceived at T3CON10',
'title',
$this->subject
);
}
}

View file

@ -1,6 +1,7 @@
{ {
"name": "wrm/events", "name": "wrm/events",
"type": "typo3-cms-extension", "type": "typo3-cms-extension",
"license": "GPL-2.0-or-later",
"description": "Extension to manage Destination Data managed events", "description": "Extension to manage Destination Data managed events",
"authors": [ "authors": [
{ {
@ -25,12 +26,13 @@
}, },
"extra": { "extra": {
"typo3/cms": { "typo3/cms": {
"extension-key": "events" "cms-package-dir": "{$vendor-dir}/typo3/cms",
"extension-key": "events",
"web-dir": ".Build/web"
} }
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.0", "symplify/easy-coding-standard": "^9.4"
"typo3/testing-framework": "^6.6"
} }
} }

20
ecs.php Normal file
View file

@ -0,0 +1,20 @@
<?php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(SetList::PSR_12);
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/Classes',
__DIR__ . '/Configuration',
__DIR__ . '/ecs.php',
__DIR__ . '/ext_emconf.php',
__DIR__ . '/ext_localconf.php',
__DIR__ . '/ext_tables.php',
]);
};

View file

@ -4,7 +4,6 @@ defined('TYPO3') || die('Access denied.');
call_user_func( call_user_func(
function () { function () {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('events', 'Configuration/TypoScript', 'Events'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('events', 'Configuration/TypoScript', 'Events');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_events_domain_model_event', 'EXT:events/Resources/Private/Language/locallang_csh_tx_events_domain_model_event.xlf'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_events_domain_model_event', 'EXT:events/Resources/Private/Language/locallang_csh_tx_events_domain_model_event.xlf');

View file

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<ruleset name="project">
<description>This project coding standard</description>
<file>Classes/</file>
<file>Tests/</file>
<file>ext_localconf.php</file>
<file>ext_tables.php</file>
<!-- Set default settings -->
<arg value="sp"/>
<arg name="colors"/>
<arg name="encoding" value="utf-8" />
<arg name="extensions" value="php" />
<!-- Base rules -->
<rule ref="PSR12">
<!-- Ignore some rules for now. -->
<!-- Otherwise we would need some more adjustments to the code. -->
<!-- We can clean these rules up in the future -->
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="PSR12.Properties.ConstantVisibility.NotFound" />
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
</rule>
</ruleset>