X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FTests%2FController%2FWallabagV2ControllerTest.php;h=15251ae7ba115d322c97c03a8d61aa6bcf81946e;hb=4094ea47712efbe58624ff74daeb1f77c9b0edcf;hp=a77c0f6b901ce3aea853927d719f9a3f08c2e943;hpb=e008c037f53324b931f027483f9f1053171109c5;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php index a77c0f6b..15251ae7 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php @@ -29,9 +29,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, - ); + ]; $client->submit($form, $data); @@ -39,8 +39,34 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); - $this->assertContains('Import summary', $alert[0]); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('flashes.import.notice.summary', $body[0]); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId( + 'http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867', + $this->getLoggedInUserId() + ); + + $this->assertEmpty($content->getMimetype()); + $this->assertEmpty($content->getPreviewPicture()); + $this->assertEmpty($content->getLanguage()); + $this->assertEquals(0, count($content->getTags())); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId( + 'https://www.mediapart.fr/', + $this->getLoggedInUserId() + ); + + $this->assertNotEmpty($content->getMimetype()); + $this->assertNotEmpty($content->getPreviewPicture()); + $this->assertNotEmpty($content->getLanguage()); + $this->assertEquals(2, count($content->getTags())); } public function testImportWallabagWithEmptyFile() @@ -53,9 +79,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, - ); + ]; $client->submit($form, $data); @@ -63,7 +89,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); - $this->assertContains('Import failed, please try again', $alert[0]); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('flashes.import.notice.failed', $body[0]); } }