diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-02-13 16:20:00 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-03-03 10:03:40 +0100 |
commit | c32ae320fec4135f5b32d57ef88349317a3b1f3f (patch) | |
tree | a55f5d4ca0c77c40822f2d53faa9dd622064be3f /src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | |
parent | c10fcb3bbbd4ef14edd9a862ee18c895d92e30ae (diff) | |
download | wallabag-c32ae320fec4135f5b32d57ef88349317a3b1f3f.tar.gz wallabag-c32ae320fec4135f5b32d57ef88349317a3b1f3f.tar.zst wallabag-c32ae320fec4135f5b32d57ef88349317a3b1f3f.zip |
cs & tests for wllbg v1 import
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 819bb0e6..c10d0d18 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | |||
@@ -58,6 +58,51 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
58 | $this->assertContains('Import summary', $alert[0]); | 58 | $this->assertContains('Import summary', $alert[0]); |
59 | } | 59 | } |
60 | 60 | ||
61 | public function testImportWallabagWithFileAndMarkAllAsRead() | ||
62 | { | ||
63 | $this->logInAs('admin'); | ||
64 | $client = $this->getClient(); | ||
65 | |||
66 | $crawler = $client->request('GET', '/import/wallabag-v1'); | ||
67 | $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); | ||
68 | |||
69 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); | ||
70 | |||
71 | $data = array( | ||
72 | 'upload_import_file[file]' => $file, | ||
73 | 'upload_import_file[mark_as_read]' => 1, | ||
74 | ); | ||
75 | |||
76 | $client->submit($form, $data); | ||
77 | |||
78 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
79 | |||
80 | $crawler = $client->followRedirect(); | ||
81 | |||
82 | $content1 = $client->getContainer() | ||
83 | ->get('doctrine.orm.entity_manager') | ||
84 | ->getRepository('WallabagCoreBundle:Entry') | ||
85 | ->findByUrlAndUserId( | ||
86 | 'http://gilbert.pellegrom.me/recreating-the-square-slider', | ||
87 | $this->getLoggedInUserId() | ||
88 | ); | ||
89 | |||
90 | $this->assertTrue($content1->isArchived()); | ||
91 | |||
92 | $content2 = $client->getContainer() | ||
93 | ->get('doctrine.orm.entity_manager') | ||
94 | ->getRepository('WallabagCoreBundle:Entry') | ||
95 | ->findByUrlAndUserId( | ||
96 | 'https://www.wallabag.org/features/', | ||
97 | $this->getLoggedInUserId() | ||
98 | ); | ||
99 | |||
100 | $this->assertTrue($content2->isArchived()); | ||
101 | |||
102 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | ||
103 | $this->assertContains('Import summary', $alert[0]); | ||
104 | } | ||
105 | |||
61 | public function testImportWallabagWithEmptyFile() | 106 | public function testImportWallabagWithEmptyFile() |
62 | { | 107 | { |
63 | $this->logInAs('admin'); | 108 | $this->logInAs('admin'); |