diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
commit | f808b01692a835673f328d7221ba8c212caa9b61 (patch) | |
tree | 0c3b1fc5b1ddbd7af72227303503177689e1d403 /tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
download | wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip |
Add a real configuration for CS-Fixer
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/TagControllerTest.php')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index af1ad7af..be25a8b5 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |||
@@ -17,7 +17,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
17 | 17 | ||
18 | $client->request('GET', '/tag/list'); | 18 | $client->request('GET', '/tag/list'); |
19 | 19 | ||
20 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 20 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
21 | } | 21 | } |
22 | 22 | ||
23 | public function testAddTagToEntry() | 23 | public function testAddTagToEntry() |
@@ -31,7 +31,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
31 | $this->getEntityManager()->flush(); | 31 | $this->getEntityManager()->flush(); |
32 | $this->getEntityManager()->clear(); | 32 | $this->getEntityManager()->clear(); |
33 | 33 | ||
34 | $crawler = $client->request('GET', '/view/'.$entry->getId()); | 34 | $crawler = $client->request('GET', '/view/' . $entry->getId()); |
35 | 35 | ||
36 | $form = $crawler->filter('form[name=tag]')->form(); | 36 | $form = $crawler->filter('form[name=tag]')->form(); |
37 | 37 | ||
@@ -40,7 +40,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
40 | ]; | 40 | ]; |
41 | 41 | ||
42 | $client->submit($form, $data); | 42 | $client->submit($form, $data); |
43 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 43 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
44 | 44 | ||
45 | // be sure to reload the entry | 45 | // be sure to reload the entry |
46 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 46 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
@@ -48,7 +48,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
48 | 48 | ||
49 | // tag already exists and already assigned | 49 | // tag already exists and already assigned |
50 | $client->submit($form, $data); | 50 | $client->submit($form, $data); |
51 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 51 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
52 | 52 | ||
53 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 53 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
54 | $this->assertCount(1, $entry->getTags()); | 54 | $this->assertCount(1, $entry->getTags()); |
@@ -59,7 +59,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
59 | ]; | 59 | ]; |
60 | 60 | ||
61 | $client->submit($form, $data); | 61 | $client->submit($form, $data); |
62 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 62 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
63 | 63 | ||
64 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 64 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
65 | $this->assertCount(2, $entry->getTags()); | 65 | $this->assertCount(2, $entry->getTags()); |
@@ -75,7 +75,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
75 | ->getRepository('WallabagCoreBundle:Entry') | 75 | ->getRepository('WallabagCoreBundle:Entry') |
76 | ->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId()); | 76 | ->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId()); |
77 | 77 | ||
78 | $crawler = $client->request('GET', '/view/'.$entry->getId()); | 78 | $crawler = $client->request('GET', '/view/' . $entry->getId()); |
79 | 79 | ||
80 | $form = $crawler->filter('form[name=tag]')->form(); | 80 | $form = $crawler->filter('form[name=tag]')->form(); |
81 | 81 | ||
@@ -84,7 +84,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
84 | ]; | 84 | ]; |
85 | 85 | ||
86 | $client->submit($form, $data); | 86 | $client->submit($form, $data); |
87 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 87 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
88 | 88 | ||
89 | $newEntry = $client->getContainer() | 89 | $newEntry = $client->getContainer() |
90 | ->get('doctrine.orm.entity_manager') | 90 | ->get('doctrine.orm.entity_manager') |
@@ -97,8 +97,8 @@ class TagControllerTest extends WallabagCoreTestCase | |||
97 | } | 97 | } |
98 | 98 | ||
99 | $this->assertGreaterThanOrEqual(2, count($tags)); | 99 | $this->assertGreaterThanOrEqual(2, count($tags)); |
100 | $this->assertNotFalse(array_search('foo2', $tags), 'Tag foo2 is assigned to the entry'); | 100 | $this->assertNotFalse(array_search('foo2', $tags, true), 'Tag foo2 is assigned to the entry'); |
101 | $this->assertNotFalse(array_search('bar2', $tags), 'Tag bar2 is assigned to the entry'); | 101 | $this->assertNotFalse(array_search('bar2', $tags, true), 'Tag bar2 is assigned to the entry'); |
102 | } | 102 | } |
103 | 103 | ||
104 | public function testRemoveTagFromEntry() | 104 | public function testRemoveTagFromEntry() |
@@ -116,27 +116,27 @@ class TagControllerTest extends WallabagCoreTestCase | |||
116 | $this->getEntityManager()->clear(); | 116 | $this->getEntityManager()->clear(); |
117 | 117 | ||
118 | // We make a first request to set an history and test redirection after tag deletion | 118 | // We make a first request to set an history and test redirection after tag deletion |
119 | $client->request('GET', '/view/'.$entry->getId()); | 119 | $client->request('GET', '/view/' . $entry->getId()); |
120 | $entryUri = $client->getRequest()->getUri(); | 120 | $entryUri = $client->getRequest()->getUri(); |
121 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | 121 | $client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId()); |
122 | 122 | ||
123 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 123 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
124 | $this->assertEquals($entryUri, $client->getResponse()->getTargetUrl()); | 124 | $this->assertSame($entryUri, $client->getResponse()->getTargetUrl()); |
125 | 125 | ||
126 | // re-retrieve the entry to be sure to get fresh data from database (mostly for tags) | 126 | // re-retrieve the entry to be sure to get fresh data from database (mostly for tags) |
127 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 127 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
128 | $this->assertNotContains($this->tagName, $entry->getTags()); | 128 | $this->assertNotContains($this->tagName, $entry->getTags()); |
129 | 129 | ||
130 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | 130 | $client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId()); |
131 | 131 | ||
132 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 132 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
133 | 133 | ||
134 | $tag = $client->getContainer() | 134 | $tag = $client->getContainer() |
135 | ->get('doctrine.orm.entity_manager') | 135 | ->get('doctrine.orm.entity_manager') |
136 | ->getRepository('WallabagCoreBundle:Tag') | 136 | ->getRepository('WallabagCoreBundle:Tag') |
137 | ->findOneByLabel($this->tagName); | 137 | ->findOneByLabel($this->tagName); |
138 | 138 | ||
139 | $this->assertNull($tag, $this->tagName.' was removed because it begun an orphan tag'); | 139 | $this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag'); |
140 | } | 140 | } |
141 | 141 | ||
142 | public function testShowEntriesForTagAction() | 142 | public function testShowEntriesForTagAction() |
@@ -165,9 +165,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
165 | ->getRepository('WallabagCoreBundle:Tag') | 165 | ->getRepository('WallabagCoreBundle:Tag') |
166 | ->findOneByEntryAndTagLabel($entry, $this->tagName); | 166 | ->findOneByEntryAndTagLabel($entry, $this->tagName); |
167 | 167 | ||
168 | $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); | 168 | $crawler = $client->request('GET', '/tag/list/' . $tag->getSlug()); |
169 | 169 | ||
170 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 170 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
171 | $this->assertCount(1, $crawler->filter('[id*="entry-"]')); | 171 | $this->assertCount(1, $crawler->filter('[id*="entry-"]')); |
172 | 172 | ||
173 | $entry->removeTag($tag); | 173 | $entry->removeTag($tag); |