test updating episode action fails when other episode action with same episode url already exists

This commit is contained in:
thrillfall 2023-02-24 20:37:32 +01:00
parent a6a19df999
commit ee84d2f670
1 changed files with 14 additions and 1 deletions

View File

@ -78,6 +78,19 @@ class EpisodeActionSaverGuidBackwardCompatibilityTest extends TestCase
$episodeActionRepository = $this->container->get(EpisodeActionRepository::class); $episodeActionRepository = $this->container->get(EpisodeActionRepository::class);
$this->assertSame(100, $episodeActionRepository->findByGuid($urlWithParameter, self::USER_ID_0)->getPosition()); $this->assertSame(100, $episodeActionRepository->findByGuid($urlWithParameter, self::USER_ID_0)->getPosition());
} try {
//act
$episodeActionSaver->saveEpisodeActions(
[["podcast" => $podcastUrl, "episode" => $urlWithParameter, "guid" => $urlWithParameter, "action" => "PLAY", "timestamp" => "2021-08-22T23:58:56", "started" => 35, "position" => 100, "total" => 2252]],
self::USER_ID_0
)[0];
$this->assertSame(1,2);
} catch (\Exception $exception) {
$this->assertStringContainsString("SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry", $exception->getMessage());
$this->assertStringContainsString("for key 'gpodder_episode_user_id'", $exception->getMessage());
}
}
} }