Adjust expected DateTime format to gpodder - UTC ISO 8601

This commit is contained in:
Jonathan Flueren 2021-10-05 15:43:55 +02:00 committed by thrillfall
parent 795a9253d2
commit 3534c43976
2 changed files with 8 additions and 4 deletions

View File

@ -17,6 +17,8 @@ class EpisodeActionSaver
private EpisodeActionWriter $episodeActionWriter;
private EpisodeActionReader $episodeActionReader;
const DATETIME_FORMAT = 'Y-m-d\TH:i:s';
public function __construct(
EpisodeActionRepository $episodeActionRepository,
EpisodeActionWriter $episodeActionWriter,

View File

@ -7,10 +7,12 @@ use Test\TestCase;
class EpisodeActionRequestTimestampConversionTest extends TestCase
{
public function testTimestampConversion()
public function testDateTimeFormatIsEnsured(): void
{
$episodeActionTimestamp = "Tue May 18 23:45:11 GMT+02:00 2021";
$datetime = \DateTime::createFromFormat('D F d H:i:s T Y', $episodeActionTimestamp);
$this->assertEquals("2021-05-18T23:45:11", $datetime->format("Y-m-d\TH:i:s"));
$episodeActionTimestamp = "2021-05-18T23:45:11";
$datetime = \DateTime::createFromFormat('Y-m-d\TH:i:s', $episodeActionTimestamp)
->format('Y-m-d\TH:i:s');
$this->assertEquals($episodeActionTimestamp, $datetime);
}
}