From 0d42217e4e8210dd2cf86f35ba9662ca02c8a2dc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 9 Mar 2016 08:59:08 +0100 Subject: Convert english translation file - convert english translation to translate key - remove baggy template for login (never used since user isn't logged in and it'll use the default theme: material) - fix tests about text in response (now checking translation key instead of translated text) - remove all ugly `` --- .../Tests/Controller/WallabagV1ControllerTest.php | 11 ++++++----- .../Tests/Controller/WallabagV2ControllerTest.php | 8 ++++---- src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php | 2 +- .../ImportBundle/Tests/Import/WallabagV1ImportTest.php | 2 +- .../ImportBundle/Tests/Import/WallabagV2ImportTest.php | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src/Wallabag/ImportBundle/Tests') diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 7f97b0f5..6c876b3b 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php @@ -54,8 +54,8 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content->getTags()->contains($tag)); - $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(array('_text'))); + $this->assertContains('Import summary', $body[0]); } public function testImportWallabagWithFileAndMarkAllAsRead() @@ -99,7 +99,8 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); - $this->assertContains('Import summary', $client->getResponse()->getContent()); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); + $this->assertContains('Import summary', $body[0]); } public function testImportWallabagWithEmptyFile() @@ -122,7 +123,7 @@ class WallabagV1ControllerTest 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(array('_text'))); + $this->assertContains('Import failed, please try again', $body[0]); } } diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php index 617c0517..58baa836 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php @@ -39,8 +39,8 @@ 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(array('_text'))); + $this->assertContains('Import summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -87,7 +87,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(array('_text'))); + $this->assertContains('Import failed, please try again', $body[0]); } } diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php index 450cdc95..43b60ec3 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php @@ -85,7 +85,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Pocket', $pocketImport->getName()); $this->assertNotEmpty($pocketImport->getUrl()); - $this->assertContains('This importer will import all your Pocket data.', $pocketImport->getDescription()); + $this->assertEquals('import.pocket.description', $pocketImport->getDescription()); } public function testOAuthRequest() diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php index 8ab7e830..496cf2d3 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php @@ -45,7 +45,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $this->assertEquals('wallabag v1', $wallabagV1Import->getName()); $this->assertNotEmpty($wallabagV1Import->getUrl()); - $this->assertContains('This importer will import all your wallabag v1 articles.', $wallabagV1Import->getDescription()); + $this->assertEquals('import.wallabag_v1.description', $wallabagV1Import->getDescription()); } public function testImport() diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php index 2b642d27..341b1076 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php @@ -45,7 +45,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $this->assertEquals('wallabag v2', $wallabagV2Import->getName()); $this->assertNotEmpty($wallabagV2Import->getUrl()); - $this->assertContains('This importer will import all your wallabag v2 articles.', $wallabagV2Import->getDescription()); + $this->assertEquals('import.wallabag_v2.description', $wallabagV2Import->getDescription()); } public function testImport() -- cgit v1.2.3 From 4204a06b7726597dc84fe34b39c53f1534a86140 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 11 Mar 2016 14:48:46 +0100 Subject: Add flashes messages --- src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php | 2 +- .../ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | 6 +++--- .../ImportBundle/Tests/Controller/WallabagV2ControllerTest.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Wallabag/ImportBundle/Tests') diff --git a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php index c2acd68c..174641fd 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php @@ -37,6 +37,6 @@ class PocketControllerTest extends WallabagCoreTestCase $this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertContains('import/pocket', $client->getResponse()->headers->get('location')); - $this->assertEquals('Import failed, please try again.', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); + $this->assertEquals('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); } } diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 6c876b3b..8d353a71 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php @@ -55,7 +55,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content->getTags()->contains($tag)); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); - $this->assertContains('Import summary', $body[0]); + $this->assertContains('flashes.import.notice.summary', $body[0]); } public function testImportWallabagWithFileAndMarkAllAsRead() @@ -100,7 +100,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); - $this->assertContains('Import summary', $body[0]); + $this->assertContains('flashes.import.notice.summary', $body[0]); } public function testImportWallabagWithEmptyFile() @@ -124,6 +124,6 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); - $this->assertContains('Import failed, please try again', $body[0]); + $this->assertContains('flashes.import.notice.failed', $body[0]); } } diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php index 58baa836..bcbd6305 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php @@ -40,7 +40,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); - $this->assertContains('Import summary', $body[0]); + $this->assertContains('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -88,6 +88,6 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); - $this->assertContains('Import failed, please try again', $body[0]); + $this->assertContains('flashes.import.notice.failed', $body[0]); } } -- cgit v1.2.3