From f808b01692a835673f328d7221ba8c212caa9b61 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Jul 2017 09:52:38 +0200 Subject: Add a real configuration for CS-Fixer --- .../CoreBundle/Controller/ConfigControllerTest.php | 116 ++++++------ .../CoreBundle/Controller/EntryControllerTest.php | 202 ++++++++++----------- .../CoreBundle/Controller/ExportControllerTest.php | 108 +++++------ .../CoreBundle/Controller/RssControllerTest.php | 58 +++--- .../Controller/SettingsControllerTest.php | 4 +- .../Controller/SiteCredentialControllerTest.php | 22 +-- .../CoreBundle/Controller/StaticControllerTest.php | 4 +- .../CoreBundle/Controller/TagControllerTest.php | 36 ++-- 8 files changed, 275 insertions(+), 275 deletions(-) (limited to 'tests/Wallabag/CoreBundle/Controller') diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 5bc815ee..e4bf0998 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -3,11 +3,11 @@ namespace tests\Wallabag\CoreBundle\Controller; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\AnnotationBundle\Entity\Annotation; use Wallabag\CoreBundle\Entity\Config; -use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; -use Wallabag\AnnotationBundle\Entity\Annotation; +use Wallabag\UserBundle\Entity\User; class ConfigControllerTest extends WallabagCoreTestCase { @@ -17,7 +17,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->request('GET', '/new'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('login', $client->getResponse()->headers->get('location')); } @@ -28,7 +28,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertCount(1, $crawler->filter('button[id=config_save]')); $this->assertCount(1, $crawler->filter('button[id=change_passwd_save]')); @@ -43,7 +43,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=config_save]')->form(); @@ -57,7 +57,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -131,13 +131,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=config_save]')->form(); $crawler = $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); $this->assertContains('This value should not be blank', $alert[0]); @@ -191,13 +191,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=change_passwd_save]')->form(); $crawler = $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); $this->assertContains($expectedMessage, $alert[0]); @@ -210,7 +210,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=change_passwd_save]')->form(); @@ -222,7 +222,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -259,13 +259,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=update_user_save]')->form(); $crawler = $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); $this->assertContains($expectedMessage, $alert[0]); @@ -278,7 +278,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=update_user_save]')->form(); @@ -289,7 +289,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -319,13 +319,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('config.form_rss.no_token', $body[0]); $client->request('GET', '/generate-token'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -346,7 +346,7 @@ class ConfigControllerTest extends WallabagCoreTestCase ['HTTP_X-Requested-With' => 'XMLHttpRequest'] ); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('token', $content); } @@ -358,7 +358,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=rss_config_save]')->form(); @@ -368,7 +368,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -403,13 +403,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=rss_config_save]')->form(); $crawler = $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); $this->assertContains($expectedMessage, $alert[0]); @@ -423,7 +423,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=tagging_rule_save]')->form(); @@ -434,7 +434,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -443,7 +443,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $editLink = $crawler->filter('.mode_edit')->last()->link(); $crawler = $client->click($editLink); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('?tagging-rule=', $client->getResponse()->headers->get('location')); $crawler = $client->followRedirect(); @@ -457,7 +457,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -468,7 +468,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $deleteLink = $crawler->filter('.delete')->last()->link(); $crawler = $client->click($deleteLink); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); $this->assertContains('flashes.config.notice.tagging_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); @@ -510,13 +510,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=tagging_rule_save]')->form(); $crawler = $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); @@ -532,7 +532,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=tagging_rule_save]')->form(); @@ -541,7 +541,7 @@ class ConfigControllerTest extends WallabagCoreTestCase 'tagging_rule[tags]' => 'cool tag', ]); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); @@ -557,9 +557,9 @@ class ConfigControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:TaggingRule') ->findAll()[0]; - $crawler = $client->request('GET', '/tagging-rule/edit/'.$rule->getId()); + $crawler = $client->request('GET', '/tagging-rule/edit/' . $rule->getId()); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('You can not access this tagging rule', $body[0]); } @@ -573,9 +573,9 @@ class ConfigControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:TaggingRule') ->findAll()[0]; - $crawler = $client->request('GET', '/tagging-rule/edit/'.$rule->getId()); + $crawler = $client->request('GET', '/tagging-rule/edit/' . $rule->getId()); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('You can not access this tagging rule', $body[0]); } @@ -591,7 +591,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[id=change_passwd_save]')->form(); @@ -603,7 +603,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $config->set('demo_mode_enabled', 0); @@ -642,7 +642,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertNotContains('config.form_user.delete.button', $body[0]); $client->request('GET', '/account/delete'); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); $user = $em ->getRepository('WallabagUserBundle:User') @@ -692,7 +692,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // that this entry is also deleted $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); $data = [ @@ -700,14 +700,14 @@ class ConfigControllerTest extends WallabagCoreTestCase ]; $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->request('GET', '/config'); $deleteLink = $crawler->filter('.delete-account')->last()->link(); $client->click($deleteLink); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em @@ -767,11 +767,11 @@ class ConfigControllerTest extends WallabagCoreTestCase // reset annotations $crawler = $client->request('GET', '/config#set3'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $crawler = $client->click($crawler->selectLink('config.reset.annotations')->link()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $annotationsReset = $em @@ -783,34 +783,34 @@ class ConfigControllerTest extends WallabagCoreTestCase // reset tags $crawler = $client->request('GET', '/config#set3'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $crawler = $client->click($crawler->selectLink('config.reset.tags')->link()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $tagReset = $em ->getRepository('WallabagCoreBundle:Tag') ->countAllTags($user->getId()); - $this->assertEquals(0, $tagReset, 'Tags were reset'); + $this->assertSame(0, $tagReset, 'Tags were reset'); // reset entries $crawler = $client->request('GET', '/config#set3'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') ->countAllEntriesByUser($user->getId()); - $this->assertEquals(0, $entryReset, 'Entries were reset'); + $this->assertSame(0, $entryReset, 'Entries were reset'); } public function testResetArchivedEntries() @@ -863,24 +863,24 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config#set3'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $crawler = $client->click($crawler->selectLink('config.reset.archived')->link()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') ->countAllEntriesByUser($user->getId()); - $this->assertEquals(1, $entryReset, 'Entries were reset'); + $this->assertSame(1, $entryReset, 'Entries were reset'); $tagReset = $em ->getRepository('WallabagCoreBundle:Tag') ->countAllTags($user->getId()); - $this->assertEquals(1, $tagReset, 'Tags were reset'); + $this->assertSame(1, $tagReset, 'Tags were reset'); $annotationsReset = $em ->getRepository('WallabagAnnotationBundle:Annotation') @@ -920,24 +920,24 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config#set3'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') ->countAllEntriesByUser($user->getId()); - $this->assertEquals(0, $entryReset, 'Entries were reset'); + $this->assertSame(0, $entryReset, 'Entries were reset'); $tagReset = $em ->getRepository('WallabagCoreBundle:Tag') ->countAllTags($user->getId()); - $this->assertEquals(0, $tagReset, 'Tags were reset'); + $this->assertSame(0, $tagReset, 'Tags were reset'); $annotationsReset = $em ->getRepository('WallabagAnnotationBundle:Annotation') diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 7cf28bfe..b528bcdb 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -33,7 +33,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/new'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('login', $client->getResponse()->headers->get('location')); } @@ -45,14 +45,14 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/unread/list'); $crawler = $client->followRedirect(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('quickstart.intro.title', $body[0]); // Test if quickstart is disabled when user has 1 entry $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -61,7 +61,7 @@ class EntryControllerTest extends WallabagCoreTestCase ]; $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); $crawler = $client->request('GET', '/unread/list'); @@ -77,7 +77,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertCount(1, $crawler->filter('input[type=url]')); $this->assertCount(1, $crawler->filter('form[name=entry]')); @@ -95,7 +95,7 @@ class EntryControllerTest extends WallabagCoreTestCase // Good URL $client->request('GET', '/bookmarklet', ['url' => $this->url]); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); $crawler = $client->request('GET', '/'); $this->assertCount(5, $crawler->filter('div[class=entry]')); @@ -116,15 +116,15 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); $crawler = $client->submit($form); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text'])); - $this->assertEquals('This value should not be blank.', $alert[0]); + $this->assertSame('This value should not be blank.', $alert[0]); } /** @@ -137,7 +137,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -147,7 +147,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -157,11 +157,11 @@ class EntryControllerTest extends WallabagCoreTestCase $author = $content->getPublishedBy(); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); - $this->assertEquals($this->url, $content->getUrl()); + $this->assertSame($this->url, $content->getUrl()); $this->assertContains('Google', $content->getTitle()); - $this->assertEquals('fr', $content->getLanguage()); - $this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); - $this->assertEquals('Morgane Tual', $author[0]); + $this->assertSame('fr', $content->getLanguage()); + $this->assertSame('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); + $this->assertSame('Morgane Tual', $author[0]); $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); } @@ -173,7 +173,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -183,7 +183,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -191,10 +191,10 @@ class EntryControllerTest extends WallabagCoreTestCase ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $authors = $content->getPublishedBy(); - $this->assertEquals('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); - $this->assertEquals('fr', $content->getLanguage()); - $this->assertEquals('Raphaël Balenieri, correspondant à Pékin', $authors[0]); - $this->assertEquals('Frédéric Autran, correspondant à New York', $authors[1]); + $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); + $this->assertSame('fr', $content->getLanguage()); + $this->assertSame('Raphaël Balenieri, correspondant à Pékin', $authors[0]); + $this->assertSame('Frédéric Autran, correspondant à New York', $authors[1]); } public function testPostNewOkUrlExist() @@ -210,7 +210,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -220,7 +220,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); } @@ -233,7 +233,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -245,7 +245,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -255,7 +255,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); } @@ -269,7 +269,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -279,7 +279,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('/', $client->getResponse()->getTargetUrl()); $em = $client->getContainer() @@ -291,7 +291,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertCount(2, $tags); $this->assertContains('wallabag', $tags); - $this->assertEquals('en', $entry->getLanguage()); + $this->assertSame('en', $entry->getLanguage()); $em->remove($entry); $em->flush(); @@ -300,7 +300,7 @@ class EntryControllerTest extends WallabagCoreTestCase // related https://github.com/wallabag/wallabag/issues/2121 $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -310,7 +310,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('/', $client->getResponse()->getTargetUrl()); $entry = $em @@ -333,7 +333,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/archive/list'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testUntagged() @@ -343,7 +343,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/untagged/list'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testStarred() @@ -353,7 +353,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/starred/list'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testRangeException() @@ -363,8 +363,8 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/all/list/900'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertSame('/all/list', $client->getResponse()->getTargetUrl()); } public function testView() @@ -379,9 +379,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); - $crawler = $client->request('GET', '/view/'.$entry->getId()); + $crawler = $client->request('GET', '/view/' . $entry->getId()); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains($entry->getTitle(), $body[0]); } @@ -402,9 +402,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $client->request('GET', '/reload/'.$entry->getId()); + $client->request('GET', '/reload/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $entry = $this->getEntityManager() ->getRepository('WallabagCoreBundle:Entry') @@ -423,9 +423,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); - $client->request('GET', '/reload/'.$entry->getId()); + $client->request('GET', '/reload/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); // force EntityManager to clear previous entity // otherwise, retrieve the same entity will retrieve change from the previous request :0 @@ -434,7 +434,7 @@ class EntryControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->find($entry->getId()); - $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); + $this->assertNotSame($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); } public function testEdit() @@ -447,9 +447,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); - $crawler = $client->request('GET', '/edit/'.$entry->getId()); + $crawler = $client->request('GET', '/edit/' . $entry->getId()); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertCount(1, $crawler->filter('input[id=entry_title]')); $this->assertCount(1, $crawler->filter('button[id=entry_save]')); @@ -465,9 +465,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); - $crawler = $client->request('GET', '/edit/'.$entry->getId()); + $crawler = $client->request('GET', '/edit/' . $entry->getId()); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[type=submit]')->form(); @@ -477,7 +477,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -496,16 +496,16 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $client->request('GET', '/archive/'.$entry->getId()); + $client->request('GET', '/archive/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $res = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') ->find($entry->getId()); - $this->assertEquals($res->isArchived(), true); + $this->assertSame($res->isArchived(), true); } public function testToggleStar() @@ -519,16 +519,16 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $client->request('GET', '/star/'.$entry->getId()); + $client->request('GET', '/star/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $res = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') ->findOneById($entry->getId()); - $this->assertEquals($res->isStarred(), true); + $this->assertSame($res->isStarred(), true); } public function testDelete() @@ -541,13 +541,13 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); - $client->request('GET', '/delete/'.$entry->getId()); + $client->request('GET', '/delete/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); - $client->request('GET', '/delete/'.$entry->getId()); + $client->request('GET', '/delete/' . $entry->getId()); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } /** @@ -583,14 +583,14 @@ class EntryControllerTest extends WallabagCoreTestCase $em->persist($content); $em->flush(); - $client->request('GET', '/view/'.$content->getId()); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $client->request('GET', '/view/' . $content->getId()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); - $client->request('GET', '/delete/'.$content->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $client->request('GET', '/delete/' . $content->getId()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testViewOtherUserEntry() @@ -603,9 +603,9 @@ class EntryControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->findOneByUsernameAndNotArchived('bob'); - $client->request('GET', '/view/'.$content->getId()); + $client->request('GET', '/view/' . $content->getId()); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); } public function testFilterOnReadingTime() @@ -793,7 +793,7 @@ class EntryControllerTest extends WallabagCoreTestCase $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D='; - $client->request('GET', 'unread/list'.$parameters); + $client->request('GET', 'unread/list' . $parameters); $this->assertContains($parameters, $client->getResponse()->getContent()); @@ -934,16 +934,16 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->clear(); // no uid - $client->request('GET', '/share/'.$content->getUid()); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $client->request('GET', '/share/' . $content->getUid()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); // generating the uid - $client->request('GET', '/share/'.$content->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $client->request('GET', '/share/' . $content->getId()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); // follow link with uid $crawler = $client->followRedirect(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); @@ -955,19 +955,19 @@ class EntryControllerTest extends WallabagCoreTestCase // sharing is now disabled $client->getContainer()->get('craue_config')->set('share_public', 0); - $client->request('GET', '/share/'.$content->getUid()); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $client->request('GET', '/share/' . $content->getUid()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); - $client->request('GET', '/view/'.$content->getId()); + $client->request('GET', '/view/' . $content->getId()); $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); // removing the share - $client->request('GET', '/share/delete/'.$content->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $client->request('GET', '/share/delete/' . $content->getId()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); // share is now disable - $client->request('GET', '/share/'.$content->getUid()); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $client->request('GET', '/share/' . $content->getUid()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } public function testNewEntryWithDownloadImagesEnabled() @@ -981,7 +981,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -991,7 +991,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $em = $client->getContainer() ->get('doctrine.orm.entity_manager'); @@ -1001,7 +1001,7 @@ class EntryControllerTest extends WallabagCoreTestCase ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); - $this->assertEquals($url, $entry->getUrl()); + $this->assertSame($url, $entry->getUrl()); $this->assertContains('Perpignan', $entry->getTitle()); // instead of checking for the filename (which might change) check that the image is now local $this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent()); @@ -1023,7 +1023,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -1033,16 +1033,16 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') ->findByUrlAndUserId($url, $this->getLoggedInUserId()); - $client->request('GET', '/delete/'.$content->getId()); + $client->request('GET', '/delete/' . $content->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); } @@ -1063,11 +1063,11 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->flush(); - $client->request('GET', '/view/'.$entry->getId()); - $client->request('GET', '/archive/'.$entry->getId()); + $client->request('GET', '/view/' . $entry->getId()); + $client->request('GET', '/archive/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals('/', $client->getResponse()->headers->get('location')); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertSame('/', $client->getResponse()->headers->get('location')); } public function testRedirectToCurrentPage() @@ -1086,11 +1086,11 @@ class EntryControllerTest extends WallabagCoreTestCase $this->getEntityManager()->flush(); - $client->request('GET', '/view/'.$entry->getId()); - $client->request('GET', '/archive/'.$entry->getId()); + $client->request('GET', '/view/' . $entry->getId()); + $client->request('GET', '/archive/' . $entry->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/'.$entry->getId(), $client->getResponse()->headers->get('location')); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertContains('/view/' . $entry->getId(), $client->getResponse()->headers->get('location')); } public function testFilterOnHttpStatus() @@ -1213,7 +1213,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); $this->assertCount(1, $crawler->filter('div[class=entry]')); - $client->request('GET', '/delete/'.$entry->getId()); + $client->request('GET', '/delete/' . $entry->getId()); // test on list of all articles $crawler = $client->request('GET', '/all/list'); @@ -1315,7 +1315,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -1325,7 +1325,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -1333,8 +1333,8 @@ class EntryControllerTest extends WallabagCoreTestCase ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); - $this->assertEquals($url, $content->getUrl()); - $this->assertEquals($expectedLanguage, $content->getLanguage()); + $this->assertSame($url, $content->getUrl()); + $this->assertSame($expectedLanguage, $content->getLanguage()); } /** @@ -1362,7 +1362,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=entry]')->form(); @@ -1372,11 +1372,11 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); $content = $em diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index b38961d3..ba9296af 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -12,7 +12,7 @@ class ExportControllerTest extends WallabagCoreTestCase $client->request('GET', '/export/unread.csv'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('login', $client->getResponse()->headers->get('location')); } @@ -23,7 +23,7 @@ class ExportControllerTest extends WallabagCoreTestCase $client->request('GET', '/export/awesomeness.epub'); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } public function testUnknownFormatExport() @@ -33,7 +33,7 @@ class ExportControllerTest extends WallabagCoreTestCase $client->request('GET', '/export/unread.xslx'); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } public function testUnsupportedFormatExport() @@ -42,15 +42,15 @@ class ExportControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $client->request('GET', '/export/unread.doc'); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') ->findOneByUsernameAndNotArchived('admin'); - $client->request('GET', '/export/'.$content->getId().'.doc'); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $client->request('GET', '/export/' . $content->getId() . '.doc'); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } public function testBadEntryId() @@ -60,7 +60,7 @@ class ExportControllerTest extends WallabagCoreTestCase $client->request('GET', '/export/0.mobi'); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } public function testEpubExport() @@ -72,12 +72,12 @@ class ExportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/export/archive.epub'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/epub+zip', $headers->get('content-type')); - $this->assertEquals('attachment; filename="Archive articles.epub"', $headers->get('content-disposition')); - $this->assertEquals('binary', $headers->get('content-transfer-encoding')); + $this->assertSame('application/epub+zip', $headers->get('content-type')); + $this->assertSame('attachment; filename="Archive articles.epub"', $headers->get('content-disposition')); + $this->assertSame('binary', $headers->get('content-transfer-encoding')); } public function testMobiExport() @@ -91,15 +91,15 @@ class ExportControllerTest extends WallabagCoreTestCase ->findOneByUsernameAndNotArchived('admin'); ob_start(); - $crawler = $client->request('GET', '/export/'.$content->getId().'.mobi'); + $crawler = $client->request('GET', '/export/' . $content->getId() . '.mobi'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/x-mobipocket-ebook', $headers->get('content-type')); - $this->assertEquals('attachment; filename="'.preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()).'.mobi"', $headers->get('content-disposition')); - $this->assertEquals('binary', $headers->get('content-transfer-encoding')); + $this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type')); + $this->assertSame('attachment; filename="' . preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()) . '.mobi"', $headers->get('content-disposition')); + $this->assertSame('binary', $headers->get('content-transfer-encoding')); } public function testPdfExport() @@ -111,23 +111,23 @@ class ExportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/export/all.pdf'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/pdf', $headers->get('content-type')); - $this->assertEquals('attachment; filename="All articles.pdf"', $headers->get('content-disposition')); - $this->assertEquals('binary', $headers->get('content-transfer-encoding')); + $this->assertSame('application/pdf', $headers->get('content-type')); + $this->assertSame('attachment; filename="All articles.pdf"', $headers->get('content-disposition')); + $this->assertSame('binary', $headers->get('content-transfer-encoding')); ob_start(); $crawler = $client->request('GET', '/export/tag_entries.pdf?tag=foo-bar'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/pdf', $headers->get('content-type')); - $this->assertEquals('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition')); - $this->assertEquals('binary', $headers->get('content-transfer-encoding')); + $this->assertSame('application/pdf', $headers->get('content-type')); + $this->assertSame('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition')); + $this->assertSame('binary', $headers->get('content-transfer-encoding')); } public function testTxtExport() @@ -139,12 +139,12 @@ class ExportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/export/all.txt'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('text/plain; charset=UTF-8', $headers->get('content-type')); - $this->assertEquals('attachment; filename="All articles.txt"', $headers->get('content-disposition')); - $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); + $this->assertSame('text/plain; charset=UTF-8', $headers->get('content-type')); + $this->assertSame('attachment; filename="All articles.txt"', $headers->get('content-disposition')); + $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); } public function testCsvExport() @@ -169,19 +169,19 @@ class ExportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/export/archive.csv'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/csv', $headers->get('content-type')); - $this->assertEquals('attachment; filename="Archive articles.csv"', $headers->get('content-disposition')); - $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); + $this->assertSame('application/csv', $headers->get('content-type')); + $this->assertSame('attachment; filename="Archive articles.csv"', $headers->get('content-disposition')); + $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); $csv = str_getcsv($client->getResponse()->getContent(), "\n"); $this->assertGreaterThan(1, $csv); // +1 for title line - $this->assertEquals(count($contentInDB) + 1, count($csv)); - $this->assertEquals('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]); + $this->assertSame(count($contentInDB) + 1, count($csv)); + $this->assertSame('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]); $this->assertContains($contentInDB[0]['title'], $csv[1]); $this->assertContains($contentInDB[0]['url'], $csv[1]); $this->assertContains($contentInDB[0]['content'], $csv[1]); @@ -205,15 +205,15 @@ class ExportControllerTest extends WallabagCoreTestCase ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); ob_start(); - $crawler = $client->request('GET', '/export/'.$contentInDB->getId().'.json'); + $crawler = $client->request('GET', '/export/' . $contentInDB->getId() . '.json'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/json', $headers->get('content-type')); - $this->assertEquals('attachment; filename="'.$contentInDB->getTitle().'.json"', $headers->get('content-disposition')); - $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); + $this->assertSame('application/json', $headers->get('content-type')); + $this->assertSame('attachment; filename="' . $contentInDB->getTitle() . '.json"', $headers->get('content-disposition')); + $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); $content = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('id', $content[0]); @@ -230,16 +230,16 @@ class ExportControllerTest extends WallabagCoreTestCase $this->assertArrayHasKey('created_at', $content[0]); $this->assertArrayHasKey('updated_at', $content[0]); - $this->assertEquals($contentInDB->isArchived(), $content[0]['is_archived']); - $this->assertEquals($contentInDB->isStarred(), $content[0]['is_starred']); - $this->assertEquals($contentInDB->getTitle(), $content[0]['title']); - $this->assertEquals($contentInDB->getUrl(), $content[0]['url']); - $this->assertEquals([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); - $this->assertEquals($contentInDB->getMimetype(), $content[0]['mimetype']); - $this->assertEquals($contentInDB->getLanguage(), $content[0]['language']); - $this->assertEquals($contentInDB->getReadingtime(), $content[0]['reading_time']); - $this->assertEquals($contentInDB->getDomainname(), $content[0]['domain_name']); - $this->assertEquals(['foo bar', 'baz'], $content[0]['tags']); + $this->assertSame($contentInDB->isArchived(), $content[0]['is_archived']); + $this->assertSame($contentInDB->isStarred(), $content[0]['is_starred']); + $this->assertSame($contentInDB->getTitle(), $content[0]['title']); + $this->assertSame($contentInDB->getUrl(), $content[0]['url']); + $this->assertSame([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); + $this->assertSame($contentInDB->getMimetype(), $content[0]['mimetype']); + $this->assertSame($contentInDB->getLanguage(), $content[0]['language']); + $this->assertSame($contentInDB->getReadingtime(), $content[0]['reading_time']); + $this->assertSame($contentInDB->getDomainname(), $content[0]['domain_name']); + $this->assertSame(['foo bar', 'baz'], $content[0]['tags']); } public function testXmlExport() @@ -262,16 +262,16 @@ class ExportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/export/unread.xml'); ob_end_clean(); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $headers = $client->getResponse()->headers; - $this->assertEquals('application/xml', $headers->get('content-type')); - $this->assertEquals('attachment; filename="Unread articles.xml"', $headers->get('content-disposition')); - $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); + $this->assertSame('application/xml', $headers->get('content-type')); + $this->assertSame('attachment; filename="Unread articles.xml"', $headers->get('content-disposition')); + $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); $content = new \SimpleXMLElement($client->getResponse()->getContent()); $this->assertGreaterThan(0, $content->count()); - $this->assertEquals(count($contentInDB), $content->count()); + $this->assertSame(count($contentInDB), $content->count()); $this->assertNotEmpty('id', (string) $content->entry[0]->id); $this->assertNotEmpty('title', (string) $content->entry[0]->title); $this->assertNotEmpty('url', (string) $content->entry[0]->url); diff --git a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php index 530c8bbf..6167fe2d 100644 --- a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php @@ -16,36 +16,36 @@ class RssControllerTest extends WallabagCoreTestCase if (null === $nb) { $this->assertGreaterThan(0, $xpath->query('//item')->length); } else { - $this->assertEquals($nb, $xpath->query('//item')->length); + $this->assertSame($nb, $xpath->query('//item')->length); } - $this->assertEquals(1, $xpath->query('/rss')->length); - $this->assertEquals(1, $xpath->query('/rss/channel')->length); + $this->assertSame(1, $xpath->query('/rss')->length); + $this->assertSame(1, $xpath->query('/rss/channel')->length); - $this->assertEquals(1, $xpath->query('/rss/channel/title')->length); - $this->assertEquals('wallabag - '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); + $this->assertSame(1, $xpath->query('/rss/channel/title')->length); + $this->assertSame('wallabag - ' . $type . ' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); - $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length); + $this->assertSame(1, $xpath->query('/rss/channel/pubDate')->length); - $this->assertEquals(1, $xpath->query('/rss/channel/generator')->length); - $this->assertEquals('wallabag', $xpath->query('/rss/channel/generator')->item(0)->nodeValue); + $this->assertSame(1, $xpath->query('/rss/channel/generator')->length); + $this->assertSame('wallabag', $xpath->query('/rss/channel/generator')->item(0)->nodeValue); - $this->assertEquals(1, $xpath->query('/rss/channel/description')->length); - $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); + $this->assertSame(1, $xpath->query('/rss/channel/description')->length); + $this->assertSame('wallabag ' . $type . ' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); - $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); - $this->assertContains($urlPagination.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); + $this->assertSame(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); + $this->assertContains($urlPagination . '.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); - $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); - $this->assertContains($urlPagination.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); + $this->assertSame(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); + $this->assertContains($urlPagination . '.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); foreach ($xpath->query('//item') as $item) { - $this->assertEquals(1, $xpath->query('title', $item)->length); - $this->assertEquals(1, $xpath->query('source', $item)->length); - $this->assertEquals(1, $xpath->query('link', $item)->length); - $this->assertEquals(1, $xpath->query('guid', $item)->length); - $this->assertEquals(1, $xpath->query('pubDate', $item)->length); - $this->assertEquals(1, $xpath->query('description', $item)->length); + $this->assertSame(1, $xpath->query('title', $item)->length); + $this->assertSame(1, $xpath->query('source', $item)->length); + $this->assertSame(1, $xpath->query('link', $item)->length); + $this->assertSame(1, $xpath->query('guid', $item)->length); + $this->assertSame(1, $xpath->query('pubDate', $item)->length); + $this->assertSame(1, $xpath->query('description', $item)->length); } } @@ -73,7 +73,7 @@ class RssControllerTest extends WallabagCoreTestCase $client->request('GET', $url); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); } public function testUnread() @@ -92,7 +92,7 @@ class RssControllerTest extends WallabagCoreTestCase $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread', 2); } @@ -114,7 +114,7 @@ class RssControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $client->request('GET', '/admin/SUPERTOKEN/starred.xml'); - $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1); + $this->assertSame(200, $client->getResponse()->getStatusCode(), 1); $this->validateDom($client->getResponse()->getContent(), 'starred', 'starred'); } @@ -136,7 +136,7 @@ class RssControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $client->request('GET', '/admin/SUPERTOKEN/archive.xml'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->validateDom($client->getResponse()->getContent(), 'archive', 'archive'); } @@ -158,15 +158,15 @@ class RssControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); } public function testTags() @@ -186,11 +186,11 @@ class RssControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->validateDom($client->getResponse()->getContent(), 'tag (foo bar)', 'tags/foo-bar'); $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); } } diff --git a/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php index 9b8b5702..6005c0df 100644 --- a/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php @@ -17,7 +17,7 @@ class SettingsControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/settings'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testSettingsWithNormalUser() @@ -27,6 +27,6 @@ class SettingsControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/settings'); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); } } diff --git a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php index e73a9743..87ea2867 100644 --- a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php @@ -15,7 +15,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/site-credentials/'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $body = $crawler->filter('body')->extract(['_text'])[0]; @@ -30,7 +30,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/site-credentials/new'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $body = $crawler->filter('body')->extract(['_text'])[0]; @@ -47,7 +47,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -61,9 +61,9 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $credential = $this->createSiteCredential($client); - $crawler = $client->request('GET', '/site-credentials/'.$credential->getId().'/edit'); + $crawler = $client->request('GET', '/site-credentials/' . $credential->getId() . '/edit'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $body = $crawler->filter('body')->extract(['_text'])[0]; @@ -80,7 +80,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -96,9 +96,9 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $this->logInAs('bob'); - $client->request('GET', '/site-credentials/'.$credential->getId().'/edit'); + $client->request('GET', '/site-credentials/' . $credential->getId() . '/edit'); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); } public function testDeleteSiteCredential() @@ -108,15 +108,15 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $credential = $this->createSiteCredential($client); - $crawler = $client->request('GET', '/site-credentials/'.$credential->getId().'/edit'); + $crawler = $client->request('GET', '/site-credentials/' . $credential->getId() . '/edit'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $deleteForm = $crawler->filter('body')->selectButton('site_credential.form.delete')->form(); $client->submit($deleteForm, []); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php b/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php index 98a37b50..17847937 100644 --- a/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php @@ -13,7 +13,7 @@ class StaticControllerTest extends WallabagCoreTestCase $client->request('GET', '/about'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testHowto() @@ -23,6 +23,6 @@ class StaticControllerTest extends WallabagCoreTestCase $client->request('GET', '/howto'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } } 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 $client->request('GET', '/tag/list'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testAddTagToEntry() @@ -31,7 +31,7 @@ class TagControllerTest extends WallabagCoreTestCase $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $crawler = $client->request('GET', '/view/'.$entry->getId()); + $crawler = $client->request('GET', '/view/' . $entry->getId()); $form = $crawler->filter('form[name=tag]')->form(); @@ -40,7 +40,7 @@ class TagControllerTest extends WallabagCoreTestCase ]; $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); // be sure to reload the entry $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); @@ -48,7 +48,7 @@ class TagControllerTest extends WallabagCoreTestCase // tag already exists and already assigned $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); $this->assertCount(1, $entry->getTags()); @@ -59,7 +59,7 @@ class TagControllerTest extends WallabagCoreTestCase ]; $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); $this->assertCount(2, $entry->getTags()); @@ -75,7 +75,7 @@ class TagControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId()); - $crawler = $client->request('GET', '/view/'.$entry->getId()); + $crawler = $client->request('GET', '/view/' . $entry->getId()); $form = $crawler->filter('form[name=tag]')->form(); @@ -84,7 +84,7 @@ class TagControllerTest extends WallabagCoreTestCase ]; $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $newEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -97,8 +97,8 @@ class TagControllerTest extends WallabagCoreTestCase } $this->assertGreaterThanOrEqual(2, count($tags)); - $this->assertNotFalse(array_search('foo2', $tags), 'Tag foo2 is assigned to the entry'); - $this->assertNotFalse(array_search('bar2', $tags), 'Tag bar2 is assigned to the entry'); + $this->assertNotFalse(array_search('foo2', $tags, true), 'Tag foo2 is assigned to the entry'); + $this->assertNotFalse(array_search('bar2', $tags, true), 'Tag bar2 is assigned to the entry'); } public function testRemoveTagFromEntry() @@ -116,27 +116,27 @@ class TagControllerTest extends WallabagCoreTestCase $this->getEntityManager()->clear(); // We make a first request to set an history and test redirection after tag deletion - $client->request('GET', '/view/'.$entry->getId()); + $client->request('GET', '/view/' . $entry->getId()); $entryUri = $client->getRequest()->getUri(); - $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); + $client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId()); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals($entryUri, $client->getResponse()->getTargetUrl()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertSame($entryUri, $client->getResponse()->getTargetUrl()); // re-retrieve the entry to be sure to get fresh data from database (mostly for tags) $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); $this->assertNotContains($this->tagName, $entry->getTags()); - $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); + $client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId()); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertSame(404, $client->getResponse()->getStatusCode()); $tag = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Tag') ->findOneByLabel($this->tagName); - $this->assertNull($tag, $this->tagName.' was removed because it begun an orphan tag'); + $this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag'); } public function testShowEntriesForTagAction() @@ -165,9 +165,9 @@ class TagControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Tag') ->findOneByEntryAndTagLabel($entry, $this->tagName); - $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); + $crawler = $client->request('GET', '/tag/list/' . $tag->getSlug()); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertCount(1, $crawler->filter('[id*="entry-"]')); $entry->removeTag($tag); -- cgit v1.2.3 From 38520658addc217f127b0627ea28dcf8d6e6178c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 3 Jul 2017 07:30:54 +0200 Subject: Fix tests --- tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 9 +++++---- tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/Wallabag/CoreBundle/Controller') diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index b528bcdb..b1c6d53c 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -43,6 +43,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $client->request('GET', '/unread/list'); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); $this->assertSame(200, $client->getResponse()->getStatusCode()); @@ -505,7 +506,7 @@ class EntryControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->find($entry->getId()); - $this->assertSame($res->isArchived(), true); + $this->assertSame(1, $res->isArchived()); } public function testToggleStar() @@ -528,7 +529,7 @@ class EntryControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->findOneById($entry->getId()); - $this->assertSame($res->isStarred(), true); + $this->assertSame(1, $res->isStarred()); } public function testDelete() @@ -1004,7 +1005,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame($url, $entry->getUrl()); $this->assertContains('Perpignan', $entry->getTitle()); // instead of checking for the filename (which might change) check that the image is now local - $this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent()); + $this->assertContains($client->getContainer()->getParameter('domain_name') . '/assets/images/', $entry->getContent()); $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); } @@ -1296,7 +1297,7 @@ class EntryControllerTest extends WallabagCoreTestCase ], 'fucked_list_of_languages' => [ 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', - '', + null, ], 'es-ES' => [ 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google', diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index ba9296af..3e216381 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -230,8 +230,8 @@ class ExportControllerTest extends WallabagCoreTestCase $this->assertArrayHasKey('created_at', $content[0]); $this->assertArrayHasKey('updated_at', $content[0]); - $this->assertSame($contentInDB->isArchived(), $content[0]['is_archived']); - $this->assertSame($contentInDB->isStarred(), $content[0]['is_starred']); + $this->assertSame((int) $contentInDB->isArchived(), $content[0]['is_archived']); + $this->assertSame((int) $contentInDB->isStarred(), $content[0]['is_starred']); $this->assertSame($contentInDB->getTitle(), $content[0]['title']); $this->assertSame($contentInDB->getUrl(), $content[0]['url']); $this->assertSame([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); -- cgit v1.2.3