container = $app->getContainer(); } /** * @before */ public function before() { $this->startTransaction(); } public function testCreateSameEpisodeActionTriggersUniqueConstraintViolationException() { self::expectException(UniqueConstraintViolationException::class); /** @var EpisodeActionWriter $episodeActionWriter */ $episodeActionWriter = $this->container->get('OCA\GPodderSync\Db\EpisodeAction\EpisodeActionWriter'); $episodeActionEntity = new EpisodeActionEntity(); $episodeActionEntity->setPodcast("https://podcast_01.url"); $episodeActionEntity->setEpisode("https://episode_01.url"); $episodeActionEntity->setAction("PLAY"); $episodeActionEntity->setPosition(5); $episodeActionEntity->setStarted(0); $episodeActionEntity->setTotal(123); $episodeActionEntity->setTimestamp("Mon Aug 23 01:58:56 GMT+02:00 2021"); $episodeActionEntity->setUserId("user0@127.0.0.1"); $episodeActionWriter->save($episodeActionEntity); $episodeActionWriter->save($episodeActionEntity); } /** * @after */ public function after() { $this->rollbackTransation(); } }