From 9f0c06e919dbf5f0643cf2243b333c6fb09b2cc4 Mon Sep 17 00:00:00 2001 From: thrillfall Date: Wed, 25 Aug 2021 19:51:43 +0200 Subject: [PATCH] test we still retrieve the correct episode action by guid when episode url changes --- .../EpisodeActionSaverGuidMigrationTest.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Integration/EpisodeActionSaverGuidMigrationTest.php b/tests/Integration/EpisodeActionSaverGuidMigrationTest.php index 09ea23c..a5b3e72 100644 --- a/tests/Integration/EpisodeActionSaverGuidMigrationTest.php +++ b/tests/Integration/EpisodeActionSaverGuidMigrationTest.php @@ -43,4 +43,25 @@ class EpisodeActionSaverGuidMigrationTest extends TestCase self::assertSame($savedEpisodeActionEntityWithoutGuid->getId(), $savedEpisodeActionEntityWithGuid->getId()); } + + public function testCreateEpisodeActionWithGuidThenCreateAgainWithGuidButDifferentEpisodeUrl() : void + { + /** @var EpisodeActionSaver $episodeActionSaver */ + $episodeActionSaver = $this->container->get(EpisodeActionSaver::class); + + $episodeUrl = uniqid("https://dts.podtrac.com/redirect.mp3/chrt.fm/track"); + $guid = uniqid("gid://art19-episode-locator/V0/Ktd"); + + $savedEpisodeActionEntity = $episodeActionSaver->saveEpisodeActions( + "[EpisodeAction{podcast='https://rss.art19.com/dr-death-s3-miracle-man', episode='{$episodeUrl}', guid='{$guid}', action=PLAY, timestamp=Mon Aug 23 01:58:56 GMT+02:00 2021, started=47, position=54, total=2252}]", + self::USER_ID_0 + )[0]; + + $savedEpisodeActionEntityWithDifferentEpisodeUrl = $episodeActionSaver->saveEpisodeActions( + "[EpisodeAction{podcast='https://rss.art19.com/dr-death-s3-miracle-man', episode='{$episodeUrl}_different', guid='{$guid}', action=PLAY, timestamp=Mon Aug 23 01:58:56 GMT+02:00 2021, started=47, position=54, total=2252}]", + self::USER_ID_0 + )[0]; + + self::assertSame($savedEpisodeActionEntity->getId(), $savedEpisodeActionEntityWithDifferentEpisodeUrl->getId()); + } }