Add first functional tests for import

To ensure the whole process is still working.
Setup environment and execute request of backend module through extbase.

Ensure expected records are created.
This commit is contained in:
Daniel Siepmann 2021-02-16 17:12:47 +01:00
parent 6478526004
commit 46144de0a7
18 changed files with 708 additions and 2 deletions

View file

@ -0,0 +1,19 @@
HTTP/1.1 200 OK
Date: Wed, 17 Feb 2021 08:03:49 GMT
Content-Type: application/ld+json; charset=utf-8
Content-Length: 2991
Connection: keep-alive
Set-Cookie: ahSession=583c8431692277a32ae3b9a37db1b53955b64107;path=/;expires=Sat, 20 Mar 2021 08:03:06 GMT;httpOnly=true;
Access-Control-Allow-Methods: HEAD, GET, POST, DELETE, OPTIONS
Access-Control-Allow-Headers: Authorization, Content-Type
Strict-Transport-Security: max-age=15724800; includeSubDomains
Access-Control-Allow-Credentials: true
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Feature-Policy: microphone 'none'; camera 'none'; payment 'none'
Content-Security-Policy: default-src 'self'; script-src 'self' 'sha256-xfTbtWk8kVI65iLJs8LB3lWf2g0g10DS71pDdoutFHc='; style-src 'self' 'unsafe-inline' https://stackpath.bootstrapcdn.com; img-src 'self' data: blob: *
Access-Control-Allow-Origin: https://cdb.thuecat.org
{"@context":{"schema":"http://schema.org/","dbo":"http://dbpedia.org/ontology/","dsv":"http://ontologies.sti-innsbruck.at/dsv/","foaf":"http://xmlns.com/foaf/0.1/","owl":"http://www.w3.org/2002/07/owl#","rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","sh":"http://www.w3.org/ns/shacl#","xsd":"http://www.w3.org/2001/XMLSchema#","ttgds":"https://thuecat.org/ontology/ttgds/1.0/","cdb":"https://thuecat.org/ontology/cdb/1.0/","dachkg":"https://thuecat.org/ontology/dachkg/1.0/","thuecat":"https://thuecat.org/ontology/thuecat/1.0/"},"@graph":[{"@id":"https://thuecat.org/resources/dms_5159186","@type":["schema:CreativeWork","schema:MediaObject","schema:Thing","schema:ImageObject","http://purl.org/dc/dcmitype/Image"],"rdfs:label":{"@language":"de","@value":"Erfurt-Dom-und-Severikirche.jpg"},"schema:width":{"@type":"xsd:string","@value":"3614"},"schema:description":{"@language":"de","@value":"Sicht auf Dom St. Marien, St. Severikirche sowie die davor liegenden Klostergebäude und einem Ausschnitt des Biergartens umgeben von einem dämmerungsverfärten Himmel"},"schema:sameAs":{"@type":"xsd:anyURI","@value":"https://wbk.thuecat.org"},"schema:identifier":{"@type":"schema:PropertyValue","@value":"5159186"},"schema:keywords":[{"@type":"xsd:string","@value":"Kultur und Geschichte"},{"@type":"xsd:string","@value":"Gebäude / Architektur"},{"@type":"xsd:string","@value":"Bauwerk"},{"@type":"xsd:string","@value":"Erfurt"},{"@type":"xsd:string","@value":"Abenddämmerung"},{"@type":"xsd:string","@value":"Halbtotale"},{"@type":"xsd:string","@value":"Gegenlicht"},{"@type":"xsd:string","@value":"Herbst"},{"@type":"xsd:string","@value":"domplatz"},{"@type":"xsd:string","@value":"Gruppenreisende"},{"@type":"xsd:string","@value":"Kennerschaft - Konservativ-Etabliertes Milieu"}],"schema:name":{"@language":"de","@value":"Erfurt-Dom-und-Severikirche.jpg"},"schema:copyrightYear":{"@language":"de","@value":"2020"},"schema:height":{"@type":"xsd:string","@value":"2160"},"schema:bitrate":{"@type":"xsd:string","@value":"8"},"schema:exifData":{"@id":"genid-2baad45f571f4196811b62a1b4e4027f-b0","@type":["schema:Intangible","schema:StructuredValue","schema:Thing","schema:PropertyValue"],"rdfs:label":{"@type":"xsd:string","@value":"tiff:Software"},"schema:name":{"@type":"xsd:string","@value":"tiff:Software"},"schema:value":{"@type":"xsd:string","@value":"Google"}},"schema:thumbnailUrl":{"@type":"xsd:string","@value":"https://cms.thuecat.org/o/adaptive-media/image/5159186/Thumbnail-300x300/image"},"schema:url":{"@type":"xsd:anyURI","@value":"https://cms.thuecat.org/o/adaptive-media/image/5159186/Preview-1280x0/image"},"schema:license":{"@language":"de","@value":"https://creativecommons.org/licenses/by/4.0/"},"thuecat:licenseAuthor":{"@language":"de","@value":""},"thuecat:licenseLocation":{"@language":"de","@value":""},"thuecat:licensePeriod":{"@language":"de","@value":""},"thuecat:licensePerson":{"@language":"de","@value":""}}]}

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>10</uid>
<pid>0</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<doktype>254</doktype>
<title>Storage folder</title>
</pages>
<tx_thuecat_import_configuration>
<uid>1</uid>
<pid>0</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<disable>0</disable>
<title>Single Fresh Organisation</title>
<type>static</type>
<configuration><![CDATA[<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
<data>
<sheet index="sDEF">
<language index="lDEF">
<field index="urls">
<el index="el">
<field index="602a89e212237114263881">
<value index="url">
<el>
<field index="url">
<value index="vDEF">https://thuecat.org/resources/018132452787-ngbe</value>
</field>
</el>
</value>
<value index="_TOGGLE">0</value>
</field>
</el>
</field>
</language>
</sheet>
</data>
</T3FlexForms>
]]></configuration>
</tx_thuecat_import_configuration>
</dataset>

View file

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>10</uid>
<pid>0</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<doktype>254</doktype>
<title>Storage folder</title>
</pages>
<tx_thuecat_import_configuration>
<uid>1</uid>
<pid>0</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<disable>0</disable>
<title>Three tourist attractions</title>
<type>static</type>
<configuration><![CDATA[<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
<data>
<sheet index="sDEF">
<language index="lDEF">
<field index="urls">
<el index="el">
<field index="602a89f54d694654233086">
<value index="url">
<el>
<field index="url">
<value index="vDEF">https://thuecat.org/resources/835224016581-dara</value>
</field>
</el>
</value>
<value index="_TOGGLE">0</value>
</field>
<field index="602a89f5e6c52907080672">
<value index="url">
<el>
<field index="url">
<value index="vDEF">https://thuecat.org/resources/165868194223-zmqf</value>
</field>
</el>
</value>
<value index="_TOGGLE">0</value>
</field>
<field index="602a89f693965223334077">
<value index="url">
<el>
<field index="url">
<value index="vDEF">https://thuecat.org/resources/215230952334-yyno</value>
</field>
</el>
</value>
<value index="_TOGGLE">0</value>
</field>
</el>
</field>
</language>
</sheet>
</data>
</T3FlexForms>
]]></configuration>
</tx_thuecat_import_configuration>
<tx_thuecat_town>
<uid>1</uid>
<pid>10</pid>
<tstamp>1613401129</tstamp>
<crdate>1613401129</crdate>
<cruser_id>1</cruser_id>
<disable>0</disable>
<remote_id>https://thuecat.org/resources/043064193523-jcyt</remote_id>
<managed_by>1</managed_by>
<tourist_information>0</tourist_information>
<title>Erfurt</title>
</tx_thuecat_town>
<tx_thuecat_organisation>
<uid>1</uid>
<pid>10</pid>
<tstamp>1613400969</tstamp>
<crdate>1613400969</crdate>
<cruser_id>1</cruser_id>
<disable>0</disable>
<remote_id>https://thuecat.org/resources/018132452787-ngbe</remote_id>
<title>Erfurt Tourismus und Marketing GmbH</title>
<description>Die Erfurt Tourismus &amp; Marketing GmbH (ETMG) wurde 1997 als offizielle Organisation zur Tourismusförderung in der Landeshauptstadt Erfurt gegründet und nahm am 01.0 1.1998 die Geschäftstätigkeit auf.</description>
<manages_towns>0</manages_towns>
<manages_tourist_information>0</manages_tourist_information>
</tx_thuecat_organisation>
</dataset>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>10</uid>
<pid>0</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<doktype>254</doktype>
<title>Storage folder</title>
</pages>
<tx_thuecat_import_configuration>
<uid>1</uid>
<pid>0</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<disable>0</disable>
<title>Single Fresh Organisation</title>
<type>static</type>
<configuration><![CDATA[<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
<data>
<sheet index="sDEF">
<language index="lDEF">
<field index="urls">
<el index="el">
<field index="602a89e212237114263881">
<value index="url">
<el>
<field index="url">
<value index="vDEF">https://thuecat.org/resources/018132452787-ngbe</value>
</field>
</el>
</value>
<value index="_TOGGLE">0</value>
</field>
</el>
</field>
</language>
</sheet>
</data>
</T3FlexForms>
]]></configuration>
</tx_thuecat_import_configuration>
<tx_thuecat_organisation>
<uid>1</uid>
<pid>10</pid>
<tstamp>1613400587</tstamp>
<crdate>1613400558</crdate>
<cruser_id>1</cruser_id>
<disable>0</disable>
<remote_id>https://thuecat.org/resources/018132452787-ngbe</remote_id>
<title>Old title</title>
</tx_thuecat_organisation>
</dataset>

View file

@ -0,0 +1,274 @@
<?php
namespace WerkraumMedia\ThueCat\Tests\Functional;
/*
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Csa\GuzzleHttp\Middleware\Cache\Adapter\MockStorageAdapter;
use Csa\GuzzleHttp\Middleware\Cache\MockMiddleware;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Routing\Route;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Extbase\Core\Bootstrap;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
/**
* @covers WerkraumMedia\ThueCat\Controller\Backend\AbstractController
* @covers WerkraumMedia\ThueCat\Controller\Backend\ImportController
* @covers WerkraumMedia\ThueCat\DependencyInjection\ConverterPass
* @covers WerkraumMedia\ThueCat\DependencyInjection\UrlProvidersPass
* @covers WerkraumMedia\ThueCat\Domain\Import\Importer\SaveData
* @covers WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportLogRepository
* @covers WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository
* @covers WerkraumMedia\ThueCat\Domain\Repository\Backend\TownRepository
* @covers WerkraumMedia\ThueCat\Extension
* @covers WerkraumMedia\ThueCat\Typo3Wrapper\TranslationService
* @covers WerkraumMedia\ThueCat\View\Backend\Menu
*
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\Organisation
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\Registry
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\TouristAttraction
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\TouristInformation
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\Town
* @uses WerkraumMedia\ThueCat\Domain\Import\Importer
* @uses WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Address
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @uses WerkraumMedia\ThueCat\Domain\Import\RequestFactory
* @uses WerkraumMedia\ThueCat\Domain\Import\UrlProvider\Registry
* @uses WerkraumMedia\ThueCat\Domain\Import\UrlProvider\StaticUrlProvider
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLogEntry
*
* @testdox The import
*/
class ImportTest extends TestCase
{
use ProphecyTrait;
protected $coreExtensionsToLoad = [
'core',
'backend',
'extbase',
'frontend',
];
protected $testExtensionsToLoad = [
'typo3conf/ext/thuecat/',
];
protected function setUp(): void
{
parent::setUp();
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']['recorder'] = new MockMiddleware(
new MockStorageAdapter(
__DIR__ . '/Fixtures/Import/Guzzle/'
),
// Set to 'record' to record requests and create fixtures.
'',
true
);
$this->setUpBackendUserFromFixture(1);
$GLOBALS['LANG'] = $this->getContainer()->get(LanguageService::class);
// We are NOT in cli (simulate backend request environment)
Environment::initialize(
Environment::getContext(),
false,
Environment::isComposerMode(),
Environment::getProjectPath(),
Environment::getPublicPath(),
Environment::getVarPath(),
Environment::getConfigPath(),
Environment::getCurrentScript(),
'UNIX'
);
}
protected function tearDown(): void
{
unset($GLOBALS['LANG']);
unset($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']['recorder']);
unset($GLOBALS['TYPO3_REQUEST']);
$_GET = [];
parent::tearDown();
}
/**
* @test
*/
public function importsFreshOrganization(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/Import/ImportsFreshOrganization.xml');
$serverRequest = $this->getServerRequest();
$extbaseBootstrap = $this->getContainer()->get(Bootstrap::class);
$extbaseBootstrap->handleBackendRequest($serverRequest->reveal());
$organisations = $this->getAllRecords('tx_thuecat_organisation');
self::assertCount(1, $organisations);
self::assertSame('https://thuecat.org/resources/018132452787-ngbe', $organisations[0]['remote_id']);
self::assertSame('Erfurt Tourismus und Marketing GmbH', $organisations[0]['title']);
self::assertSame('1', $organisations[0]['uid']);
$importLogs = $this->getAllRecords('tx_thuecat_import_log');
self::assertCount(1, $importLogs);
self::assertSame('1', $importLogs[0]['configuration']);
self::assertSame('1', $importLogs[0]['uid']);
$importLogEntries = $this->getAllRecords('tx_thuecat_import_log_entry');
self::assertCount(1, $importLogEntries);
self::assertSame('1', $importLogEntries[0]['import_log']);
self::assertSame('1', $importLogEntries[0]['record_uid']);
self::assertSame('tx_thuecat_organisation', $importLogEntries[0]['table_name']);
self::assertSame('1', $importLogEntries[0]['insertion']);
self::assertSame('[]', $importLogEntries[0]['errors']);
}
/**
* @test
*/
public function updatesExistingOrganization(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/Import/UpdatesExistingOrganization.xml');
$serverRequest = $this->getServerRequest();
$extbaseBootstrap = $this->getContainer()->get(Bootstrap::class);
$extbaseBootstrap->handleBackendRequest($serverRequest->reveal());
$organisations = $this->getAllRecords('tx_thuecat_organisation');
self::assertCount(1, $organisations);
self::assertSame('https://thuecat.org/resources/018132452787-ngbe', $organisations[0]['remote_id']);
self::assertSame('Erfurt Tourismus und Marketing GmbH', $organisations[0]['title']);
self::assertSame('1', $organisations[0]['uid']);
$importLogs = $this->getAllRecords('tx_thuecat_import_log');
self::assertCount(1, $importLogs);
self::assertSame('1', $importLogs[0]['configuration']);
self::assertSame('1', $importLogs[0]['uid']);
$importLogEntries = $this->getAllRecords('tx_thuecat_import_log_entry');
self::assertCount(1, $importLogEntries);
self::assertSame('1', $importLogEntries[0]['import_log']);
self::assertSame('1', $importLogEntries[0]['record_uid']);
self::assertSame('tx_thuecat_organisation', $importLogEntries[0]['table_name']);
self::assertSame('0', $importLogEntries[0]['insertion']);
self::assertSame('[]', $importLogEntries[0]['errors']);
}
/**
* @test
*/
public function importsTouristAttractionsWithRelations(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/Import/ImportsTouristAttractionsWithRelations.xml');
$serverRequest = $this->getServerRequest();
$extbaseBootstrap = $this->getContainer()->get(Bootstrap::class);
$extbaseBootstrap->handleBackendRequest($serverRequest->reveal());
$touristAttractions = $this->getAllRecords('tx_thuecat_tourist_attraction');
self::assertCount(3, $touristAttractions);
self::assertSame('https://thuecat.org/resources/835224016581-dara', $touristAttractions[0]['remote_id']);
self::assertSame('Dom St. Marien', $touristAttractions[0]['title']);
self::assertSame('[{"opens":"09:30:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Friday","Monday","Saturday","Thursday","Tuesday","Wednesday"]},{"opens":"13:00:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]},{"opens":"09:30:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Friday","Monday","Saturday","Thursday","Tuesday","Wednesday"]},{"opens":"13:00:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]}]', $touristAttractions[0]['opening_hours']);
self::assertSame('{"street":"Domstufen 1","zip":"99084","city":"Erfurt","email":"dominformation@domberg-erfurt.de","phone":"+49 361 6461265","fax":"","geo":{"latitude":50.975955358589545,"longitude":11.023667024961856}}', $touristAttractions[0]['address']);
self::assertSame('[{"mainImage":true,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom-und-Severikirche.jpg","description":"Sicht auf Dom St. Marien, St. Severikirche sowie die davor liegenden Klostergeb\u00e4ude und einem Ausschnitt des Biergartens umgeben von einem d\u00e4mmerungsverf\u00e4rten Himmel","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159186\/Preview-1280x0\/image","copyrightYear":2020,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}}]', $touristAttractions[0]['media']);
self::assertSame('1', $touristAttractions[0]['managed_by']);
self::assertSame('1', $touristAttractions[0]['town']);
self::assertSame('1', $touristAttractions[0]['uid']);
self::assertSame('https://thuecat.org/resources/165868194223-zmqf', $touristAttractions[1]['remote_id']);
self::assertSame('Alte Synagoge', $touristAttractions[1]['title']);
self::assertSame('[{"opens":"10:00:00","closes":"18:00:00","from":{"date":"2021-03-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-12-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Friday","Saturday","Sunday","Thursday","Tuesday","Wednesday"]}]', $touristAttractions[1]['opening_hours']);
self::assertSame('{"street":"Waagegasse 8","zip":"99084","city":"Erfurt","email":"altesynagoge@erfurt.de","phone":"+49 361 6551520","fax":"+49 361 6551669","geo":{"latitude":50.978765,"longitude":11.029133}}', $touristAttractions[1]['address']);
self::assertSame('[{"mainImage":true,"type":"image","title":"Erfurt-Alte Synagoge","description":"Frontaler Blick auf die Hausfront\/Hausfassade im Innenhof mit Zugang \u00fcber die Waagegasse","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5099196\/Preview-1280x0\/image","copyrightYear":2009,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":"F:\\\\Bilddatenbank\\\\Museen und Ausstellungen\\\\Alte Synagoge"}},{"mainImage":false,"type":"image","title":"Erfurt-Alte Synagoge","description":"Frontaler Blick auf die Hausfront\/Hausfassade im Innenhof mit Zugang \u00fcber die Waagegasse","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5099196\/Preview-1280x0\/image","copyrightYear":2009,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":"F:\\\\Bilddatenbank\\\\Museen und Ausstellungen\\\\Alte Synagoge"}}]', $touristAttractions[1]['media']);
self::assertSame('1', $touristAttractions[1]['managed_by']);
self::assertSame('1', $touristAttractions[1]['town']);
self::assertSame('2', $touristAttractions[1]['uid']);
self::assertSame('https://thuecat.org/resources/215230952334-yyno', $touristAttractions[2]['remote_id']);
self::assertSame('Krämerbrücke', $touristAttractions[2]['title']);
self::assertSame('[]', $touristAttractions[2]['opening_hours']);
self::assertSame('{"street":"Benediktsplatz 1","zip":"99084","city":"Erfurt","email":"service@erfurt-tourismus.de","phone":"+49 361 66 400","fax":"","geo":{"latitude":50.978772,"longitude":11.031622}}', $touristAttractions[2]['address']);
self::assertSame('[{"mainImage":true,"type":"image","title":"Erfurt-Kraemerbruecke-11.jpg","description":"Kr\u00e4merbr\u00fccke in Erfurt","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/134362\/Preview-1280x0\/image","copyrightYear":2019,"license":{"type":"https:\/\/creativecommons.org\/publicdomain\/zero\/1.0\/deed.de","author":"https:\/\/home.ttgnet.de\/ttg\/projekte\/10006\/90136\/Projektdokumente\/Vergabe%20Rahmenvertrag%20Fotoproduktion"}},{"mainImage":false,"type":"image","title":"Erfurt-Kraemerbruecke.jpg","description":"Kr\u00e4merbr\u00fccke in Erfurt","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/134288\/Preview-1280x0\/image","copyrightYear":2019,"license":{"type":"https:\/\/creativecommons.org\/publicdomain\/zero\/1.0\/deed.de","author":"https:\/\/home.ttgnet.de\/ttg\/projekte\/10006\/90136\/Projektdokumente\/Vergabe%20Rahmenvertrag%20Fotoproduktion"}},{"mainImage":false,"type":"image","title":"Erfurt-Kraemerbruecke-11.jpg","description":"Kr\u00e4merbr\u00fccke in Erfurt","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/134362\/Preview-1280x0\/image","copyrightYear":2019,"license":{"type":"https:\/\/creativecommons.org\/publicdomain\/zero\/1.0\/deed.de","author":"https:\/\/home.ttgnet.de\/ttg\/projekte\/10006\/90136\/Projektdokumente\/Vergabe%20Rahmenvertrag%20Fotoproduktion"}},{"mainImage":false,"type":"image","title":"Erfurt-Kraemerbruecke-13.jpg","description":"Ansicht der Kr\u00e4merbr\u00fccke, Erfurt","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/652340\/Preview-1280x0\/image","copyrightYear":2019,"license":{"type":"https:\/\/creativecommons.org\/publicdomain\/zero\/1.0\/deed.de","author":"https:\/\/home.ttgnet.de\/ttg\/projekte\/10006\/90136\/Projektdokumente\/Vergabe%20Rahmenvertrag%20Fotoproduktion"}}]', $touristAttractions[2]['media']);
self::assertSame('1', $touristAttractions[2]['managed_by']);
self::assertSame('1', $touristAttractions[2]['town']);
self::assertSame('3', $touristAttractions[2]['uid']);
}
/**
* @return ObjectProphecy<ServerRequestInterface>
*/
private function getServerRequest(): ObjectProphecy
{
$route = $this->prophesize(Route::class);
$route->getOption('moduleConfiguration')->willReturn([
'access' => 'user,group',
'labels' => 'LLL:EXT:thuecat/Resources/Private/Language/locallang_mod.xlf',
'name' => 'site_ThuecatThuecat',
'extensionName' => 'Thuecat',
'routeTarget' => 'TYPO3\CMS\Extbase\Core\Bootstrap::handleBackendRequest',
'iconIdentifier' => 'module-site_ThuecatThuecat',
]);
$route->getOption('module')->willReturn(true);
$route->getOption('moduleName')->willReturn('site_ThuecatThuecat');
$route->getOption('access')->willReturn('user,group');
$route->getOption('target')->willReturn('TYPO3\CMS\Extbase\Core\Bootstrap::handleBackendRequest');
$route->getOption('_identifier')->willReturn('site_ThuecatThuecat');
$serverRequest = $this->prophesize(ServerRequestInterface::class);
$serverRequest->getAttribute('route')->willReturn($route->reveal());
$serverRequest->getAttribute('routing')->willReturn(null);
$serverRequest->getAttribute('normalizedParams')->willReturn(null);
$serverRequest->getMethod()->willReturn('GET');
$serverRequest->getParsedBody()->willReturn([]);
$serverRequest->getQueryParams()->willReturn([
'tx_thuecat_site_thuecatthuecat' => [
'controller' => 'Backend\Import',
'action' => 'import',
'importConfiguration' => '1',
],
]);
$GLOBALS['TYPO3_REQUEST'] = $serverRequest->reveal();
// As long as extbase uri builder uses GeneralUtility::_GP
$_GET['route'] = '/module/site/ThuecatThuecat';
return $serverRequest;
}
}

View file

@ -39,6 +39,7 @@
"typo3/cms-frontend": "^10.4"
},
"require-dev": {
"csa/guzzle-cache-middleware": "^1.0",
"friendsoftypo3/phpstan-typo3": "^0.6.0",
"jangregor/phpstan-prophecy": "^0.8.1",
"maglnet/composer-require-checker": "^2.1",
@ -51,7 +52,8 @@
},
"scripts": {
"post-autoload-dump": [
"TYPO3\\TestingFramework\\Composer\\ExtensionTestEnvironment::prepare"
"mkdir -p .Build/web/typo3conf/ext/",
"[ -L .Build/web/typo3conf/ext/thuecat ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/thuecat"
]
},
"config": {

View file

@ -9,7 +9,7 @@
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
forceCoversAnnotation="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
@ -22,6 +22,9 @@
<testsuite name="unit">
<directory>Tests/Unit/</directory>
</testsuite>
<testsuite name="functional">
<directory>Tests/Functional/</directory>
</testsuite>
</testsuites>
<coverage>