aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php5
-rw-r--r--tests/Wallabag/CoreBundle/Controller/TagControllerTest.php6
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php2
4 files changed, 11 insertions, 4 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()
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
index be25a8b5..5a973a7e 100644
--- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
@@ -9,6 +9,7 @@ use Wallabag\CoreBundle\Entity\Tag;
9class TagControllerTest extends WallabagCoreTestCase 9class TagControllerTest extends WallabagCoreTestCase
10{ 10{
11 public $tagName = 'opensource'; 11 public $tagName = 'opensource';
12 public $caseTagName = 'OpenSource';
12 13
13 public function testList() 14 public function testList()
14 { 15 {
@@ -36,7 +37,7 @@ class TagControllerTest extends WallabagCoreTestCase
36 $form = $crawler->filter('form[name=tag]')->form(); 37 $form = $crawler->filter('form[name=tag]')->form();
37 38
38 $data = [ 39 $data = [
39 'tag[label]' => $this->tagName, 40 'tag[label]' => $this->caseTagName,
40 ]; 41 ];
41 42
42 $client->submit($form, $data); 43 $client->submit($form, $data);
@@ -45,6 +46,7 @@ class TagControllerTest extends WallabagCoreTestCase
45 // be sure to reload the entry 46 // be sure to reload the entry
46 $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); 47 $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
47 $this->assertCount(1, $entry->getTags()); 48 $this->assertCount(1, $entry->getTags());
49 $this->assertContains($this->tagName, $entry->getTags());
48 50
49 // tag already exists and already assigned 51 // tag already exists and already assigned
50 $client->submit($form, $data); 52 $client->submit($form, $data);
@@ -80,7 +82,7 @@ class TagControllerTest extends WallabagCoreTestCase
80 $form = $crawler->filter('form[name=tag]')->form(); 82 $form = $crawler->filter('form[name=tag]')->form();
81 83
82 $data = [ 84 $data = [
83 'tag[label]' => 'foo2, bar2', 85 'tag[label]' => 'foo2, Bar2',
84 ]; 86 ];
85 87
86 $client->submit($form, $data); 88 $client->submit($form, $data);
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index c307f96c..9bb59766 100644
--- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -125,7 +125,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
125 $tags = $content->getTags(); 125 $tags = $content->getTags();
126 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 126 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
127 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag'); 127 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
128 $this->assertContains('PHP', $tags, 'It includes the "PHP" tag'); 128 $this->assertContains('php', $tags, 'It includes the "php" tag');
129 $this->assertSame(3, count($tags)); 129 $this->assertSame(3, count($tags));
130 130
131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index 25625c35..4bc982e0 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -125,7 +125,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
125 125
126 $tags = $content->getTags(); 126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertContains('Framabag', $tags, 'It includes the "Framabag" tag'); 128 $this->assertContains('framabag', $tags, 'It includes the "framabag" tag');
129 $this->assertSame(2, count($tags)); 129 $this->assertSame(2, count($tags));
130 130
131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());