diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aab70f5..65771a4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,5 @@
stages:
+ - validate
- test
before_script:
@@ -7,39 +8,39 @@ before_script:
- php composer-setup.php --filename composer --install-dir /bin
- php -r "unlink('composer-setup.php');"
-test:composer:
+validate:composer:
image: php:8.0-alpine
- stage: test
+ stage: validate
script:
- composer validate --no-check-publish --strict
-test:php:8.0:
+validate:php:8.0:
image: php:8.0-alpine
- stage: test
+ stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
-test:php:7.4:
+validate:php:7.4:
image: php:7.4-alpine
- stage: test
+ stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
-test:php:7.3:
+validate:php:7.3:
image: php:7.3-alpine
- stage: test
+ stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
-test:php:7.2:
+validate:php:7.2:
image: php:7.2-alpine
- stage: test
+ stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
-test:xml:
+validate:xml:
image: php:7.3-alpine
- stage: test
+ stage: validate
before_script:
script:
- apk add libxml2-utils wget
@@ -47,50 +48,90 @@ test:xml:
- 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:
+validate:cgl:
image: php:7.3-alpine
- stage: test
+ stage: validate
before_script:
script:
- composer install --prefer-dist --no-progress
- ./vendor/bin/ecs check --no-progress-bar --clear-cache --fix
-test:phpstan:8.0:
+validate:phpstan:8.0:
image: php:8.0-alpine
- stage: test
+ stage: validate
before_script:
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
-test:phpstan:7.4:11.5:
+validate:phpstan:7.4:11.5:
image: php:7.4-alpine
- stage: test
+ stage: validate
before_script:
script:
- composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^11.5"
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
-test:phpstan:7.4:10.4:
+validate:phpstan:7.4:10.4:
image: php:7.4-alpine
- stage: test
+ stage: validate
before_script:
script:
- composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^10.4"
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
-test:phpstan:7.3:
+validate:phpstan:7.3:
image: php:7.3-alpine
- stage: test
+ stage: validate
before_script:
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
-test:phpstan:7.2:
+validate:phpstan:7.2:
+ image: php:7.2-alpine
+ stage: validate
+ before_script:
+ script:
+ - composer install --prefer-dist --no-progress
+ - php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
+
+test:phpunit:8.0:
+ image: php:8.0-alpine
+ stage: test
+ before_script:
+ script:
+ - composer install --prefer-dist --no-progress
+ - php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
+
+test:phpunit:7.4:11.5:
+ image: php:7.4-alpine
+ stage: test
+ before_script:
+ script:
+ - composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^11.5"
+ - php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
+
+test:phpunit:7.4:10.4:
+ image: php:7.4-alpine
+ stage: test
+ before_script:
+ script:
+ - composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^10.4"
+ - php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
+
+test:phpunit:7.3:
+ image: php:7.3-alpine
+ stage: test
+ before_script:
+ script:
+ - composer install --prefer-dist --no-progress
+ - php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
+
+test:phpunit:7.2:
image: php:7.2-alpine
stage: test
before_script:
script:
- composer install --prefer-dist --no-progress
- - php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
+ - php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
diff --git a/Classes/Command/DestinationDataImportCommand.php b/Classes/Command/DestinationDataImportCommand.php
index d7da7b7..537d4d6 100644
--- a/Classes/Command/DestinationDataImportCommand.php
+++ b/Classes/Command/DestinationDataImportCommand.php
@@ -33,11 +33,6 @@ class DestinationDataImportCommand extends Command
InputArgument::REQUIRED,
'What is the storage pid?'
);
- $this->addArgument(
- 'region-uid',
- InputArgument::OPTIONAL,
- 'What is the region uid?'
- );
$this->addArgument(
'rest-experience',
InputArgument::REQUIRED,
@@ -48,6 +43,11 @@ class DestinationDataImportCommand extends Command
InputArgument::REQUIRED,
'Where to save the image files?'
);
+ $this->addArgument(
+ 'region-uid',
+ InputArgument::OPTIONAL,
+ 'What is the region uid?'
+ );
}
protected function execute(InputInterface $input, OutputInterface $output)
diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php
index f05376b..7bc735f 100644
--- a/Classes/Service/DestinationDataImportService.php
+++ b/Classes/Service/DestinationDataImportService.php
@@ -29,6 +29,7 @@ use Wrm\Events\Domain\Repository\DateRepository;
use Wrm\Events\Domain\Repository\EventRepository;
use Wrm\Events\Domain\Repository\OrganizerRepository;
use Wrm\Events\Domain\Repository\RegionRepository;
+use Wrm\Events\Service\DestinationDataImportService\DataFetcher;
class DestinationDataImportService
{
@@ -162,6 +163,11 @@ class DestinationDataImportService
*/
private $resourceFactory;
+ /**
+ * @var DataFetcher
+ */
+ private $dataFetcher;
+
/**
* ImportService constructor.
* @param EventRepository $eventRepository
@@ -175,6 +181,7 @@ class DestinationDataImportService
* @param ResourceFactory $resourceFactory
* @param ObjectManager $objectManager
* @param Environment $environment
+ * @param DataFetcher $dataFetcher
*/
public function __construct(
EventRepository $eventRepository,
@@ -187,7 +194,8 @@ class DestinationDataImportService
PersistenceManager $persistenceManager,
ResourceFactory $resourceFactory,
ObjectManager $objectManager,
- Environment $environment
+ Environment $environment,
+ DataFetcher $dataFetcher
) {
$this->eventRepository = $eventRepository;
$this->regionRepository = $regionRepository;
@@ -200,6 +208,7 @@ class DestinationDataImportService
$this->resourceFactory = $resourceFactory;
$this->objectManager = $objectManager;
$this->environment = $environment;
+ $this->dataFetcher = $dataFetcher;
// Get Typoscript Settings
$this->settings = $this->configurationManager->getConfiguration(
@@ -708,17 +717,20 @@ class DestinationDataImportService
}
}
- private function loadFile(string $file): string
+ private function loadFile(string $fileUrl): string
{
$directory = $this->environment->getPublicPath() . "/uploads/tx_events/";
- $filename = basename($file);
- $this->logger->info('Getting file ' . $file . ' as ' . $filename);
- $asset = GeneralUtility::getUrl($file);
- if ($asset) {
+ $filename = basename($fileUrl);
+ $this->logger->info('Getting file ' . $fileUrl . ' as ' . $filename);
+
+ $response = $this->dataFetcher->fetchImage($fileUrl);
+ $asset = $response->getBody()->__toString();
+ if ($response->getStatusCode() === 200 && $asset !== '') {
file_put_contents($directory . $filename, $asset);
return $filename;
}
- $this->logger->error('Cannot load file ' . $file);
+
+ $this->logger->error('Cannot load file ' . $fileUrl);
return '';
}
diff --git a/Classes/Service/DestinationDataImportService/DataFetcher.php b/Classes/Service/DestinationDataImportService/DataFetcher.php
new file mode 100644
index 0000000..ecb9ed6
--- /dev/null
+++ b/Classes/Service/DestinationDataImportService/DataFetcher.php
@@ -0,0 +1,55 @@
+requestFactory = $requestFactory;
+ $this->client = $client;
+ }
+
+ public function fetchImage(string $url): ResponseInterface
+ {
+ // Keep after TYPO3 10 was dropped
+ if ($this->client instanceof ClientInterface) {
+ return $this->client->sendRequest(
+ $this->requestFactory->createRequest(
+ 'GET',
+ $url
+ )
+ );
+ }
+
+ // Drop once TYPO3 10 support was dropped
+ return $this->client->request(
+ 'GET',
+ $url,
+ []
+ );
+ }
+}
diff --git a/Classes/Service/DestinationDataImportService/Import.php b/Classes/Service/DestinationDataImportService/Import.php
new file mode 100644
index 0000000..2e6c833
--- /dev/null
+++ b/Classes/Service/DestinationDataImportService/Import.php
@@ -0,0 +1,10 @@
+push($history);
+
+ return new Client(['handler' => $handlerStack]);
+ }
+}
diff --git a/Tests/Functional/Import/DestinationDataTest/AbstractTest.php b/Tests/Functional/Import/DestinationDataTest/AbstractTest.php
new file mode 100644
index 0000000..a6fe0af
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/AbstractTest.php
@@ -0,0 +1,38 @@
+importDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Fixtures/Structure.xml');
+ $this->setUpBackendUserFromFixture(1);
+
+ $languageServiceFactory = $this->getContainer()->get(LanguageServiceFactory::class);
+ if (!$languageServiceFactory instanceof LanguageServiceFactory) {
+ throw new \UnexpectedValueException('Did not retrieve LanguageServiceFactory.', 1637847250);
+ }
+ $GLOBALS['LANG'] = $languageServiceFactory->create('default');
+ }
+
+ protected function tearDown(): void
+ {
+ unset($GLOBALS['LANG']);
+
+ parent::tearDown();
+ }
+}
diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv
new file mode 100644
index 0000000..d11b7ba
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv
@@ -0,0 +1,28 @@
+"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email",,,,,,,,,,,,,,,,,,,,,,
+,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de",,,,,,,,,,,,,,,,,,,,,,
+,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de",,,,,,,,,,,,,,,,,,,,,,
+,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",,,,,,,,,,,,,,,,,,,,,,,,
+"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","slug","highlight","teaser","details","price_info","name","street","district","city","zip","country","web","phone","ticket","facebook","youtube","instagram","latitude","longitude","images","categories","pages","dates","organizer","partner","region","references_events"
+,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","e-100347853","0",,"Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.
+Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)
+Um Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten.
+Es gilt die 2G-PLUS-Regel.",,"Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","http://www.schillerhaus.rudolstadt.de/","+ 49 3672 / 486470",,,,,"50.720971023259","11.335229873657","1","0",,"1","1",,"1",
+,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","e-100354481","0",,"Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.
+Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420
+
+Bitte beachten Sie die derzeit geltenden Zugangsregeln.",,"Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","Deutschland","http://www.stadtbibliothek-rudolstadt.de/","0 36 72 - 48 64 20",,,,,"50.720835175056","11.342568397522","1","0",,"3","2",,"1",
+,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.
+
+Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","Deutschland",,"03672 - 48 96 13",,,,,"50.718688721183","11.327333450317","1","0",,"4","3",,"1",
+"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,,,,,,,,,,,,,,,,,,,,,,,,
+,"1","2","0","0","0","0",-1,0,"0","0","0","1","4101372000","4101377400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"2","2","0","0","0","0",-1,0,"0","0","0","2","4101112800","4101118200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"3","2","0","0","0","0",-1,0,"0","0","0","2","1642687200","1642694400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"4","2","0","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"5","2","0","0","0","0",-1,0,"0","0","0","3","4099831200","4099834800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"6","2","0","0","0","0",-1,0,"0","0","0","3","4100436000","4100439600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"7","2","0","0","0","0",-1,0,"0","0","0","3","4101040800","4101044400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"8","2","0","0","0","0",-1,0,"0","0","0","3","4101645600","4101649200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv
new file mode 100644
index 0000000..c1a68ec
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv
@@ -0,0 +1,28 @@
+"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email",,,,,,,,,,,,,,,,,,,,,,
+,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de",,,,,,,,,,,,,,,,,,,,,,
+,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de",,,,,,,,,,,,,,,,,,,,,,
+,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",,,,,,,,,,,,,,,,,,,,,,,,
+"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","slug","highlight","teaser","details","price_info","name","street","district","city","zip","country","web","phone","ticket","facebook","youtube","instagram","latitude","longitude","images","categories","pages","dates","organizer","partner","region","references_events"
+,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","e-100347853","0",,"Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.
+Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)
+Um Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten.
+Es gilt die 2G-PLUS-Regel.",,"Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","http://www.schillerhaus.rudolstadt.de/","+ 49 3672 / 486470",,,,,"50.720971023259","11.335229873657","1","0",,"1","1",,"0",
+,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","e-100354481","0",,"Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.
+Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420
+
+Bitte beachten Sie die derzeit geltenden Zugangsregeln.",,"Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","Deutschland","http://www.stadtbibliothek-rudolstadt.de/","0 36 72 - 48 64 20",,,,,"50.720835175056","11.342568397522","1","0",,"3","2",,"0",
+,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.
+
+Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","Deutschland",,"03672 - 48 96 13",,,,,"50.718688721183","11.327333450317","1","0",,"4","3",,"0",
+"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,,,,,,,,,,,,,,,,,,,,,,,,
+,"1","2","0","0","0","0",-1,0,"0","0","0","1","4101372000","4101377400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"2","2","0","0","0","0",-1,0,"0","0","0","2","4101112800","4101118200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"3","2","0","0","0","0",-1,0,"0","0","0","2","1642687200","1642694400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"4","2","0","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"5","2","0","0","0","0",-1,0,"0","0","0","3","4099831200","4099834800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"6","2","0","0","0","0",-1,0,"0","0","0","3","4100436000","4100439600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"7","2","0","0","0","0",-1,0,"0","0","0","3","4101040800","4101044400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"8","2","0","0","0","0",-1,0,"0","0","0","3","4101645600","4101649200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,
diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/ExampleImage.jpg b/Tests/Functional/Import/DestinationDataTest/Fixtures/ExampleImage.jpg
new file mode 100644
index 0000000..1db39e0
Binary files /dev/null and b/Tests/Functional/Import/DestinationDataTest/Fixtures/ExampleImage.jpg differ
diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months,12&limit=3&template=ET2014A.json b/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months,12&limit=3&template=ET2014A.json
new file mode 100644
index 0000000..327b365
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months,12&limit=3&template=ET2014A.json
@@ -0,0 +1,541 @@
+{
+ "status": "OK",
+ "count": 3,
+ "overallcount": 50,
+ "channels": [],
+ "facetGroups": [],
+ "items": [
+ {
+ "global_id": "e_100347853",
+ "id": "100347853",
+ "title": "Allerlei Weihnachtliches (Heute mit Johannes Geißer)",
+ "type": "Event",
+ "categories": [
+ "Weihnachten"
+ ],
+ "texts": [
+ {
+ "rel": "details",
+ "type": "text/html",
+ "value": "Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.
Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)
Um Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten.
Es gilt die 2G-PLUS-Regel.
"
+ },
+ {
+ "rel": "details",
+ "type": "text/plain",
+ "value": "Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.\nEintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)\nUm Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten.\nEs gilt die 2G-PLUS-Regel."
+ },
+ {
+ "rel": "teaser",
+ "type": "text/html"
+ },
+ {
+ "rel": "teaser",
+ "type": "text/plain"
+ }
+ ],
+ "country": "Deutschland",
+ "areas": [
+ "Rudolstadt und Umgebung"
+ ],
+ "city": "Rudolstadt",
+ "zip": "07407",
+ "street": "Schillerstraße 25",
+ "phone": "+ 49 3672 / 486470",
+ "fax": "+ 49 3672 / 486475",
+ "web": "http://www.schillerhaus.rudolstadt.de/",
+ "email": "schillerhaus@rudolstadt.de",
+ "author": "support@hubermedia.de",
+ "geo": {
+ "main": {
+ "latitude": 50.720971023258805,
+ "longitude": 11.335229873657227
+ },
+ "entry": [],
+ "attributes": []
+ },
+ "ratings": [
+ {
+ "type": "eT4",
+ "value": 40.0
+ },
+ {
+ "type": "order",
+ "value": 99.0001
+ }
+ ],
+ "cuisine_types": [],
+ "payment": [],
+ "media_objects": [
+ {
+ "rel": "venuewebsite",
+ "url": "http://schillerhaus.rudolstadt.de/",
+ "latitude": null,
+ "longitude": null,
+ "value": ""
+ },
+ {
+ "rel": "default",
+ "url": "https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg",
+ "type": "image/jpeg",
+ "latitude": null,
+ "longitude": null,
+ "width": 1920,
+ "height": 1080,
+ "value": "Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg"
+ }
+ ],
+ "keywords": [],
+ "timeIntervals": [
+ {
+ "weekdays": [],
+ "start": "2099-12-19T15:00:00+01:00",
+ "end": "2099-12-19T16:30:00+01:00",
+ "tz": "Europe/Berlin"
+ }
+ ],
+ "kitchenTimeIntervals": [],
+ "deliveryTimeIntervals": [],
+ "numbers": [],
+ "name": "Schillerhaus Rudolstadt",
+ "attributes": [
+ {
+ "key": "VO_Id",
+ "value": "100050775"
+ },
+ {
+ "key": "VO_CategoryName",
+ "value": "POI"
+ },
+ {
+ "key": "VA_Id",
+ "value": "100050775"
+ },
+ {
+ "key": "VA_CategoryName",
+ "value": "POI"
+ },
+ {
+ "key": "interval_first_match_start",
+ "value": "2099-12-19T15:00:00+01"
+ },
+ {
+ "key": "interval_first_match_end",
+ "value": "2099-12-19T16:30:00+01"
+ },
+ {
+ "key": "interval_match_count",
+ "value": "1"
+ }
+ ],
+ "features": [],
+ "addresses": [
+ {
+ "name": "Städtetourismus in Thüringen e.V.",
+ "city": "Weimar",
+ "zip": "99423",
+ "street": "UNESCO-Platz 1",
+ "phone": "+49 (3643) 745 314",
+ "web": "http://www.thueringer-staedte.de",
+ "email": "verein@thueringer-staedte.de",
+ "rel": "author"
+ },
+ {
+ "name": "Städtetourismus in Thüringen\" e.V.",
+ "web": "http://www.thueringer-staedte.de",
+ "email": "verein@thueringer-staedte.de",
+ "rel": "organisation"
+ },
+ {
+ "name": "Schillerhaus Rudolstadt",
+ "city": "Rudolstadt",
+ "zip": "07407",
+ "street": "Schillerstraße 25",
+ "phone": "+ 49 3672 / 486470",
+ "fax": "+ 49 3672 / 486475",
+ "web": "http://schillerhaus.rudolstadt.de",
+ "email": "schillerhaus@rudolstadt.de",
+ "rel": "organizer"
+ }
+ ],
+ "created": "2099-10-31T12:29:00+00:00",
+ "changed": "2099-12-14T08:29:00+00:00",
+ "source": {
+ "url": "http://destination.one/",
+ "value": "destination.one"
+ },
+ "company": "",
+ "district": "",
+ "postoffice": "",
+ "phone2": "",
+ "seasons": [],
+ "subitems": [],
+ "hyperObjects": []
+ },
+ {
+ "global_id": "e_100354481",
+ "id": "100354481",
+ "title": "Tüftlerzeit",
+ "type": "Event",
+ "categories": [
+ "Kinder"
+ ],
+ "texts": [
+ {
+ "rel": "details",
+ "type": "text/html",
+ "value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.
Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420
Bitte beachten Sie die derzeit geltenden Zugangsregeln."
+ },
+ {
+ "rel": "details",
+ "type": "text/plain",
+ "value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.\nVoranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420\n\nBitte beachten Sie die derzeit geltenden Zugangsregeln."
+ },
+ {
+ "rel": "teaser",
+ "type": "text/html"
+ },
+ {
+ "rel": "teaser",
+ "type": "text/plain"
+ }
+ ],
+ "country": "Deutschland",
+ "areas": [
+ "Rudolstadt und Umgebung"
+ ],
+ "city": "Rudolstadt",
+ "zip": "07407",
+ "street": "Schulplatz 13",
+ "phone": "0 36 72 - 48 64 20",
+ "fax": "0 36 72 - 48 64 30",
+ "web": "http://www.stadtbibliothek-rudolstadt.de/",
+ "email": "stadtbibliothek@rudolstadt.de",
+ "author": "support@hubermedia.de",
+ "geo": {
+ "main": {
+ "latitude": 50.720835175055917,
+ "longitude": 11.342568397521973
+ },
+ "entry": [],
+ "attributes": []
+ },
+ "ratings": [
+ {
+ "type": "eT4",
+ "value": 40.0
+ },
+ {
+ "type": "order",
+ "value": 99.0001
+ }
+ ],
+ "cuisine_types": [],
+ "payment": [],
+ "media_objects": [
+ {
+ "rel": "venuewebsite",
+ "url": "http://www.stadtbibliothek-rudolstadt.de/",
+ "latitude": null,
+ "longitude": null,
+ "value": ""
+ },
+ {
+ "rel": "default",
+ "url": "https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg",
+ "type": "image/jpeg",
+ "latitude": null,
+ "longitude": null,
+ "width": 1920,
+ "height": 1080,
+ "value": "Tueftlerzeit©SFZ-Rudolstadt.jpg"
+ }
+ ],
+ "keywords": [],
+ "timeIntervals": [
+ {
+ "weekdays": [],
+ "start": "2099-12-16T15:00:00+01:00",
+ "end": "2099-12-16T16:30:00+01:00",
+ "tz": "Europe/Berlin"
+ },
+ {
+ "weekdays": [],
+ "start": "2022-01-20T15:00:00+01:00",
+ "end": "2022-01-20T17:00:00+01:00",
+ "tz": "Europe/Berlin"
+ },
+ {
+ "weekdays": [],
+ "start": "2022-02-17T15:00:00+01:00",
+ "end": "2022-02-17T17:00:00+01:00",
+ "tz": "Europe/Berlin"
+ }
+ ],
+ "kitchenTimeIntervals": [],
+ "deliveryTimeIntervals": [],
+ "numbers": [],
+ "name": "Stadtbibliothek Rudolstadt",
+ "attributes": [
+ {
+ "key": "VO_Id",
+ "value": "100042570"
+ },
+ {
+ "key": "VO_CategoryName",
+ "value": "POI"
+ },
+ {
+ "key": "VA_Id",
+ "value": "100042570"
+ },
+ {
+ "key": "VA_CategoryName",
+ "value": "POI"
+ },
+ {
+ "key": "interval_first_match_start",
+ "value": "2099-12-16T15:00:00+01"
+ },
+ {
+ "key": "interval_first_match_end",
+ "value": "2099-12-16T16:30:00+01"
+ },
+ {
+ "key": "interval_match_count",
+ "value": "3"
+ },
+ {
+ "key": "interval_last_match_start",
+ "value": "2022-02-17T15:00:00+01"
+ },
+ {
+ "key": "interval_last_match_end",
+ "value": "2022-02-17T17:00:00+01"
+ }
+ ],
+ "features": [],
+ "addresses": [
+ {
+ "name": "Städtetourismus in Thüringen e.V.",
+ "city": "Weimar",
+ "zip": "99423",
+ "street": "UNESCO-Platz 1",
+ "phone": "+49 (3643) 745 314",
+ "web": "http://www.thueringer-staedte.de",
+ "email": "verein@thueringer-staedte.de",
+ "rel": "author"
+ },
+ {
+ "name": "Städtetourismus in Thüringen\" e.V.",
+ "web": "http://www.thueringer-staedte.de",
+ "email": "verein@thueringer-staedte.de",
+ "rel": "organisation"
+ },
+ {
+ "name": "Stadtbibliothek Rudolstadt",
+ "city": "Rudolstadt",
+ "zip": "07407",
+ "street": "Schulplatz 13",
+ "phone": "0 36 72 - 48 64 20",
+ "fax": "0 36 72 - 48 64 30",
+ "web": "http://www.stadtbibliothek-rudolstadt.de ",
+ "email": "stadtbibliothek@rudolstadt.de",
+ "rel": "organizer"
+ }
+ ],
+ "created": "2099-11-10T23:02:00+00:00",
+ "changed": "2099-12-14T08:28:00+00:00",
+ "source": {
+ "url": "http://destination.one/",
+ "value": "destination.one"
+ },
+ "company": "",
+ "district": "",
+ "postoffice": "",
+ "phone2": "",
+ "seasons": [],
+ "subitems": [],
+ "hyperObjects": []
+ },
+ {
+ "global_id": "e_100350503",
+ "id": "100350503",
+ "title": "Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",
+ "type": "Event",
+ "categories": [
+ "Konzerte, Festivals, Show & Tanz",
+ "Weihnachten"
+ ],
+ "texts": [
+ {
+ "rel": "details",
+ "type": "text/html",
+ "value": "Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.
Es gilt die 2G-PLUS-Regel.
"
+ },
+ {
+ "rel": "details",
+ "type": "text/plain",
+ "value": "Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.\n\nEs gilt die 2G-PLUS-Regel."
+ },
+ {
+ "rel": "teaser",
+ "type": "text/html"
+ },
+ {
+ "rel": "teaser",
+ "type": "text/plain"
+ }
+ ],
+ "country": "Deutschland",
+ "areas": [
+ "Rudolstadt und Umgebung"
+ ],
+ "city": "Rudolstadt",
+ "zip": "07407",
+ "street": "Caspar-Schulte-Straße",
+ "phone": "03672 - 48 96 13",
+ "author": "support@hubermedia.de",
+ "geo": {
+ "main": {
+ "latitude": 50.718688721182531,
+ "longitude": 11.327333450317383
+ },
+ "entry": [],
+ "attributes": []
+ },
+ "ratings": [
+ {
+ "type": "eT4",
+ "value": 40.0
+ },
+ {
+ "type": "order",
+ "value": 99.0001
+ }
+ ],
+ "cuisine_types": [],
+ "payment": [],
+ "media_objects": [
+ {
+ "rel": "default",
+ "url": "https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg",
+ "type": "image/jpeg",
+ "latitude": null,
+ "longitude": null,
+ "width": 1920,
+ "height": 1080,
+ "value": "Lutherkirche.jpg"
+ }
+ ],
+ "keywords": [],
+ "timeIntervals": [
+ {
+ "weekdays": [],
+ "start": "2099-12-01T19:00:00+01:00",
+ "end": "2099-12-01T20:00:00+01:00",
+ "tz": "Europe/Berlin"
+ },
+ {
+ "weekdays": [],
+ "start": "2099-12-08T19:00:00+01:00",
+ "end": "2099-12-08T20:00:00+01:00",
+ "tz": "Europe/Berlin"
+ },
+ {
+ "weekdays": [],
+ "start": "2099-12-15T19:00:00+01:00",
+ "end": "2099-12-15T20:00:00+01:00",
+ "tz": "Europe/Berlin"
+ },
+ {
+ "weekdays": [],
+ "start": "2099-12-22T19:00:00+01:00",
+ "end": "2099-12-22T20:00:00+01:00",
+ "tz": "Europe/Berlin"
+ }
+ ],
+ "kitchenTimeIntervals": [],
+ "deliveryTimeIntervals": [],
+ "numbers": [],
+ "name": "Lutherkirche",
+ "attributes": [
+ {
+ "key": "VO_Id",
+ "value": "100118350"
+ },
+ {
+ "key": "VO_CategoryName",
+ "value": "POI"
+ },
+ {
+ "key": "VA_Id",
+ "value": "100118350"
+ },
+ {
+ "key": "VA_CategoryName",
+ "value": "POI"
+ },
+ {
+ "key": "interval_first_match_start",
+ "value": "2099-12-15T19:00:00+01"
+ },
+ {
+ "key": "interval_first_match_end",
+ "value": "2099-12-15T20:00:00+01"
+ },
+ {
+ "key": "interval_match_count",
+ "value": "2"
+ },
+ {
+ "key": "interval_last_match_start",
+ "value": "2099-12-22T19:00:00+01"
+ },
+ {
+ "key": "interval_last_match_end",
+ "value": "2099-12-22T20:00:00+01"
+ }
+ ],
+ "features": [],
+ "addresses": [
+ {
+ "name": "Städtetourismus in Thüringen e.V.",
+ "city": "Weimar",
+ "zip": "99423",
+ "street": "UNESCO-Platz 1",
+ "phone": "+49 (3643) 745 314",
+ "web": "http://www.thueringer-staedte.de",
+ "email": "verein@thueringer-staedte.de",
+ "rel": "author"
+ },
+ {
+ "name": "Städtetourismus in Thüringen\" e.V.",
+ "web": "http://www.thueringer-staedte.de",
+ "email": "verein@thueringer-staedte.de",
+ "rel": "organisation"
+ },
+ {
+ "name": "Lutherkirche",
+ "city": "Rudolstadt",
+ "zip": "07407",
+ "street": "Caspar-Schulte-Straße",
+ "phone": "03672 - 48 96 13",
+ "rel": "organizer"
+ }
+ ],
+ "created": "2099-11-08T22:15:00+00:00",
+ "changed": "2099-12-14T08:38:00+00:00",
+ "source": {
+ "url": "http://destination.one/",
+ "value": "destination.one"
+ },
+ "company": "",
+ "district": "",
+ "postoffice": "",
+ "phone2": "",
+ "seasons": [],
+ "subitems": [],
+ "hyperObjects": []
+ }
+ ]
+}
diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/SingleRegion.xml b/Tests/Functional/Import/DestinationDataTest/Fixtures/SingleRegion.xml
new file mode 100644
index 0000000..414b803
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/SingleRegion.xml
@@ -0,0 +1,9 @@
+
+
+
+ 1
+ 2
+ Example Region
+
+
+
diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Structure.xml b/Tests/Functional/Import/DestinationDataTest/Fixtures/Structure.xml
new file mode 100644
index 0000000..f546a4b
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Structure.xml
@@ -0,0 +1,16 @@
+
+
+
+ 0
+ 1
+ Root page
+ 1
+
+
+ 1
+ 2
+ Storage
+ 254
+
+
+
diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php
new file mode 100644
index 0000000..c7b466c
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php
@@ -0,0 +1,104 @@
+importDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Fixtures/SingleRegion.xml');
+ $this->setUpFrontendRootPage(1, [], [
+ 'config' => implode(PHP_EOL, [
+ 'module.tx_events_pi1.settings.destinationData {',
+ 'restUrl = ' . $this->getInstancePath() . '/typo3conf/ext/events/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json',
+ 'license = example-license',
+ 'restType = Event',
+ 'restLimit = 3',
+ 'restMode = next_months,12',
+ 'restTemplate = ET2014A.json',
+ 'categoriesPid = ',
+ 'categoryParentUid = ',
+ '}',
+ ]),
+ ]);
+
+ $requests = [];
+ $client = ClientFactory::createClientWithHistory([
+ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
+ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
+ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
+ ], $requests);
+ $container = $this->getContainer();
+ if ($container instanceof Container) {
+ $container->set(ClientInterface::class, $client);
+ // For TYPO3 10 support
+ $container->set(GuzzleClientInterface::class, $client);
+ }
+
+ $subject = $this->getContainer()->get(DestinationDataImportCommand::class);
+ self::assertInstanceOf(Command::class, $subject);
+
+ $tester = new CommandTester($subject);
+ $tester->execute(
+ [
+ 'storage-pid' => 2,
+ 'rest-experience' => 'beispielstadt',
+ 'files-folder' => $fileImportPath,
+ 'region-uid' => 1,
+ ],
+ [
+ 'capture_stderr_separately' => true,
+ ]
+ );
+
+ self::assertSame(0, $tester->getStatusCode());
+
+ self::assertCount(3, $requests, 'Unexpected number of requests were made.');
+ self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[0]['request']->getUri());
+ self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[1]['request']->getUri());
+ self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[2]['request']->getUri());
+
+ self::assertCount(
+ 0,
+ $this->getAllRecords('tx_events_domain_model_partner'),
+ 'Added unexpected partners.'
+ );
+ self::assertCount(
+ 1,
+ $this->getAllRecords('tx_events_domain_model_region'),
+ 'Added or removed unexpected region.'
+ );
+ $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv');
+
+
+ $importedFiles = GeneralUtility::getFilesInDir($this->getInstancePath() . '/fileadmin/' . $fileImportPath);
+ self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
+ self::assertSame(
+ [
+ 'lutherkirche-jpg.jpg',
+ 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg',
+ 'tueftlerzeit-sfz-rudolstadt-jpg.jpg',
+ ],
+ array_values($importedFiles),
+ 'Got unexpected number of files'
+ );
+ }
+}
diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php
new file mode 100644
index 0000000..c09e09f
--- /dev/null
+++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php
@@ -0,0 +1,101 @@
+setUpFrontendRootPage(1, [], [
+ 'config' => implode(PHP_EOL, [
+ 'module.tx_events_pi1.settings.destinationData {',
+ 'restUrl = ' . $this->getInstancePath() . '/typo3conf/ext/events/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json',
+ 'license = example-license',
+ 'restType = Event',
+ 'restLimit = 3',
+ 'restMode = next_months,12',
+ 'restTemplate = ET2014A.json',
+ 'categoriesPid = ',
+ 'categoryParentUid = ',
+ '}',
+ ]),
+ ]);
+
+ $requests = [];
+ $client = ClientFactory::createClientWithHistory([
+ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
+ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
+ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
+ ], $requests);
+ $container = $this->getContainer();
+ if ($container instanceof Container) {
+ $container->set(ClientInterface::class, $client);
+ // For TYPO3 10 support
+ $container->set(GuzzleClientInterface::class, $client);
+ }
+
+ $subject = $this->getContainer()->get(DestinationDataImportCommand::class);
+ self::assertInstanceOf(Command::class, $subject);
+
+ $tester = new CommandTester($subject);
+ $tester->execute(
+ [
+ 'storage-pid' => 2,
+ 'rest-experience' => 'beispielstadt',
+ 'files-folder' => $fileImportPath,
+ ],
+ [
+ 'capture_stderr_separately' => true,
+ ]
+ );
+
+ self::assertSame(0, $tester->getStatusCode());
+
+ self::assertCount(3, $requests, 'Unexpected number of requests were made.');
+ self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[0]['request']->getUri());
+ self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[1]['request']->getUri());
+ self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[2]['request']->getUri());
+
+ self::assertCount(
+ 0,
+ $this->getAllRecords('tx_events_domain_model_partner'),
+ 'Added unexpected partners.'
+ );
+ self::assertCount(
+ 0,
+ $this->getAllRecords('tx_events_domain_model_region'),
+ 'Added unexpected region.'
+ );
+ $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv');
+
+
+ $importedFiles = GeneralUtility::getFilesInDir($this->getInstancePath() . '/fileadmin/' . $fileImportPath);
+ self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
+ self::assertSame(
+ [
+ 'lutherkirche-jpg.jpg',
+ 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg',
+ 'tueftlerzeit-sfz-rudolstadt-jpg.jpg',
+ ],
+ array_values($importedFiles),
+ 'Got unexpected number of files'
+ );
+ }
+}
diff --git a/composer.json b/composer.json
index 565d057..aa95fa4 100644
--- a/composer.json
+++ b/composer.json
@@ -7,6 +7,11 @@
{
"name": "Dirk Koritnik",
"role": "Developer"
+ },
+ {
+ "name": "Daniel Siepmann",
+ "email": "coding@daniel-siepmann.de",
+ "role": "Developer"
}
],
"require": {
@@ -26,6 +31,12 @@
"Wrm\\Events\\Tests\\": "Tests"
}
},
+ "scripts": {
+ "post-autoload-dump": [
+ "mkdir -p .Build/web/typo3conf/ext/",
+ "[ -L .Build/web/typo3conf/ext/events ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/events"
+ ]
+ },
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
@@ -39,6 +50,10 @@
"symplify/easy-coding-standard": "^9.4",
"phpstan/phpstan": "^1.0",
"phpstan/extension-installer": "^1.1",
- "saschaegerer/phpstan-typo3": "^1.0"
+ "saschaegerer/phpstan-typo3": "^1.0",
+ "typo3/testing-framework": "^6.14",
+ "jangregor/phpstan-prophecy": "^1.0",
+ "phpstan/phpstan-phpunit": "^1.0",
+ "guzzlehttp/guzzle": "^6.3 || ^7.3"
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..45aeb7e
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,29 @@
+
+
+
+
+
+ Tests/Functional/
+
+
+
+
+
+
+