aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-08-30 13:53:49 +0200
committerGitHub <noreply@github.com>2017-08-30 13:53:49 +0200
commit119e6c5edb93ab8a14fd46d04d224091542039c4 (patch)
tree521a316a60c7bd162bb52a86f55a8bf4e3c6f475 /tests/Wallabag
parent854616ac6d6246e8e0451342ab841985b401604d (diff)
parenta991c46eedec0efb24d0a9974b1c7fcabf8cfa66 (diff)
downloadwallabag-119e6c5edb93ab8a14fd46d04d224091542039c4.tar.gz
wallabag-119e6c5edb93ab8a14fd46d04d224091542039c4.tar.zst
wallabag-119e6c5edb93ab8a14fd46d04d224091542039c4.zip
Merge pull request #3330 from franek/set-starred-date
Add starred_at field which is set when an entry is starred
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 2dc08be2..f4c8a630 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -407,6 +407,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
407 $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); 407 $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
408 $this->assertSame(0, $content['is_archived']); 408 $this->assertSame(0, $content['is_archived']);
409 $this->assertSame(0, $content['is_starred']); 409 $this->assertSame(0, $content['is_starred']);
410 $this->assertNull($content['starred_at']);
410 $this->assertSame('New title for my article', $content['title']); 411 $this->assertSame('New title for my article', $content['title']);
411 $this->assertSame(1, $content['user_id']); 412 $this->assertSame(1, $content['user_id']);
412 $this->assertCount(2, $content['tags']); 413 $this->assertCount(2, $content['tags']);
@@ -483,6 +484,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
483 484
484 public function testPostArchivedAndStarredEntry() 485 public function testPostArchivedAndStarredEntry()
485 { 486 {
487 $now = new \DateTime();
486 $this->client->request('POST', '/api/entries.json', [ 488 $this->client->request('POST', '/api/entries.json', [
487 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 489 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
488 'archive' => '1', 490 'archive' => '1',
@@ -497,6 +499,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
497 $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); 499 $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
498 $this->assertSame(1, $content['is_archived']); 500 $this->assertSame(1, $content['is_archived']);
499 $this->assertSame(1, $content['is_starred']); 501 $this->assertSame(1, $content['is_starred']);
502 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
500 $this->assertSame(1, $content['user_id']); 503 $this->assertSame(1, $content['user_id']);
501 } 504 }
502 505
@@ -753,6 +756,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
753 756
754 public function testSaveIsStarredAfterPatch() 757 public function testSaveIsStarredAfterPatch()
755 { 758 {
759 $now = new \DateTime();
756 $entry = $this->client->getContainer() 760 $entry = $this->client->getContainer()
757 ->get('doctrine.orm.entity_manager') 761 ->get('doctrine.orm.entity_manager')
758 ->getRepository('WallabagCoreBundle:Entry') 762 ->getRepository('WallabagCoreBundle:Entry')
@@ -770,6 +774,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
770 $content = json_decode($this->client->getResponse()->getContent(), true); 774 $content = json_decode($this->client->getResponse()->getContent(), true);
771 775
772 $this->assertSame(1, $content['is_starred']); 776 $this->assertSame(1, $content['is_starred']);
777 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
773 } 778 }
774 779
775 public function dataForEntriesExistWithUrl() 780 public function dataForEntriesExistWithUrl()