mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-22 09:16:20 +01:00
Reflect TYPO3 behaviour in tests
TYPO3 scheduler tasks always have a value for console commands. Region uid will be an empty string if omitted within scheduler task. We reflect that in our tests and adapt code to not break. Furthermore tests call only with strings, as that's what TYPO3 does.
This commit is contained in:
parent
6aa4681cb9
commit
a8c475fbd7
5 changed files with 15 additions and 7 deletions
|
@ -54,10 +54,17 @@ class DestinationDataImportCommand extends Command
|
||||||
{
|
{
|
||||||
Bootstrap::initializeBackendAuthentication();
|
Bootstrap::initializeBackendAuthentication();
|
||||||
|
|
||||||
|
$regionUid = $input->getArgument('region-uid');
|
||||||
|
if (is_numeric($regionUid)) {
|
||||||
|
$regionUid = (int) $regionUid;
|
||||||
|
} else {
|
||||||
|
$regionUid = null;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->destinationDataImportService->import(
|
return $this->destinationDataImportService->import(
|
||||||
$input->getArgument('rest-experience'),
|
$input->getArgument('rest-experience'),
|
||||||
$input->getArgument('storage-pid'),
|
$input->getArgument('storage-pid'),
|
||||||
$input->getArgument('region-uid'),
|
$regionUid,
|
||||||
$input->getArgument('files-folder')
|
$input->getArgument('files-folder')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ImportCleansTransientFilesTest extends AbstractTest
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tester = $this->executeCommand([
|
$tester = $this->executeCommand([
|
||||||
'storage-pid' => 2,
|
'storage-pid' => '2',
|
||||||
'rest-experience' => 'beispielstadt',
|
'rest-experience' => 'beispielstadt',
|
||||||
'files-folder' => $fileImportPath,
|
'files-folder' => $fileImportPath,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ImportDoesNotUseUploadsFolderTest extends AbstractTest
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tester = $this->executeCommand([
|
$tester = $this->executeCommand([
|
||||||
'storage-pid' => 2,
|
'storage-pid' => '2',
|
||||||
'rest-experience' => 'beispielstadt',
|
'rest-experience' => 'beispielstadt',
|
||||||
'files-folder' => $fileImportPath,
|
'files-folder' => $fileImportPath,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -36,10 +36,10 @@ class ImportsExampleAsExpectedTest extends AbstractTest
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tester = $this->executeCommand([
|
$tester = $this->executeCommand([
|
||||||
'storage-pid' => 2,
|
'storage-pid' => '2',
|
||||||
'rest-experience' => 'beispielstadt',
|
'rest-experience' => 'beispielstadt',
|
||||||
'files-folder' => $fileImportPath,
|
'files-folder' => $fileImportPath,
|
||||||
'region-uid' => 1,
|
'region-uid' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
self::assertSame(0, $tester->getStatusCode());
|
self::assertSame(0, $tester->getStatusCode());
|
||||||
|
|
|
@ -8,7 +8,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
/**
|
/**
|
||||||
* @testdox DestinationData import
|
* @testdox DestinationData import
|
||||||
*/
|
*/
|
||||||
class ImportsWithoutRegionIfNotProvided extends AbstractTest
|
class ImportsWithoutRegionIfNotProvidedTest extends AbstractTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
@ -33,9 +33,10 @@ class ImportsWithoutRegionIfNotProvided extends AbstractTest
|
||||||
new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
|
new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''),
|
||||||
]);
|
]);
|
||||||
$tester = $this->executeCommand([
|
$tester = $this->executeCommand([
|
||||||
'storage-pid' => 2,
|
'storage-pid' => '2',
|
||||||
'rest-experience' => 'beispielstadt',
|
'rest-experience' => 'beispielstadt',
|
||||||
'files-folder' => $fileImportPath,
|
'files-folder' => $fileImportPath,
|
||||||
|
'region-uid' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
self::assertSame(0, $tester->getStatusCode());
|
self::assertSame(0, $tester->getStatusCode());
|
||||||
|
|
Loading…
Reference in a new issue