diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | 6 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | 52 |
2 files changed, 49 insertions, 9 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 0673d581..249672a6 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | |||
@@ -71,7 +71,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
71 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 71 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
72 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 72 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
73 | $this->assertContains('Config setup.', $tester->getDisplay()); | 73 | $this->assertContains('Config setup.', $tester->getDisplay()); |
74 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
75 | } | 74 | } |
76 | 75 | ||
77 | public function testRunInstallCommandWithReset() | 76 | public function testRunInstallCommandWithReset() |
@@ -103,7 +102,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
103 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); | 102 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); |
104 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 103 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
105 | $this->assertContains('Config setup.', $tester->getDisplay()); | 104 | $this->assertContains('Config setup.', $tester->getDisplay()); |
106 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
107 | 105 | ||
108 | // we force to reset everything | 106 | // we force to reset everything |
109 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); | 107 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); |
@@ -148,7 +146,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
148 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 146 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
149 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 147 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
150 | $this->assertContains('Config setup.', $tester->getDisplay()); | 148 | $this->assertContains('Config setup.', $tester->getDisplay()); |
151 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
152 | 149 | ||
153 | // the current database doesn't already exist | 150 | // the current database doesn't already exist |
154 | $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); | 151 | $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); |
@@ -186,7 +183,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
186 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 183 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
187 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 184 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
188 | $this->assertContains('Config setup.', $tester->getDisplay()); | 185 | $this->assertContains('Config setup.', $tester->getDisplay()); |
189 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
190 | 186 | ||
191 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); | 187 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); |
192 | } | 188 | } |
@@ -241,7 +237,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
241 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 237 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
242 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 238 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
243 | $this->assertContains('Config setup.', $tester->getDisplay()); | 239 | $this->assertContains('Config setup.', $tester->getDisplay()); |
244 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
245 | 240 | ||
246 | $this->assertContains('Creating schema', $tester->getDisplay()); | 241 | $this->assertContains('Creating schema', $tester->getDisplay()); |
247 | } | 242 | } |
@@ -274,6 +269,5 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
274 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 269 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
275 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 270 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
276 | $this->assertContains('Config setup.', $tester->getDisplay()); | 271 | $this->assertContains('Config setup.', $tester->getDisplay()); |
277 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
278 | } | 272 | } |
279 | } | 273 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index df4c34cd..5ce893c1 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -163,7 +163,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
163 | /** | 163 | /** |
164 | * This test will require an internet connection. | 164 | * This test will require an internet connection. |
165 | */ | 165 | */ |
166 | public function testPostNewThatWillBeTaggued() | 166 | public function testPostNewThatWillBeTagged() |
167 | { | 167 | { |
168 | $this->logInAs('admin'); | 168 | $this->logInAs('admin'); |
169 | $client = $this->getClient(); | 169 | $client = $this->getClient(); |
@@ -181,8 +181,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
181 | $client->submit($form, $data); | 181 | $client->submit($form, $data); |
182 | 182 | ||
183 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 183 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
184 | 184 | $this->assertContains('/', $client->getResponse()->getTargetUrl()); | |
185 | $client->followRedirect(); | ||
186 | 185 | ||
187 | $em = $client->getContainer() | 186 | $em = $client->getContainer() |
188 | ->get('doctrine.orm.entity_manager'); | 187 | ->get('doctrine.orm.entity_manager'); |
@@ -196,6 +195,35 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
196 | 195 | ||
197 | $em->remove($entry); | 196 | $em->remove($entry); |
198 | $em->flush(); | 197 | $em->flush(); |
198 | |||
199 | // and now re-submit it to test the cascade persistence for tags after entry removal | ||
200 | // related https://github.com/wallabag/wallabag/issues/2121 | ||
201 | $crawler = $client->request('GET', '/new'); | ||
202 | |||
203 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
204 | |||
205 | $form = $crawler->filter('form[name=entry]')->form(); | ||
206 | |||
207 | $data = [ | ||
208 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag/tree/master', | ||
209 | ]; | ||
210 | |||
211 | $client->submit($form, $data); | ||
212 | |||
213 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
214 | $this->assertContains('/', $client->getResponse()->getTargetUrl()); | ||
215 | |||
216 | $entry = $em | ||
217 | ->getRepository('WallabagCoreBundle:Entry') | ||
218 | ->findOneByUrl($url); | ||
219 | |||
220 | $tags = $entry->getTags(); | ||
221 | |||
222 | $this->assertCount(1, $tags); | ||
223 | $this->assertEquals('wallabag', $tags[0]->getLabel()); | ||
224 | |||
225 | $em->remove($entry); | ||
226 | $em->flush(); | ||
199 | } | 227 | } |
200 | 228 | ||
201 | public function testArchive() | 229 | public function testArchive() |
@@ -471,6 +499,24 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
471 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 499 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
472 | } | 500 | } |
473 | 501 | ||
502 | public function testFilterOnUnreadStatus() | ||
503 | { | ||
504 | $this->logInAs('admin'); | ||
505 | $client = $this->getClient(); | ||
506 | |||
507 | $crawler = $client->request('GET', '/all/list'); | ||
508 | |||
509 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
510 | |||
511 | $data = [ | ||
512 | 'entry_filter[isUnread]' => true, | ||
513 | ]; | ||
514 | |||
515 | $crawler = $client->submit($form, $data); | ||
516 | |||
517 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | ||
518 | } | ||
519 | |||
474 | public function testFilterOnCreationDate() | 520 | public function testFilterOnCreationDate() |
475 | { | 521 | { |
476 | $this->logInAs('admin'); | 522 | $this->logInAs('admin'); |