De-duplicate code within functional tests (#28)

This commit is contained in:
Daniel Siepmann 2023-07-04 10:11:26 +02:00 committed by GitHub
parent 0f7323eac3
commit 0ca95bc410
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 48 additions and 180 deletions

View file

@ -72,7 +72,7 @@ Fixes
Tasks Tasks
----- -----
Nothing * De-duplicate code within functional tests.
Deprecation Deprecation
----------- -----------

View file

@ -16,4 +16,13 @@ abstract class AbstractTest extends AbstractFunctionalTestCase
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/Structure.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/Structure.php');
} }
protected function assertEmptyLog(): void
{
self::assertFileEquals(
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
}
} }

View file

@ -59,10 +59,6 @@ class ImportCleansTransientFilesTest extends AbstractTest
self::assertIsArray($transientFiles, 'Failed to retrieve transient files from filesystem.'); self::assertIsArray($transientFiles, 'Failed to retrieve transient files from filesystem.');
self::assertCount(0, $transientFiles, 'Got unexpected number of files'); self::assertCount(0, $transientFiles, 'Got unexpected number of files');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -16,10 +16,6 @@ class ImportDoesNotUseUploadsFolderTest extends AbstractTest
*/ */
public function doesNotUseUploadsFolder(): void public function doesNotUseUploadsFolder(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php');
$this->setUpConfiguration([ $this->setUpConfiguration([
'restUrl = https://example.com/some-path/', 'restUrl = https://example.com/some-path/',
@ -46,7 +42,7 @@ class ImportDoesNotUseUploadsFolderTest extends AbstractTest
self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri());
self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri());
$importedFiles = GeneralUtility::getFilesInDir($fileImportPath); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath);
self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
self::assertSame( self::assertSame(
[ [
@ -60,10 +56,6 @@ class ImportDoesNotUseUploadsFolderTest extends AbstractTest
self::assertFalse(file_exists(Environment::getPublicPath() . '/uploads/tx_events/'), 'Uploads folder exists.'); self::assertFalse(file_exists(Environment::getPublicPath() . '/uploads/tx_events/'), 'Uploads folder exists.');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -3,7 +3,6 @@
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest; namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class ImportDoesntBreakWithLongFileTitleTest extends AbstractTest class ImportDoesntBreakWithLongFileTitleTest extends AbstractTest
{ {
@ -12,10 +11,6 @@ class ImportDoesntBreakWithLongFileTitleTest extends AbstractTest
*/ */
public function importsExampleAsExpected(): void public function importsExampleAsExpected(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php');
@ -38,10 +33,6 @@ class ImportDoesntBreakWithLongFileTitleTest extends AbstractTest
self::assertSame(0, $tester->getStatusCode()); self::assertSame(0, $tester->getStatusCode());
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -3,7 +3,6 @@
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest; namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest
{ {
@ -12,10 +11,6 @@ class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest
*/ */
public function importsExampleAsExpected(): void public function importsExampleAsExpected(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->setDateAspect(new \DateTimeImmutable('2022-07-01'), new \DateTimeZone('Europe/Berlin')); $this->setDateAspect(new \DateTimeImmutable('2022-07-01'), new \DateTimeZone('Europe/Berlin'));
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php');
@ -38,10 +33,6 @@ class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest
self::assertSame(0, $tester->getStatusCode()); self::assertSame(0, $tester->getStatusCode());
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -57,11 +57,7 @@ class ImportHandlesImagesTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -90,11 +86,7 @@ class ImportHandlesImagesTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -126,11 +118,7 @@ class ImportHandlesImagesTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -163,11 +151,7 @@ class ImportHandlesImagesTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -202,11 +186,7 @@ class ImportHandlesImagesTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -239,10 +219,6 @@ class ImportHandlesImagesTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -18,10 +18,6 @@ class ImportsAllConfigurationTest extends AbstractTest
{ {
$this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin'))); $this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin')));
$fileImportPathConfiguration1 = 'staedte/beispielstadt/events/';
$fileImportPath1 = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration1;
GeneralUtility::mkdir_deep($fileImportPath1);
$fileImportPathConfiguration2 = 'staedte/anderestadt/events/'; $fileImportPathConfiguration2 = 'staedte/anderestadt/events/';
$fileImportPath2 = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration2; $fileImportPath2 = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration2;
GeneralUtility::mkdir_deep($fileImportPath2); GeneralUtility::mkdir_deep($fileImportPath2);
@ -78,7 +74,7 @@ class ImportsAllConfigurationTest extends AbstractTest
); );
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv');
$importedFiles = GeneralUtility::getFilesInDir($fileImportPath1); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath);
self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
self::assertSame( self::assertSame(
[ [
@ -102,10 +98,6 @@ class ImportsAllConfigurationTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -17,10 +17,6 @@ class ImportsExampleAsExpectedTest extends AbstractTest
{ {
$this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin'))); $this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin')));
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php');
@ -62,7 +58,7 @@ class ImportsExampleAsExpectedTest extends AbstractTest
); );
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv');
$importedFiles = GeneralUtility::getFilesInDir($fileImportPath); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath);
self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
self::assertSame( self::assertSame(
[ [
@ -74,10 +70,6 @@ class ImportsExampleAsExpectedTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -25,10 +25,6 @@ class ImportsFeaturesTest extends AbstractTest
$tester = $this->executeCommand(); $tester = $this->executeCommand();
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -30,11 +30,7 @@ class ImportsFirstDateOfDatesTest extends AbstractTest
$this->executeCommand(); $this->executeCommand();
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -47,11 +43,7 @@ class ImportsFirstDateOfDatesTest extends AbstractTest
$this->executeCommand(); $this->executeCommand();
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -64,10 +56,6 @@ class ImportsFirstDateOfDatesTest extends AbstractTest
$this->executeCommand(); $this->executeCommand();
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -17,10 +17,6 @@ class ImportsSingleConfigurationTest extends AbstractTest
{ {
$this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin'))); $this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin')));
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfiguration.php');
@ -62,7 +58,7 @@ class ImportsSingleConfigurationTest extends AbstractTest
); );
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv');
$importedFiles = GeneralUtility::getFilesInDir($fileImportPath); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath);
self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
self::assertSame( self::assertSame(
[ [
@ -74,10 +70,6 @@ class ImportsSingleConfigurationTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -3,7 +3,6 @@
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest; namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/** /**
* @testdox DestinationData import * @testdox DestinationData import
@ -17,10 +16,6 @@ class ImportsTicketsTest extends AbstractTest
*/ */
public function importsExampleAsExpected(): void public function importsExampleAsExpected(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php');
@ -46,10 +41,6 @@ class ImportsTicketsTest extends AbstractTest
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -32,11 +32,7 @@ class ImportsWithConfiguredRepeatUntilTest extends AbstractTest
$this->executeCommand(); $this->executeCommand();
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
/** /**
@ -54,10 +50,6 @@ class ImportsWithConfiguredRepeatUntilTest extends AbstractTest
$this->executeCommand(); $this->executeCommand();
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -3,24 +3,17 @@
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest; namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/** /**
* @testdox DestinationData import * @testdox DestinationData import
*/ */
class ImportsWithLocationsTest extends AbstractTest class ImportsWithLocationsTest extends AbstractTest
{ {
/** protected function setUp(): void
* @test
*/
public function importsWithLocations(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/'; parent::setUp();
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php');
$this->setUpConfiguration([ $this->setUpConfiguration([
'restUrl = https://example.com/some-path/', 'restUrl = https://example.com/some-path/',
'license = example-license', 'license = example-license',
@ -29,7 +22,13 @@ class ImportsWithLocationsTest extends AbstractTest
'restMode = next_months,12', 'restMode = next_months,12',
'restTemplate = ET2014A.json', 'restTemplate = ET2014A.json',
]); ]);
}
/**
* @test
*/
public function importsWithLocations(): void
{
$requests = &$this->setUpResponses([ $requests = &$this->setUpResponses([
new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithLocations.json') ?: ''), new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithLocations.json') ?: ''),
]); ]);
@ -37,10 +36,6 @@ class ImportsWithLocationsTest extends AbstractTest
self::assertSame(0, $tester->getStatusCode()); self::assertSame(0, $tester->getStatusCode());
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -15,10 +15,6 @@ class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTest
*/ */
public function importsWithoutCategoryIfNotProvided(): void public function importsWithoutCategoryIfNotProvided(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php');
$this->setUpConfiguration([ $this->setUpConfiguration([
@ -64,7 +60,7 @@ class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTest
); );
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv');
$importedFiles = GeneralUtility::getFilesInDir($fileImportPath); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath);
self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
self::assertSame( self::assertSame(
[ [
@ -76,10 +72,6 @@ class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -3,7 +3,6 @@
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest; namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/** /**
* @testdox DestinationData import * @testdox DestinationData import
@ -15,10 +14,6 @@ class ImportsWithoutLocationTest extends AbstractTest
*/ */
public function importsWithoutLocationIfNotProvided(): void public function importsWithoutLocationIfNotProvided(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php');
$this->setUpConfiguration([ $this->setUpConfiguration([
'restUrl = https://example.com/some-path/', 'restUrl = https://example.com/some-path/',
@ -41,10 +36,6 @@ class ImportsWithoutLocationTest extends AbstractTest
'Added unexpected location.' 'Added unexpected location.'
); );
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv');
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }

View file

@ -15,10 +15,6 @@ class ImportsWithoutRegionIfNotProvidedTest extends AbstractTest
*/ */
public function importsWithoutRegionIfNotProvided(): void public function importsWithoutRegionIfNotProvided(): void
{ {
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php');
$this->setUpConfiguration([ $this->setUpConfiguration([
@ -58,7 +54,7 @@ class ImportsWithoutRegionIfNotProvidedTest extends AbstractTest
); );
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv'); $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv');
$importedFiles = GeneralUtility::getFilesInDir($fileImportPath); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath);
self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.');
self::assertSame( self::assertSame(
[ [
@ -70,10 +66,6 @@ class ImportsWithoutRegionIfNotProvidedTest extends AbstractTest
'Got unexpected number of files' 'Got unexpected number of files'
); );
self::assertFileEquals( $this->assertEmptyLog();
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
} }
} }