mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-22 16:16:11 +01:00
Daniel Siepmann (Codappix)
17fae724df
Slugs of dates are generated during import. This might lead to confusion if the time zone differs from frontend. Therefore the time zone is now configurable to allow adjustments for the actual website. A new interface `TimeZoneProviderInterface` is provided which can be re configured to a different implementation. The default implementation will use TYPO3s `SYS.phpTimeZone` setting, with fall back to `date_default_timezone_get()` call. That way it should be useful for most systems out of the box. Resolves: #11345
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest;
|
|
|
|
use DateTimeImmutable;
|
|
use DateTimeZone;
|
|
use GuzzleHttp\Psr7\Response;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use PHPUnit\Framework\Attributes\TestDox;
|
|
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
|
|
|
#[TestDox('DestinationData import')]
|
|
class ImportsWithSystemConfiguredTimeZoneTest extends AbstractTestCase
|
|
{
|
|
public function setUp(): void
|
|
{
|
|
ArrayUtility::mergeRecursiveWithOverrule($this->configurationToUseInTestInstance, [
|
|
'SYS' => [
|
|
'phpTimeZone' => 'Europe/Berlin',
|
|
],
|
|
]);
|
|
|
|
parent::setUp();
|
|
|
|
$this->setUpConfiguration([
|
|
'restUrl = https://example.com/some-path/',
|
|
]);
|
|
$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php');
|
|
$this->setDateAspect(new DateTimeImmutable('2022-07-13', new DateTimeZone('UTC')));
|
|
}
|
|
|
|
#[Test]
|
|
public function withTYPO3TimeZone(): void
|
|
{
|
|
$this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithSingleDate.json') ?: '')]);
|
|
|
|
$this->executeCommand();
|
|
|
|
$dates = $this->getAllRecords('tx_events_domain_model_date');
|
|
self::assertSame('kurzfuehrung-historische-altstadt-2022-07-13t15-00-00', $dates[0]['slug']);
|
|
|
|
$this->assertEmptyLog();
|
|
}
|
|
}
|