Make testSaveIsArchivedAfterPatch and testSaveIsStarredAfterPatch consistent

This commit is contained in:
Yassine Guedidi
2023-08-21 23:53:42 +02:00
parent a3b64611f8
commit 1ce5164e70
2 changed files with 14 additions and 1 deletions

View File

@ -1022,6 +1022,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testSaveIsArchivedAfterPatch()
{
$now = new \DateTime();
$entry = $this->client->getContainer()
->get(EntityManagerInterface::class)
->getRepository(Entry::class)
@ -1043,6 +1044,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$this->assertSame(1, $content['is_archived']);
$this->assertSame($previousTitle . '++', $content['title']);
$this->assertGreaterThanOrEqual((new \DateTime($content['archived_at']))->getTimestamp(), $now->getTimestamp());
}
public function testSaveIsStarredAfterPatch()
@ -1056,6 +1058,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
if (!$entry) {
$this->markTestSkipped('No content found in db.');
}
$previousTitle = $entry->getTitle();
$this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
'title' => $entry->getTitle() . '++',
]);
@ -1065,6 +1070,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertSame(1, $content['is_starred']);
$this->assertSame($previousTitle . '++', $content['title']);
$this->assertGreaterThanOrEqual((new \DateTime($content['starred_at']))->getTimestamp(), $now->getTimestamp());
}