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 --- .../Controller/AnnotationControllerTest.php | 44 +-- .../WallabagAnnotationTestCase.php | 2 +- .../Controller/DeveloperControllerTest.php | 24 +- .../Controller/EntryRestControllerTest.php | 296 ++++++++++----------- .../ApiBundle/Controller/TagRestControllerTest.php | 38 +-- .../Controller/UserRestControllerTest.php | 54 ++-- .../Controller/WallabagRestControllerTest.php | 4 +- tests/Wallabag/ApiBundle/WallabagApiTestCase.php | 2 +- .../Command/CleanDuplicatesCommandTest.php | 2 +- .../CoreBundle/Command/ExportCommandTest.php | 2 +- .../CoreBundle/Command/InstallCommandTest.php | 20 +- .../CoreBundle/Command/TagAllCommandTest.php | 2 +- .../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 +-- .../Event/Listener/LocaleListenerTest.php | 28 +- .../Event/Listener/UserLocaleListenerTest.php | 4 +- .../Event/Subscriber/TablePrefixSubscriberTest.php | 18 +- .../GrabySiteConfigBuilderTest.php | 10 +- .../CoreBundle/Helper/ContentProxyTest.php | 152 +++++------ .../Wallabag/CoreBundle/Helper/CryptoProxyTest.php | 10 +- .../CoreBundle/Helper/DownloadImagesTest.php | 46 ++-- tests/Wallabag/CoreBundle/Helper/RedirectTest.php | 20 +- .../CoreBundle/Helper/RuleBasedTaggerTest.php | 2 +- .../CoreBundle/Helper/TagsAssignerTest.php | 16 +- .../UsernameRssTokenConverterTest.php | 2 +- tests/Wallabag/CoreBundle/Tools/UtilsTest.php | 2 +- .../CoreBundle/Twig/WallabagExtensionTest.php | 6 +- tests/Wallabag/CoreBundle/WallabagCoreTestCase.php | 14 +- .../ImportBundle/Command/ImportCommandTest.php | 6 +- .../Command/RedisWorkerCommandTest.php | 4 +- .../Consumer/AMQPEntryConsumerTest.php | 4 +- .../Consumer/RedisEntryConsumerTest.php | 2 +- .../Controller/ChromeControllerTest.php | 40 +-- .../Controller/FirefoxControllerTest.php | 40 +-- .../Controller/ImportControllerTest.php | 6 +- .../Controller/InstapaperControllerTest.php | 42 +-- .../Controller/PinboardControllerTest.php | 42 +-- .../Controller/PocketControllerTest.php | 24 +- .../Controller/ReadabilityControllerTest.php | 42 +-- .../Controller/WallabagV1ControllerTest.php | 40 +-- .../Controller/WallabagV2ControllerTest.php | 40 +-- .../ImportBundle/Import/ChromeImportTest.php | 114 ++++---- .../ImportBundle/Import/FirefoxImportTest.php | 114 ++++---- .../ImportBundle/Import/ImportChainTest.php | 2 +- .../ImportBundle/Import/ImportCompilerPassTest.php | 2 +- .../ImportBundle/Import/InstapaperImportTest.php | 142 +++++----- .../ImportBundle/Import/PocketImportTest.php | 150 +++++------ .../ImportBundle/Import/ReadabilityImportTest.php | 114 ++++---- .../ImportBundle/Import/WallabagV1ImportTest.php | 156 +++++------ .../ImportBundle/Import/WallabagV2ImportTest.php | 150 +++++------ .../UserBundle/Controller/ManageControllerTest.php | 16 +- .../AuthenticationFailureListenerTest.php | 6 +- .../EventListener/CreateConfigListenerTest.php | 2 +- .../UserBundle/Mailer/AuthCodeMailerTest.php | 4 +- 60 files changed, 1337 insertions(+), 1337 deletions(-) (limited to 'tests') diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php index 3c94382c..96474468 100644 --- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php @@ -49,12 +49,12 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->logInAs('admin'); } - $this->client->request('GET', $prefixUrl.'/'.$entry->getId().'.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('GET', $prefixUrl . '/' . $entry->getId() . '.json'); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals($annotation->getText(), $content['rows'][0]['text']); + $this->assertSame($annotation->getText(), $content['rows'][0]['text']); // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId()); @@ -88,16 +88,16 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], ], ]); - $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); + $this->client->request('POST', $prefixUrl . '/' . $entry->getId() . '.json', [], [], $headers, $content); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals('Big boss', $content['user']); - $this->assertEquals('v1.0', $content['annotator_schema_version']); - $this->assertEquals('my annotation', $content['text']); - $this->assertEquals('my quote', $content['quote']); + $this->assertSame('Big boss', $content['user']); + $this->assertSame('v1.0', $content['annotator_schema_version']); + $this->assertSame('my annotation', $content['text']); + $this->assertSame('my quote', $content['quote']); /** @var Annotation $annotation */ $annotation = $this->client->getContainer() @@ -105,7 +105,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase ->getRepository('WallabagAnnotationBundle:Annotation') ->findLastAnnotationByPageId($entry->getId(), 1); - $this->assertEquals('my annotation', $annotation->getText()); + $this->assertSame('my annotation', $annotation->getText()); } /** @@ -133,9 +133,9 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], ], ]); - $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); + $this->client->request('POST', $prefixUrl . '/' . $entry->getId() . '.json', [], [], $headers, $content); - $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); + $this->assertSame(400, $this->client->getResponse()->getStatusCode()); } /** @@ -166,21 +166,21 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $content = json_encode([ 'text' => 'a modified annotation', ]); - $this->client->request('PUT', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('PUT', $prefixUrl . '/' . $annotation->getId() . '.json', [], [], $headers, $content); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals('Big boss', $content['user']); - $this->assertEquals('v1.0', $content['annotator_schema_version']); - $this->assertEquals('a modified annotation', $content['text']); - $this->assertEquals('my quote', $content['quote']); + $this->assertSame('Big boss', $content['user']); + $this->assertSame('v1.0', $content['annotator_schema_version']); + $this->assertSame('a modified annotation', $content['text']); + $this->assertSame('my quote', $content['quote']); /** @var Annotation $annotationUpdated */ $annotationUpdated = $em ->getRepository('WallabagAnnotationBundle:Annotation') ->findOneById($annotation->getId()); - $this->assertEquals('a modified annotation', $annotationUpdated->getText()); + $this->assertSame('a modified annotation', $annotationUpdated->getText()); $em->remove($annotationUpdated); $em->flush(); @@ -218,12 +218,12 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $content = json_encode([ 'text' => 'a modified annotation', ]); - $this->client->request('DELETE', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('DELETE', $prefixUrl . '/' . $annotation->getId() . '.json', [], [], $headers, $content); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals('This is my annotation /o/', $content['text']); + $this->assertSame('This is my annotation /o/', $content['text']); $annotationDeleted = $em ->getRepository('WallabagAnnotationBundle:Annotation') diff --git a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php index ef3f1324..105e8add 100644 --- a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php +++ b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php @@ -52,7 +52,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase $loginManager->logInUser($firewallName, $this->user); // save the login token into the session and put it in a cookie - $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); + $container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken())); $container->get('session')->save(); $session = $container->get('session'); diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index 53aed12b..2caeccf5 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php @@ -15,7 +15,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); $crawler = $client->request('GET', '/developer/client/create'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[type=submit]')->form(); @@ -25,7 +25,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); $this->assertGreaterThan(count($nbClients), count($newNbClients)); @@ -47,7 +47,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase 'password' => 'mypassword', ]); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $data = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('access_token', $data); @@ -67,7 +67,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase 'client_secret' => $apiClient->getSecret(), ]); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $data = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('access_token', $data); @@ -84,8 +84,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); $crawler = $client->request('GET', '/developer'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); } public function testDeveloperHowto() @@ -94,7 +94,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $crawler = $client->request('GET', '/developer/howto/first-app'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testRemoveClient() @@ -109,8 +109,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->assertContains('no_client', $client->getResponse()->getContent()); $this->logInAs('bob'); - $client->request('GET', '/developer/client/delete/'.$adminApiClient->getId()); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $client->request('GET', '/developer/client/delete/' . $adminApiClient->getId()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); // Try to remove the admin's client with the good user $this->logInAs('admin'); @@ -123,7 +123,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase ; $client->click($link); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertNull( $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()), @@ -133,8 +133,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase /** * @param string $username + * @param array $grantTypes * - * @param array $grantTypes * @return Client */ private function createApiClientForUser($username, $grantTypes = ['password']) @@ -142,7 +142,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $userManager = $client->getContainer()->get('fos_user.user_manager'); - $user = $userManager->findUserBy(array('username' => $username)); + $user = $userManager->findUserBy(['username' => $username]); $apiClient = new Client($user); $apiClient->setName('My app'); $apiClient->setAllowedGrantTypes($grantTypes); diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index c0391d87..2a333a0d 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -21,19 +21,19 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->markTestSkipped('No content found in db.'); } - $this->client->request('GET', '/api/entries/'.$entry->getId().'.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('GET', '/api/entries/' . $entry->getId() . '.json'); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals($entry->getTitle(), $content['title']); - $this->assertEquals($entry->getUrl(), $content['url']); + $this->assertSame($entry->getTitle(), $content['title']); + $this->assertSame($entry->getUrl(), $content['url']); $this->assertCount(count($entry->getTags()), $content['tags']); - $this->assertEquals($entry->getUserName(), $content['user_name']); - $this->assertEquals($entry->getUserEmail(), $content['user_email']); - $this->assertEquals($entry->getUserId(), $content['user_id']); + $this->assertSame($entry->getUserName(), $content['user_name']); + $this->assertSame($entry->getUserEmail(), $content['user_email']); + $this->assertSame($entry->getUserId(), $content['user_id']); - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testExportEntry() @@ -47,39 +47,39 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->markTestSkipped('No content found in db.'); } - $this->client->request('GET', '/api/entries/'.$entry->getId().'/export.epub'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('GET', '/api/entries/' . $entry->getId() . '/export.epub'); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); // epub format got the content type in the content $this->assertContains('application/epub', $this->client->getResponse()->getContent()); - $this->assertEquals('application/epub+zip', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/epub+zip', $this->client->getResponse()->headers->get('Content-Type')); // re-auth client for mobi $client = $this->createAuthorizedClient(); - $client->request('GET', '/api/entries/'.$entry->getId().'/export.mobi'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $client->request('GET', '/api/entries/' . $entry->getId() . '/export.mobi'); + $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertEquals('application/x-mobipocket-ebook', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/x-mobipocket-ebook', $client->getResponse()->headers->get('Content-Type')); // re-auth client for pdf $client = $this->createAuthorizedClient(); - $client->request('GET', '/api/entries/'.$entry->getId().'/export.pdf'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $client->request('GET', '/api/entries/' . $entry->getId() . '/export.pdf'); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('PDF-', $client->getResponse()->getContent()); - $this->assertEquals('application/pdf', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/pdf', $client->getResponse()->headers->get('Content-Type')); // re-auth client for pdf $client = $this->createAuthorizedClient(); - $client->request('GET', '/api/entries/'.$entry->getId().'/export.txt'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $client->request('GET', '/api/entries/' . $entry->getId() . '/export.txt'); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('text/plain', $client->getResponse()->headers->get('Content-Type')); // re-auth client for pdf $client = $this->createAuthorizedClient(); - $client->request('GET', '/api/entries/'.$entry->getId().'/export.csv'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $client->request('GET', '/api/entries/' . $entry->getId() . '/export.csv'); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('application/csv', $client->getResponse()->headers->get('Content-Type')); } @@ -95,26 +95,26 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->markTestSkipped('No content found in db.'); } - $this->client->request('GET', '/api/entries/'.$entry->getId().'.json'); + $this->client->request('GET', '/api/entries/' . $entry->getId() . '.json'); - $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); + $this->assertSame(403, $this->client->getResponse()->getStatusCode()); } public function testGetEntries() { $this->client->request('GET', '/api/entries'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertNotEmpty($content['_embedded']['items']); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals(1, $content['page']); + $this->assertSame(1, $content['page']); $this->assertGreaterThanOrEqual(1, $content['pages']); - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetEntriesWithFullOptions() @@ -131,15 +131,15 @@ class EntryRestControllerTest extends WallabagApiTestCase 'public' => 0, ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertArrayHasKey('items', $content['_embedded']); $this->assertGreaterThanOrEqual(0, $content['total']); - $this->assertEquals(1, $content['page']); - $this->assertEquals(2, $content['limit']); + $this->assertSame(1, $content['page']); + $this->assertSame(2, $content['limit']); $this->assertGreaterThanOrEqual(1, $content['pages']); $this->assertArrayHasKey('_links', $content); @@ -158,7 +158,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('public=0', $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetEntriesPublicOnly() @@ -183,15 +183,15 @@ class EntryRestControllerTest extends WallabagApiTestCase 'public' => 1, ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertArrayHasKey('items', $content['_embedded']); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals(1, $content['page']); - $this->assertEquals(30, $content['limit']); + $this->assertSame(1, $content['page']); + $this->assertSame(30, $content['limit']); $this->assertGreaterThanOrEqual(1, $content['pages']); $this->assertArrayHasKey('_links', $content); @@ -204,7 +204,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('public=1', $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetEntriesOnPageTwo() @@ -214,27 +214,27 @@ class EntryRestControllerTest extends WallabagApiTestCase 'perPage' => 2, ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(0, $content['total']); - $this->assertEquals(2, $content['page']); - $this->assertEquals(2, $content['limit']); + $this->assertSame(2, $content['page']); + $this->assertSame(2, $content['limit']); } public function testGetStarredEntries() { $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertNotEmpty($content['_embedded']['items']); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals(1, $content['page']); + $this->assertSame(1, $content['page']); $this->assertGreaterThanOrEqual(1, $content['pages']); $this->assertArrayHasKey('_links', $content); @@ -248,21 +248,21 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('sort=updated', $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetArchiveEntries() { $this->client->request('GET', '/api/entries', ['archive' => 1]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertNotEmpty($content['_embedded']['items']); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals(1, $content['page']); + $this->assertSame(1, $content['page']); $this->assertGreaterThanOrEqual(1, $content['pages']); $this->assertArrayHasKey('_links', $content); @@ -275,21 +275,21 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('archive=1', $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetTaggedEntries() { $this->client->request('GET', '/api/entries', ['tags' => 'foo,bar']); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertNotEmpty($content['_embedded']['items']); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals(1, $content['page']); + $this->assertSame(1, $content['page']); $this->assertGreaterThanOrEqual(1, $content['pages']); $this->assertArrayHasKey('_links', $content); @@ -299,24 +299,24 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('tags='.urlencode('foo,bar'), $content['_links'][$link]['href']); + $this->assertContains('tags=' . urlencode('foo,bar'), $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetDatedEntries() { $this->client->request('GET', '/api/entries', ['since' => 1443274283]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertNotEmpty($content['_embedded']['items']); $this->assertGreaterThanOrEqual(1, $content['total']); - $this->assertEquals(1, $content['page']); + $this->assertSame(1, $content['page']); $this->assertGreaterThanOrEqual(1, $content['pages']); $this->assertArrayHasKey('_links', $content); @@ -329,7 +329,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('since=1443274283', $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetDatedSupEntries() @@ -337,15 +337,15 @@ class EntryRestControllerTest extends WallabagApiTestCase $future = new \DateTime(date('Y-m-d H:i:s')); $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThanOrEqual(1, count($content)); $this->assertEmpty($content['_embedded']['items']); - $this->assertEquals(0, $content['total']); - $this->assertEquals(1, $content['page']); - $this->assertEquals(1, $content['pages']); + $this->assertSame(0, $content['total']); + $this->assertSame(1, $content['page']); + $this->assertSame(1, $content['pages']); $this->assertArrayHasKey('_links', $content); $this->assertArrayHasKey('self', $content['_links']); @@ -354,10 +354,10 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('since='.($future->getTimestamp() + 1000), $content['_links'][$link]['href']); + $this->assertContains('since=' . ($future->getTimestamp() + 1000), $content['_links'][$link]['href']); } - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testDeleteEntry() @@ -371,19 +371,19 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->markTestSkipped('No content found in db.'); } - $this->client->request('DELETE', '/api/entries/'.$entry->getId().'.json'); + $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals($entry->getTitle(), $content['title']); - $this->assertEquals($entry->getUrl(), $content['url']); + $this->assertSame($entry->getTitle(), $content['title']); + $this->assertSame($entry->getUrl(), $content['url']); // We'll try to delete this entry again - $this->client->request('DELETE', '/api/entries/'.$entry->getId().'.json'); + $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json'); - $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); + $this->assertSame(404, $this->client->getResponse()->getStatusCode()); } public function testPostEntry() @@ -399,16 +399,16 @@ class EntryRestControllerTest extends WallabagApiTestCase 'public' => 1, ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); - $this->assertEquals(false, $content['is_archived']); - $this->assertEquals(false, $content['is_starred']); - $this->assertEquals('New title for my article', $content['title']); - $this->assertEquals(1, $content['user_id']); + $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame(false, $content['is_archived']); + $this->assertSame(false, $content['is_starred']); + $this->assertSame('New title for my article', $content['title']); + $this->assertSame(1, $content['user_id']); $this->assertCount(2, $content['tags']); $this->assertSame('my content', $content['content']); $this->assertSame('de', $content['language']); @@ -427,14 +427,14 @@ class EntryRestControllerTest extends WallabagApiTestCase 'tags' => 'google, apple', ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); - $this->assertEquals(true, $content['is_archived']); - $this->assertEquals(false, $content['is_starred']); + $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame(true, $content['is_archived']); + $this->assertSame(false, $content['is_starred']); $this->assertCount(3, $content['tags']); } @@ -456,10 +456,10 @@ class EntryRestControllerTest extends WallabagApiTestCase 'url' => 'http://www.example.com/', ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertEquals('http://www.example.com/', $content['url']); + $this->assertSame('http://www.example.com/', $content['url']); } finally { // Remove the created entry to avoid side effects on other tests if (isset($content['id'])) { @@ -479,15 +479,15 @@ class EntryRestControllerTest extends WallabagApiTestCase 'starred' => '1', ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertEquals('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); - $this->assertEquals(true, $content['is_archived']); - $this->assertEquals(true, $content['is_starred']); - $this->assertEquals(1, $content['user_id']); + $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); + $this->assertSame(true, $content['is_archived']); + $this->assertSame(true, $content['is_starred']); + $this->assertSame(1, $content['user_id']); } public function testPostArchivedAndStarredEntryWithoutQuotes() @@ -498,14 +498,14 @@ class EntryRestControllerTest extends WallabagApiTestCase 'starred' => 1, ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertEquals('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); - $this->assertEquals(false, $content['is_archived']); - $this->assertEquals(true, $content['is_starred']); + $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); + $this->assertSame(false, $content['is_archived']); + $this->assertSame(true, $content['is_starred']); } public function testPatchEntry() @@ -522,9 +522,9 @@ class EntryRestControllerTest extends WallabagApiTestCase // hydrate the tags relations $nbTags = count($entry->getTags()); - $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ + $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ 'title' => 'New awesome title', - 'tags' => 'new tag '.uniqid(), + 'tags' => 'new tag ' . uniqid(), 'starred' => '1', 'archive' => '0', 'language' => 'de_AT', @@ -534,20 +534,20 @@ class EntryRestControllerTest extends WallabagApiTestCase 'public' => 0, ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals($entry->getId(), $content['id']); - $this->assertEquals($entry->getUrl(), $content['url']); - $this->assertEquals('New awesome title', $content['title']); + $this->assertSame($entry->getId(), $content['id']); + $this->assertSame($entry->getUrl(), $content['url']); + $this->assertSame('New awesome title', $content['title']); $this->assertGreaterThan($nbTags, count($content['tags'])); - $this->assertEquals(1, $content['user_id']); - $this->assertEquals('de_AT', $content['language']); - $this->assertEquals('http://preview.io/picture.jpg', $content['preview_picture']); + $this->assertSame(1, $content['user_id']); + $this->assertSame('de_AT', $content['language']); + $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']); $this->assertContains('sponge', $content['published_by']); $this->assertContains('bob', $content['published_by']); - $this->assertEquals('awesome', $content['content']); + $this->assertSame('awesome', $content['content']); $this->assertFalse($content['is_public'], 'Entry is no more shared'); } @@ -565,23 +565,23 @@ class EntryRestControllerTest extends WallabagApiTestCase // hydrate the tags relations $nbTags = count($entry->getTags()); - $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ + $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ 'title' => 'New awesome title', - 'tags' => 'new tag '.uniqid(), + 'tags' => 'new tag ' . uniqid(), 'starred' => 1, 'archive' => 0, 'authors' => ['bob', 'sponge'], ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals($entry->getId(), $content['id']); - $this->assertEquals($entry->getUrl(), $content['url']); - $this->assertEquals('New awesome title', $content['title']); + $this->assertSame($entry->getId(), $content['id']); + $this->assertSame($entry->getUrl(), $content['url']); + $this->assertSame('New awesome title', $content['title']); $this->assertGreaterThan($nbTags, count($content['tags'])); - $this->assertTrue(empty($content['published_by']), 'Authors were not saved because of an array instead of a string'); + $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string'); } public function testGetTagsEntry() @@ -602,9 +602,9 @@ class EntryRestControllerTest extends WallabagApiTestCase $tags[] = ['id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()]; } - $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags'); + $this->client->request('GET', '/api/entries/' . $entry->getId() . '/tags'); - $this->assertEquals(json_encode($tags, JSON_HEX_QUOT), $this->client->getResponse()->getContent()); + $this->assertSame(json_encode($tags, JSON_HEX_QUOT), $this->client->getResponse()->getContent()); } public function testPostTagsOnEntry() @@ -622,14 +622,14 @@ class EntryRestControllerTest extends WallabagApiTestCase $newTags = 'tag1,tag2,tag3'; - $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', ['tags' => $newTags]); + $this->client->request('POST', '/api/entries/' . $entry->getId() . '/tags', ['tags' => $newTags]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertArrayHasKey('tags', $content); - $this->assertEquals($nbTags + 3, count($content['tags'])); + $this->assertSame($nbTags + 3, count($content['tags'])); $entryDB = $this->client->getContainer() ->get('doctrine.orm.entity_manager') @@ -662,14 +662,14 @@ class EntryRestControllerTest extends WallabagApiTestCase $nbTags = count($entry->getTags()); $tag = $entry->getTags()[0]; - $this->client->request('DELETE', '/api/entries/'.$entry->getId().'/tags/'.$tag->getId().'.json'); + $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '/tags/' . $tag->getId() . '.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertArrayHasKey('tags', $content); - $this->assertEquals($nbTags - 1, count($content['tags'])); + $this->assertSame($nbTags - 1, count($content['tags'])); } public function testSaveIsArchivedAfterPost() @@ -687,11 +687,11 @@ class EntryRestControllerTest extends WallabagApiTestCase 'url' => $entry->getUrl(), ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals(true, $content['is_archived']); + $this->assertSame(true, $content['is_archived']); } public function testSaveIsStarredAfterPost() @@ -709,11 +709,11 @@ class EntryRestControllerTest extends WallabagApiTestCase 'url' => $entry->getUrl(), ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals(true, $content['is_starred']); + $this->assertSame(true, $content['is_starred']); } public function testSaveIsArchivedAfterPatch() @@ -727,15 +727,15 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->markTestSkipped('No content found in db.'); } - $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ - 'title' => $entry->getTitle().'++', + $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ + 'title' => $entry->getTitle() . '++', ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals(true, $content['is_archived']); + $this->assertSame(true, $content['is_archived']); } public function testSaveIsStarredAfterPatch() @@ -748,15 +748,15 @@ class EntryRestControllerTest extends WallabagApiTestCase if (!$entry) { $this->markTestSkipped('No content found in db.'); } - $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ - 'title' => $entry->getTitle().'++', + $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ + 'title' => $entry->getTitle() . '++', ]); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals(true, $content['is_starred']); + $this->assertSame(true, $content['is_starred']); } public function dataForEntriesExistWithUrl() @@ -780,7 +780,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $this->client->request('GET', $url); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -791,9 +791,9 @@ class EntryRestControllerTest extends WallabagApiTestCase { $url1 = 'http://0.0.0.0/entry2'; $url2 = 'http://0.0.0.0/entry10'; - $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2.'&return_id=1'); + $this->client->request('GET', '/api/entries/exists?urls[]=' . $url1 . '&urls[]=' . $url2 . '&return_id=1'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -807,9 +807,9 @@ class EntryRestControllerTest extends WallabagApiTestCase { $url1 = 'http://0.0.0.0/entry2'; $url2 = 'http://0.0.0.0/entry10'; - $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2); + $this->client->request('GET', '/api/entries/exists?urls[]=' . $url1 . '&urls[]=' . $url2); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -823,18 +823,18 @@ class EntryRestControllerTest extends WallabagApiTestCase { $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals(false, $content['exists']); + $this->assertSame(false, $content['exists']); } public function testGetEntriesExistsWithNoUrl() { $this->client->request('GET', '/api/entries/exists?url='); - $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); + $this->assertSame(403, $this->client->getResponse()->getStatusCode()); } public function testReloadEntryErrorWhileFetching() @@ -847,8 +847,8 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->markTestSkipped('No content found in db.'); } - $this->client->request('PATCH', '/api/entries/'.$entry->getId().'/reload.json'); - $this->assertEquals(304, $this->client->getResponse()->getStatusCode()); + $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '/reload.json'); + $this->assertSame(304, $this->client->getResponse()->getStatusCode()); } public function testReloadEntry() @@ -863,14 +863,14 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->setUp(); - $this->client->request('PATCH', '/api/entries/'.$json['id'].'/reload.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('PATCH', '/api/entries/' . $json['id'] . '/reload.json'); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertNotEmpty($content['title']); - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testPostEntriesTagsListAction() @@ -890,14 +890,14 @@ class EntryRestControllerTest extends WallabagApiTestCase ], ]; - $this->client->request('POST', '/api/entries/tags/lists?list='.json_encode($list)); + $this->client->request('POST', '/api/entries/tags/lists?list=' . json_encode($list)); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertInternalType('int', $content[0]['entry']); - $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']); + $this->assertSame('http://0.0.0.0/entry4', $content[0]['url']); $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') @@ -926,8 +926,8 @@ class EntryRestControllerTest extends WallabagApiTestCase ], ]; - $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode($list)); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list)); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $entry = $em->getRepository('WallabagCoreBundle:Entry')->find($entry->getId()); $this->assertCount(0, $entry->getTags()); @@ -940,17 +940,17 @@ class EntryRestControllerTest extends WallabagApiTestCase 'http://0.0.0.0/entry2', ]; - $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list)); + $this->client->request('POST', '/api/entries/lists?urls=' . json_encode($list)); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertInternalType('int', $content[0]['entry']); - $this->assertEquals('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); + $this->assertSame('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); $this->assertInternalType('int', $content[1]['entry']); - $this->assertEquals('http://0.0.0.0/entry2', $content[1]['url']); + $this->assertSame('http://0.0.0.0/entry2', $content[1]['url']); } public function testDeleteEntriesListAction() @@ -965,17 +965,17 @@ class EntryRestControllerTest extends WallabagApiTestCase 'http://0.0.0.0/test-entry-not-exist', ]; - $this->client->request('DELETE', '/api/entries/list?urls='.json_encode($list)); + $this->client->request('DELETE', '/api/entries/list?urls=' . json_encode($list)); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertTrue($content[0]['entry']); - $this->assertEquals('http://0.0.0.0/test-entry1', $content[0]['url']); + $this->assertSame('http://0.0.0.0/test-entry1', $content[0]['url']); $this->assertFalse($content[1]['entry']); - $this->assertEquals('http://0.0.0.0/test-entry-not-exist', $content[1]['url']); + $this->assertSame('http://0.0.0.0/test-entry-not-exist', $content[1]['url']); } public function testLimitBulkAction() @@ -994,9 +994,9 @@ class EntryRestControllerTest extends WallabagApiTestCase 'http://0.0.0.0/entry1', ]; - $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list)); + $this->client->request('POST', '/api/entries/lists?urls=' . json_encode($list)); - $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); + $this->assertSame(400, $this->client->getResponse()->getStatusCode()); $this->assertContains('API limit reached', $this->client->getResponse()->getContent()); } } diff --git a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php index 7f69bd67..430e548d 100644 --- a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php @@ -11,7 +11,7 @@ class TagRestControllerTest extends WallabagApiTestCase { $this->client->request('GET', '/api/tags.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -33,15 +33,15 @@ class TagRestControllerTest extends WallabagApiTestCase $em->flush(); $em->clear(); - $this->client->request('DELETE', '/api/tags/'.$tag->getId().'.json'); + $this->client->request('DELETE', '/api/tags/' . $tag->getId() . '.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertArrayHasKey('label', $content); - $this->assertEquals($tag->getLabel(), $content['label']); - $this->assertEquals($tag->getSlug(), $content['slug']); + $this->assertSame($tag->getLabel(), $content['label']); + $this->assertSame($tag->getSlug(), $content['slug']); $entries = $em->getRepository('WallabagCoreBundle:Entry') ->findAllByTagId($this->user->getId(), $tag->getId()); @@ -50,7 +50,7 @@ class TagRestControllerTest extends WallabagApiTestCase $tag = $em->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($tagLabel); - $this->assertNull($tag, $tagLabel.' was removed because it begun an orphan tag'); + $this->assertNull($tag, $tagLabel . ' was removed because it begun an orphan tag'); } public function dataForDeletingTagByLabel() @@ -84,18 +84,18 @@ class TagRestControllerTest extends WallabagApiTestCase $em->flush(); if ($useQueryString) { - $this->client->request('DELETE', '/api/tag/label.json?tag='.$tag->getLabel()); + $this->client->request('DELETE', '/api/tag/label.json?tag=' . $tag->getLabel()); } else { $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]); } - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertArrayHasKey('label', $content); - $this->assertEquals($tag->getLabel(), $content['label']); - $this->assertEquals($tag->getSlug(), $content['slug']); + $this->assertSame($tag->getLabel(), $content['label']); + $this->assertSame($tag->getSlug(), $content['slug']); $entries = $this->client->getContainer() ->get('doctrine.orm.entity_manager') @@ -109,7 +109,7 @@ class TagRestControllerTest extends WallabagApiTestCase { $this->client->request('DELETE', '/api/tag/label.json', ['tag' => 'does not exist']); - $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); + $this->assertSame(404, $this->client->getResponse()->getStatusCode()); } /** @@ -140,24 +140,24 @@ class TagRestControllerTest extends WallabagApiTestCase $em->flush(); if ($useQueryString) { - $this->client->request('DELETE', '/api/tags/label.json?tags='.$tag->getLabel().','.$tag2->getLabel()); + $this->client->request('DELETE', '/api/tags/label.json?tags=' . $tag->getLabel() . ',' . $tag2->getLabel()); } else { - $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]); + $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel() . ',' . $tag2->getLabel()]); } - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertCount(2, $content); $this->assertArrayHasKey('label', $content[0]); - $this->assertEquals($tag->getLabel(), $content[0]['label']); - $this->assertEquals($tag->getSlug(), $content[0]['slug']); + $this->assertSame($tag->getLabel(), $content[0]['label']); + $this->assertSame($tag->getSlug(), $content[0]['slug']); $this->assertArrayHasKey('label', $content[1]); - $this->assertEquals($tag2->getLabel(), $content[1]['label']); - $this->assertEquals($tag2->getSlug(), $content[1]['slug']); + $this->assertSame($tag2->getLabel(), $content[1]['label']); + $this->assertSame($tag2->getSlug(), $content[1]['slug']); $entries = $this->client->getContainer() ->get('doctrine.orm.entity_manager') @@ -178,6 +178,6 @@ class TagRestControllerTest extends WallabagApiTestCase { $this->client->request('DELETE', '/api/tags/label.json', ['tags' => 'does not exist']); - $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); + $this->assertSame(404, $this->client->getResponse()->getStatusCode()); } } diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php index 4e65f130..51fac2bd 100644 --- a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php @@ -9,7 +9,7 @@ class UserRestControllerTest extends WallabagApiTestCase public function testGetUser() { $this->client->request('GET', '/api/user.json'); - $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + $this->assertSame(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -20,27 +20,27 @@ class UserRestControllerTest extends WallabagApiTestCase $this->assertArrayHasKey('created_at', $content); $this->assertArrayHasKey('updated_at', $content); - $this->assertEquals('bigboss@wallabag.org', $content['email']); - $this->assertEquals('Big boss', $content['name']); - $this->assertEquals('admin', $content['username']); + $this->assertSame('bigboss@wallabag.org', $content['email']); + $this->assertSame('Big boss', $content['name']); + $this->assertSame('admin', $content['username']); - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetUserWithoutAuthentication() { $client = static::createClient(); $client->request('GET', '/api/user.json'); - $this->assertEquals(401, $client->getResponse()->getStatusCode()); + $this->assertSame(401, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('error', $content); $this->assertArrayHasKey('error_description', $content); - $this->assertEquals('access_denied', $content['error']); + $this->assertSame('access_denied', $content['error']); - $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type')); } public function testCreateNewUser() @@ -52,7 +52,7 @@ class UserRestControllerTest extends WallabagApiTestCase 'email' => 'wallabag@google.com', ]); - $this->assertEquals(201, $this->client->getResponse()->getStatusCode()); + $this->assertSame(201, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -63,15 +63,15 @@ class UserRestControllerTest extends WallabagApiTestCase $this->assertArrayHasKey('updated_at', $content); $this->assertArrayHasKey('default_client', $content); - $this->assertEquals('wallabag@google.com', $content['email']); - $this->assertEquals('google', $content['username']); + $this->assertSame('wallabag@google.com', $content['email']); + $this->assertSame('google', $content['username']); $this->assertArrayHasKey('client_secret', $content['default_client']); $this->assertArrayHasKey('client_id', $content['default_client']); - $this->assertEquals('Default client', $content['default_client']['name']); + $this->assertSame('Default client', $content['default_client']['name']); - $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0); } @@ -88,7 +88,7 @@ class UserRestControllerTest extends WallabagApiTestCase 'client_name' => 'My client name !!', ]); - $this->assertEquals(201, $client->getResponse()->getStatusCode()); + $this->assertSame(201, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); @@ -99,15 +99,15 @@ class UserRestControllerTest extends WallabagApiTestCase $this->assertArrayHasKey('updated_at', $content); $this->assertArrayHasKey('default_client', $content); - $this->assertEquals('wallabag@google.com', $content['email']); - $this->assertEquals('google', $content['username']); + $this->assertSame('wallabag@google.com', $content['email']); + $this->assertSame('google', $content['username']); $this->assertArrayHasKey('client_secret', $content['default_client']); $this->assertArrayHasKey('client_id', $content['default_client']); - $this->assertEquals('My client name !!', $content['default_client']['name']); + $this->assertSame('My client name !!', $content['default_client']['name']); - $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type')); $client->getContainer()->get('craue_config')->set('api_user_registration', 0); } @@ -122,7 +122,7 @@ class UserRestControllerTest extends WallabagApiTestCase 'email' => 'bigboss@wallabag.org', ]); - $this->assertEquals(400, $client->getResponse()->getStatusCode()); + $this->assertSame(400, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); @@ -133,10 +133,10 @@ class UserRestControllerTest extends WallabagApiTestCase // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]); // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]); // This shouldn't be translated ... - $this->assertEquals('This value is already used.', $content['error']['username'][0]); - $this->assertEquals('This value is already used.', $content['error']['email'][0]); + $this->assertSame('This value is already used.', $content['error']['username'][0]); + $this->assertSame('This value is already used.', $content['error']['email'][0]); - $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type')); $client->getContainer()->get('craue_config')->set('api_user_registration', 0); } @@ -151,16 +151,16 @@ class UserRestControllerTest extends WallabagApiTestCase 'email' => 'facebook@wallabag.org', ]); - $this->assertEquals(400, $client->getResponse()->getStatusCode()); + $this->assertSame(400, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('error', $content); $this->assertArrayHasKey('password', $content['error']); - $this->assertEquals('validator.password_too_short', $content['error']['password'][0]); + $this->assertSame('validator.password_too_short', $content['error']['password'][0]); - $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type')); $client->getContainer()->get('craue_config')->set('api_user_registration', 0); } @@ -174,12 +174,12 @@ class UserRestControllerTest extends WallabagApiTestCase 'email' => 'facebook@wallabag.org', ]); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); + $this->assertSame(403, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); $this->assertArrayHasKey('error', $content); - $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); + $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type')); } } diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index df638e8f..ac4d6cdc 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -12,10 +12,10 @@ class WallabagRestControllerTest extends WallabagApiTestCase $client = static::createClient(); $client->request('GET', '/api/version'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $content = json_decode($client->getResponse()->getContent(), true); - $this->assertEquals($client->getContainer()->getParameter('wallabag_core.version'), $content); + $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content); } } diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php index 8709da70..8a188e1c 100644 --- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php +++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php @@ -40,7 +40,7 @@ abstract class WallabagApiTestCase extends WebTestCase $loginManager->logInUser($firewallName, $this->user); // save the login token into the session and put it in a cookie - $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); + $container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken())); $container->get('session')->save(); $session = $container->get('session'); diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php index e6e57f30..38e8dd07 100644 --- a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php @@ -4,8 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\CoreBundle\Command\CleanDuplicatesCommand; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Command\CleanDuplicatesCommand; use Wallabag\CoreBundle\Entity\Entry; class CleanDuplicatesCommandTest extends WallabagCoreTestCase diff --git a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php index 2eebf39b..25de2730 100644 --- a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php @@ -4,8 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\CoreBundle\Command\ExportCommand; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Command\ExportCommand; class ExportCommandTest extends WallabagCoreTestCase { diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 94fc0b94..f684a206 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php @@ -11,9 +11,9 @@ use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\CoreBundle\Command\InstallCommand; use Tests\Wallabag\CoreBundle\Mock\InstallCommandMock; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Command\InstallCommand; class InstallCommandTest extends WallabagCoreTestCase { @@ -86,9 +86,9 @@ class InstallCommandTest extends WallabagCoreTestCase $tester->setInputs([ 'y', // dropping database 'y', // create super admin - 'username_'.uniqid('', true), // username - 'password_'.uniqid('', true), // password - 'email_'.uniqid('', true).'@wallabag.it', // email + 'username_' . uniqid('', true), // username + 'password_' . uniqid('', true), // password + 'email_' . uniqid('', true) . '@wallabag.it', // email ]); $tester->execute([ 'command' => $command->getName(), @@ -111,9 +111,9 @@ class InstallCommandTest extends WallabagCoreTestCase $tester = new CommandTester($command); $tester->setInputs([ 'y', // create super admin - 'username_'.uniqid('', true), // username - 'password_'.uniqid('', true), // password - 'email_'.uniqid('', true).'@wallabag.it', // email + 'username_' . uniqid('', true), // username + 'password_' . uniqid('', true), // password + 'email_' . uniqid('', true) . '@wallabag.it', // email ]); $tester->execute([ 'command' => $command->getName(), @@ -159,9 +159,9 @@ class InstallCommandTest extends WallabagCoreTestCase $tester = new CommandTester($command); $tester->setInputs([ 'y', // create super admin - 'username_'.uniqid('', true), // username - 'password_'.uniqid('', true), // password - 'email_'.uniqid('', true).'@wallabag.it', // email + 'username_' . uniqid('', true), // username + 'password_' . uniqid('', true), // password + 'email_' . uniqid('', true) . '@wallabag.it', // email ]); $tester->execute([ 'command' => $command->getName(), diff --git a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php index 4cde3679..96d0e91f 100644 --- a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php @@ -4,8 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\CoreBundle\Command\TagAllCommand; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Command\TagAllCommand; class TagAllCommandTest extends WallabagCoreTestCase { 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); diff --git a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php index 84a54d3a..0dbd9f70 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php @@ -13,15 +13,6 @@ use Wallabag\CoreBundle\Event\Listener\LocaleListener; class LocaleListenerTest extends \PHPUnit_Framework_TestCase { - private function getEvent(Request $request) - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') - ->disableOriginalConstructor() - ->getMock(); - - return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - } - public function testWithoutSession() { $request = Request::create('/'); @@ -30,7 +21,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $event = $this->getEvent($request); $listener->onKernelRequest($event); - $this->assertEquals('en', $request->getLocale()); + $this->assertSame('en', $request->getLocale()); } public function testWithPreviousSession() @@ -44,7 +35,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $event = $this->getEvent($request); $listener->onKernelRequest($event); - $this->assertEquals('fr', $request->getLocale()); + $this->assertSame('fr', $request->getLocale()); } public function testLocaleFromRequestAttribute() @@ -59,8 +50,8 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $event = $this->getEvent($request); $listener->onKernelRequest($event); - $this->assertEquals('en', $request->getLocale()); - $this->assertEquals('es', $request->getSession()->get('_locale')); + $this->assertSame('en', $request->getLocale()); + $this->assertSame('es', $request->getSession()->get('_locale')); } public function testSubscribedEvents() @@ -81,6 +72,15 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $event ); - $this->assertEquals('fr', $request->getLocale()); + $this->assertSame('fr', $request->getLocale()); + } + + private function getEvent(Request $request) + { + $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') + ->disableOriginalConstructor() + ->getMock(); + + return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); } } diff --git a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php index 45aecc63..91ce0102 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php @@ -32,7 +32,7 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase $listener->onInteractiveLogin($event); - $this->assertEquals('fr', $session->get('_locale')); + $this->assertSame('fr', $session->get('_locale')); } public function testWithoutLanguage() @@ -53,6 +53,6 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase $listener->onInteractiveLogin($event); - $this->assertEquals('', $session->get('_locale')); + $this->assertSame('', $session->get('_locale')); } } diff --git a/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php index b8cd0fad..64e3c6d9 100644 --- a/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php +++ b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php @@ -46,12 +46,12 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); - $this->assertEquals($tableNameExpected, $metaDataEvent->getClassMetadata()->getTableName()); + $this->assertSame($tableNameExpected, $metaDataEvent->getClassMetadata()->getTableName()); $subscriber->loadClassMetadata($metaDataEvent); - $this->assertEquals($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); - $this->assertEquals($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); + $this->assertSame($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); + $this->assertSame($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); } /** @@ -75,8 +75,8 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase $evm->dispatchEvent('loadClassMetadata', $metaDataEvent); - $this->assertEquals($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); - $this->assertEquals($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); + $this->assertSame($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); + $this->assertSame($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); } public function testPrefixManyToMany() @@ -103,12 +103,12 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); - $this->assertEquals('entry', $metaDataEvent->getClassMetadata()->getTableName()); + $this->assertSame('entry', $metaDataEvent->getClassMetadata()->getTableName()); $subscriber->loadClassMetadata($metaDataEvent); - $this->assertEquals('yo_entry', $metaDataEvent->getClassMetadata()->getTableName()); - $this->assertEquals('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']); - $this->assertEquals('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform())); + $this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getTableName()); + $this->assertSame('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']); + $this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform())); } } diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php index b0c81e7b..85036e35 100644 --- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php +++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php @@ -2,13 +2,13 @@ namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; -use Monolog\Handler\TestHandler; -use Monolog\Logger; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use Graby\SiteConfig\SiteConfig as GrabySiteConfig; -use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; -use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Monolog\Handler\TestHandler; +use Monolog\Logger; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase { @@ -68,7 +68,7 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase $config = $this->builder->buildForHost('www.example.com'); - $this->assertEquals( + $this->assertSame( new SiteConfig([ 'host' => 'example.com', 'requiresLogin' => true, diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index dbddbc5c..7e19631b 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -2,18 +2,18 @@ namespace Tests\Wallabag\CoreBundle\Helper; -use Psr\Log\NullLogger; -use Monolog\Logger; +use Graby\Graby; use Monolog\Handler\TestHandler; -use Wallabag\CoreBundle\Helper\ContentProxy; +use Monolog\Logger; +use Psr\Log\NullLogger; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\Validator\RecursiveValidator; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; -use Wallabag\UserBundle\Entity\User; +use Wallabag\CoreBundle\Helper\ContentProxy; use Wallabag\CoreBundle\Helper\RuleBasedTagger; -use Graby\Graby; -use Symfony\Component\Validator\Validator\RecursiveValidator; -use Symfony\Component\Validator\ConstraintViolationList; -use Symfony\Component\Validator\ConstraintViolation; +use Wallabag\UserBundle\Entity\User; class ContentProxyTest extends \PHPUnit_Framework_TestCase { @@ -44,14 +44,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://user@:80'); - $this->assertEquals('http://user@:80', $entry->getUrl()); + $this->assertSame('http://user@:80', $entry->getUrl()); $this->assertEmpty($entry->getTitle()); - $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); + $this->assertSame($this->fetchingErrorMessage, $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getMimetype()); $this->assertEmpty($entry->getLanguage()); - $this->assertEquals(0.0, $entry->getReadingTime()); - $this->assertEquals(false, $entry->getDomainName()); + $this->assertSame(0.0, $entry->getReadingTime()); + $this->assertSame(false, $entry->getDomainName()); } public function testWithEmptyContent() @@ -79,14 +79,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); - $this->assertEquals('http://0.0.0.0', $entry->getUrl()); + $this->assertSame('http://0.0.0.0', $entry->getUrl()); $this->assertEmpty($entry->getTitle()); - $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); + $this->assertSame($this->fetchingErrorMessage, $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getMimetype()); $this->assertEmpty($entry->getLanguage()); - $this->assertEquals(0.0, $entry->getReadingTime()); - $this->assertEquals('0.0.0.0', $entry->getDomainName()); + $this->assertSame(0.0, $entry->getReadingTime()); + $this->assertSame('0.0.0.0', $entry->getDomainName()); } public function testWithEmptyContentButOG() @@ -119,15 +119,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://domain.io'); - $this->assertEquals('http://domain.io', $entry->getUrl()); - $this->assertEquals('my title', $entry->getTitle()); - $this->assertEquals($this->fetchingErrorMessage.'

But we found a short description:

desc', $entry->getContent()); + $this->assertSame('http://domain.io', $entry->getUrl()); + $this->assertSame('my title', $entry->getTitle()); + $this->assertSame($this->fetchingErrorMessage . '

But we found a short description:

desc', $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getLanguage()); $this->assertEmpty($entry->getHttpStatus()); $this->assertEmpty($entry->getMimetype()); - $this->assertEquals(0.0, $entry->getReadingTime()); - $this->assertEquals('domain.io', $entry->getDomainName()); + $this->assertSame(0.0, $entry->getReadingTime()); + $this->assertSame('domain.io', $entry->getDomainName()); } public function testWithContent() @@ -161,15 +161,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); - $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals('200', $entry->getHttpStatus()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); + $this->assertSame('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame('200', $entry->getHttpStatus()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); } public function testWithContentAndNoOgImage() @@ -203,15 +203,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); $this->assertNull($entry->getPreviewPicture()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals('200', $entry->getHttpStatus()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame('200', $entry->getHttpStatus()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); } public function testWithContentAndBadLanguage() @@ -248,14 +248,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); - $this->assertEquals('text/html', $entry->getMimetype()); + $this->assertSame('text/html', $entry->getMimetype()); $this->assertNull($entry->getLanguage()); - $this->assertEquals('200', $entry->getHttpStatus()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); + $this->assertSame('200', $entry->getHttpStatus()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); } public function testWithContentAndBadOgImage() @@ -297,15 +297,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); $this->assertNull($entry->getPreviewPicture()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals('200', $entry->getHttpStatus()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame('200', $entry->getHttpStatus()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); } public function testWithForcedContent() @@ -333,14 +333,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ] ); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); - $this->assertEquals('24/03/2014', $entry->getPublishedAt()->format('d/m/Y')); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); + $this->assertSame('24/03/2014', $entry->getPublishedAt()->format('d/m/Y')); $this->assertContains('Jeremy', $entry->getPublishedBy()); $this->assertContains('Nico', $entry->getPublishedBy()); $this->assertContains('Thomas', $entry->getPublishedBy()); @@ -371,14 +371,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ] ); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); - $this->assertEquals('08/09/2016', $entry->getPublishedAt()->format('d/m/Y')); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); + $this->assertSame('08/09/2016', $entry->getPublishedAt()->format('d/m/Y')); } public function testWithForcedContentAndBadDate() @@ -406,13 +406,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ] ); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertContains('this is my content', $entry->getContent()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals(4.0, $entry->getReadingTime()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame(4.0, $entry->getReadingTime()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); $this->assertNull($entry->getPublishedAt()); $records = $handler->getRecords(); @@ -488,14 +488,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ] ); - $this->assertEquals('http://1.1.1.1', $entry->getUrl()); - $this->assertEquals('this is my title', $entry->getTitle()); + $this->assertSame('http://1.1.1.1', $entry->getUrl()); + $this->assertSame('this is my title', $entry->getTitle()); $this->assertNotContains($escapedString, $entry->getContent()); - $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); - $this->assertEquals('text/html', $entry->getMimetype()); - $this->assertEquals('fr', $entry->getLanguage()); - $this->assertEquals('200', $entry->getHttpStatus()); - $this->assertEquals('1.1.1.1', $entry->getDomainName()); + $this->assertSame('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); + $this->assertSame('text/html', $entry->getMimetype()); + $this->assertSame('fr', $entry->getLanguage()); + $this->assertSame('200', $entry->getHttpStatus()); + $this->assertSame('1.1.1.1', $entry->getDomainName()); } private function getTaggerMock() diff --git a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php index cede8696..782c29c3 100644 --- a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php @@ -2,9 +2,9 @@ namespace Tests\Wallabag\CoreBundle\Helper; -use Psr\Log\NullLogger; -use Monolog\Logger; use Monolog\Handler\TestHandler; +use Monolog\Logger; +use Psr\Log\NullLogger; use Wallabag\CoreBundle\Helper\CryptoProxy; class CryptoProxyTest extends \PHPUnit_Framework_TestCase @@ -14,7 +14,7 @@ class CryptoProxyTest extends \PHPUnit_Framework_TestCase $logHandler = new TestHandler(); $logger = new Logger('test', [$logHandler]); - $crypto = new CryptoProxy(sys_get_temp_dir().'/'.uniqid('', true).'.txt', $logger); + $crypto = new CryptoProxy(sys_get_temp_dir() . '/' . uniqid('', true) . '.txt', $logger); $crypted = $crypto->crypt('test'); $decrypted = $crypto->decrypt($crypted); @@ -27,14 +27,14 @@ class CryptoProxyTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Decrypt fail * * @return [type] [description] */ public function testDecryptBadValue() { - $crypto = new CryptoProxy(sys_get_temp_dir().'/'.uniqid('', true).'.txt', new NullLogger()); + $crypto = new CryptoProxy(sys_get_temp_dir() . '/' . uniqid('', true) . '.txt', new NullLogger()); $crypto->decrypt('badvalue'); } } diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php index c02f9658..c61f65d0 100644 --- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php +++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php @@ -2,13 +2,13 @@ namespace Tests\Wallabag\CoreBundle\Helper; -use Wallabag\CoreBundle\Helper\DownloadImages; -use Monolog\Logger; -use Monolog\Handler\TestHandler; use GuzzleHttp\Client; -use GuzzleHttp\Subscriber\Mock; use GuzzleHttp\Message\Response; use GuzzleHttp\Stream\Stream; +use GuzzleHttp\Subscriber\Mock; +use Monolog\Handler\TestHandler; +use Monolog\Logger; +use Wallabag\CoreBundle\Helper\DownloadImages; class DownloadImagesTest extends \PHPUnit_Framework_TestCase { @@ -34,15 +34,15 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client = new Client(); $mock = new Mock([ - new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), + new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/unnamed.png'))), ]); $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processHtml(123, $html, $url); @@ -61,9 +61,9 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processHtml(123, '
', 'http://imgur.com/gallery/WxtWY'); $this->assertContains('http://i.imgur.com/T9qgcHc.jpg', $res, 'Image were not replace because of content-type'); @@ -87,18 +87,18 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client = new Client(); $mock = new Mock([ - new Response(200, ['content-type' => $header], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), + new Response(200, ['content-type' => $header], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/unnamed.png'))), ]); $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); - $this->assertContains('/assets/images/9/b/9b0ead26/ebe60399.'.$extension, $res); + $this->assertContains('/assets/images/9/b/9b0ead26/ebe60399.' . $extension, $res); } public function testProcessSingleImageWithBadUrl() @@ -112,9 +112,9 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); $this->assertFalse($res, 'Image can not be found, so it will not be replaced'); @@ -131,9 +131,9 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processSingleImage(123, 'http://i.imgur.com/T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); $this->assertFalse($res, 'Image can not be loaded, so it will not be replaced'); @@ -144,15 +144,15 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client = new Client(); $mock = new Mock([ - new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), + new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/unnamed.png'))), ]); $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processSingleImage(123, '/i.imgur.com/T9qgcHc.jpg', 'imgur.com/gallery/WxtWY'); $this->assertFalse($res, 'Absolute image can not be determined, so it will not be replaced'); @@ -163,15 +163,15 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $client = new Client(); $mock = new Mock([ - new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__.'/../fixtures/image-no-content-type.jpg'))), + new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))), ]); $client->getEmitter()->attach($mock); $logHandler = new TestHandler(); - $logger = new Logger('test', array($logHandler)); + $logger = new Logger('test', [$logHandler]); - $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processSingleImage( 123, diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php index f420d06a..7fd2ea2b 100644 --- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php +++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php @@ -2,11 +2,11 @@ namespace Tests\Wallabag\CoreBundle\Helper; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Wallabag\CoreBundle\Entity\Config; -use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Helper\Redirect; -use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Wallabag\UserBundle\Entity\User; class RedirectTest extends \PHPUnit_Framework_TestCase { @@ -56,21 +56,21 @@ class RedirectTest extends \PHPUnit_Framework_TestCase { $redirectUrl = $this->redirect->to(null, 'fallback'); - $this->assertEquals('fallback', $redirectUrl); + $this->assertSame('fallback', $redirectUrl); } public function testRedirectToNullWithoutFallback() { $redirectUrl = $this->redirect->to(null); - $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); + $this->assertSame($this->routerMock->generate('homepage'), $redirectUrl); } public function testRedirectToValidUrl() { $redirectUrl = $this->redirect->to('/unread/list'); - $this->assertEquals('/unread/list', $redirectUrl); + $this->assertSame('/unread/list', $redirectUrl); } public function testWithNotLoggedUser() @@ -78,7 +78,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase $redirect = new Redirect($this->routerMock, new TokenStorage()); $redirectUrl = $redirect->to('/unread/list'); - $this->assertEquals('/unread/list', $redirectUrl); + $this->assertSame('/unread/list', $redirectUrl); } public function testUserForRedirectToHomepage() @@ -87,7 +87,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase $redirectUrl = $this->redirect->to('/unread/list'); - $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); + $this->assertSame($this->routerMock->generate('homepage'), $redirectUrl); } public function testUserForRedirectWithIgnoreActionMarkAsRead() @@ -96,7 +96,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase $redirectUrl = $this->redirect->to('/unread/list', '', true); - $this->assertEquals('/unread/list', $redirectUrl); + $this->assertSame('/unread/list', $redirectUrl); } public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead() @@ -105,6 +105,6 @@ class RedirectTest extends \PHPUnit_Framework_TestCase $redirectUrl = $this->redirect->to(null, 'fallback', true); - $this->assertEquals('fallback', $redirectUrl); + $this->assertSame('fallback', $redirectUrl); } } diff --git a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php index 1e21f400..c31af680 100644 --- a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php +++ b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php @@ -182,7 +182,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase $tags = $entry->getTags(); $this->assertCount(1, $tags); - $this->assertEquals('hey', $tags[0]->getLabel()); + $this->assertSame('hey', $tags[0]->getLabel()); } } diff --git a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php index 6d6d6484..475cd349 100644 --- a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php +++ b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php @@ -5,8 +5,8 @@ namespace Tests\Wallabag\CoreBundle\Helper; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Helper\TagsAssigner; -use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Repository\TagRepository; +use Wallabag\UserBundle\Entity\User; class TagsAssignerTest extends \PHPUnit_Framework_TestCase { @@ -20,8 +20,8 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase $tagsAssigner->assignTagsToEntry($entry, [' tag1', 'tag2 ']); $this->assertCount(2, $entry->getTags()); - $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); - $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); + $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); + $this->assertSame('tag2', $entry->getTags()[1]->getLabel()); } public function testAssignTagsWithString() @@ -34,8 +34,8 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); $this->assertCount(2, $entry->getTags()); - $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); - $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); + $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); + $this->assertSame('tag2', $entry->getTags()[1]->getLabel()); } public function testAssignTagsWithEmptyArray() @@ -76,8 +76,8 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); $this->assertCount(2, $entry->getTags()); - $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); - $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); + $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); + $this->assertSame('tag2', $entry->getTags()[1]->getLabel()); } public function testAssignTagsNotFlushed() @@ -96,7 +96,7 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase $tagsAssigner->assignTagsToEntry($entry, 'tag1', [$tagEntity]); $this->assertCount(1, $entry->getTags()); - $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); + $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); } private function getTagRepositoryMock() diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php index ca8e0d50..74c645ef 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php @@ -212,6 +212,6 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase $converter->apply($request, $params); - $this->assertEquals($user, $request->attributes->get('user')); + $this->assertSame($user, $request->attributes->get('user')); } } diff --git a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php index 435c25ca..4521e485 100644 --- a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php +++ b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php @@ -18,7 +18,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase public function examples() { $examples = []; - $finder = (new Finder())->in(__DIR__.'/samples'); + $finder = (new Finder())->in(__DIR__ . '/samples'); foreach ($finder->getIterator() as $file) { $examples[] = [$file->getContents(), 1]; } diff --git a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php index b1c8c946..ceec4b37 100644 --- a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php +++ b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php @@ -26,8 +26,8 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); - $this->assertEquals('lemonde.fr', $extension->removeWww('www.lemonde.fr')); - $this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr')); - $this->assertEquals('gist.github.com', $extension->removeWww('gist.github.com')); + $this->assertSame('lemonde.fr', $extension->removeWww('www.lemonde.fr')); + $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr')); + $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com')); } } diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php index eec6939d..1eda5199 100644 --- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php +++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php @@ -18,11 +18,6 @@ abstract class WallabagCoreTestCase extends WebTestCase */ private $client = null; - public function getClient() - { - return $this->client; - } - public function setUp() { parent::setUp(); @@ -30,6 +25,11 @@ abstract class WallabagCoreTestCase extends WebTestCase $this->client = static::createClient(); } + public function getClient() + { + return $this->client; + } + public function resetDatabase(Client $client) { $application = new Application($client->getKernel()); @@ -83,10 +83,10 @@ abstract class WallabagCoreTestCase extends WebTestCase $loginManager = $container->get('fos_user.security.login_manager'); $firewallName = $container->getParameter('fos_user.firewall_name'); - $user = $userManager->findUserBy(array('username' => $username)); + $user = $userManager->findUserBy(['username' => $username]); $loginManager->logInUser($firewallName, $user); - $session->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); + $session->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken())); $session->save(); $cookie = new Cookie($session->getName(), $session->getId()); diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php index f507563c..8bed180a 100644 --- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php +++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php @@ -4,8 +4,8 @@ namespace Tests\Wallabag\ImportBundle\Command; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\ImportBundle\Command\ImportCommand; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\ImportBundle\Command\ImportCommand; class ImportCommandTest extends WallabagCoreTestCase { @@ -74,7 +74,7 @@ class ImportCommandTest extends WallabagCoreTestCase $tester->execute([ 'command' => $command->getName(), 'username' => 'admin', - 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', + 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir') . '/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', '--importer' => 'v2', ]); @@ -93,7 +93,7 @@ class ImportCommandTest extends WallabagCoreTestCase $tester->execute([ 'command' => $command->getName(), 'username' => 1, - 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', + 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir') . '/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', '--useUserId' => true, '--importer' => 'v2', ]); diff --git a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php index e5e251a0..af62550c 100644 --- a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php +++ b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php @@ -2,11 +2,11 @@ namespace Tests\Wallabag\ImportBundle\Command; +use M6Web\Component\RedisMock\RedisMockFactory; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\ImportBundle\Command\RedisWorkerCommand; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\ImportBundle\Command\RedisWorkerCommand; class RedisWorkerCommandTest extends WallabagCoreTestCase { diff --git a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php index a989ec7f..52b98a0b 100644 --- a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php @@ -2,10 +2,10 @@ namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; -use Wallabag\ImportBundle\Consumer\AMQPEntryConsumer; use PhpAmqpLib\Message\AMQPMessage; -use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Consumer\AMQPEntryConsumer; +use Wallabag\UserBundle\Entity\User; class AMQPEntryConsumerTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php index 78bd83ba..9506ff63 100644 --- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php @@ -2,9 +2,9 @@ namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; +use Wallabag\CoreBundle\Entity\Entry; use Wallabag\ImportBundle\Consumer\RedisEntryConsumer; use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; class RedisEntryConsumerTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php index 8e9f65e3..3873ccf4 100644 --- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class ChromeControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/chrome'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportChromeWithRabbitEnabled() @@ -28,9 +28,9 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/chrome'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportChromeWithRedisEnabled() @@ -61,13 +61,13 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/chrome'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks'); + $file = new UploadedFile(__DIR__ . '/../fixtures/chrome-bookmarks', 'Bookmarks'); $data = [ 'upload_import_file[file]' => $file, @@ -75,7 +75,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -95,7 +95,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/chrome'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks'); + $file = new UploadedFile(__DIR__ . '/../fixtures/chrome-bookmarks', 'Bookmarks'); $data = [ 'upload_import_file[file]' => $file, @@ -103,7 +103,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -120,11 +120,11 @@ class ChromeControllerTest extends WallabagCoreTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); - $this->assertEquals(1, count($content->getTags())); + $this->assertSame(1, count($content->getTags())); $createdAt = $content->getCreatedAt(); - $this->assertEquals('2011', $createdAt->format('Y')); - $this->assertEquals('07', $createdAt->format('m')); + $this->assertSame('2011', $createdAt->format('Y')); + $this->assertSame('07', $createdAt->format('m')); } public function testImportWallabagWithEmptyFile() @@ -135,7 +135,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/chrome'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -143,7 +143,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 5354439c..5e1260b1 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class FirefoxControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/firefox'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportFirefoxWithRabbitEnabled() @@ -28,9 +28,9 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/firefox'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportFirefoxWithRedisEnabled() @@ -61,13 +61,13 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/firefox'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/firefox-bookmarks.json', 'Bookmarks'); + $file = new UploadedFile(__DIR__ . '/../fixtures/firefox-bookmarks.json', 'Bookmarks'); $data = [ 'upload_import_file[file]' => $file, @@ -75,7 +75,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -95,7 +95,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/firefox'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/firefox-bookmarks.json', 'Bookmarks'); + $file = new UploadedFile(__DIR__ . '/../fixtures/firefox-bookmarks.json', 'Bookmarks'); $data = [ 'upload_import_file[file]' => $file, @@ -103,7 +103,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -121,7 +121,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); - $this->assertEquals(3, count($content->getTags())); + $this->assertSame(3, count($content->getTags())); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -136,8 +136,8 @@ class FirefoxControllerTest extends WallabagCoreTestCase $this->assertEmpty($content->getLanguage(), 'Language for https://stackoverflow.com is ok'); $createdAt = $content->getCreatedAt(); - $this->assertEquals('2013', $createdAt->format('Y')); - $this->assertEquals('12', $createdAt->format('m')); + $this->assertSame('2013', $createdAt->format('Y')); + $this->assertSame('12', $createdAt->format('m')); } public function testImportWallabagWithEmptyFile() @@ -148,7 +148,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/firefox'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -156,7 +156,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php index 5e57dcef..e1ec7c65 100644 --- a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php @@ -12,7 +12,7 @@ class ImportControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/'); - $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 ImportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(8, $crawler->filter('blockquote')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(8, $crawler->filter('blockquote')->count()); } } diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index 84742e0a..067cf3dc 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class InstapaperControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportInstapaperWithRabbitEnabled() @@ -28,9 +28,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportInstapaperWithRedisEnabled() @@ -61,13 +61,13 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper.csv'); + $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper.csv'); $data = [ 'upload_import_file[file]' => $file, @@ -75,7 +75,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -95,7 +95,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper.csv'); + $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper.csv'); $data = [ 'upload_import_file[file]' => $file, @@ -103,7 +103,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -122,7 +122,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); - $this->assertEquals(1, count($content->getTags())); + $this->assertSame(1, count($content->getTags())); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); $content = $client->getContainer() @@ -136,7 +136,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertContains('foot', $content->getTags()); $this->assertContains('test_tag', $content->getTags()); - $this->assertEquals(2, count($content->getTags())); + $this->assertSame(2, count($content->getTags())); } public function testImportInstapaperWithFileAndMarkAllAsRead() @@ -147,7 +147,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper-read.csv'); + $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper-read.csv'); $data = [ 'upload_import_file[file]' => $file, @@ -156,7 +156,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -192,7 +192,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -200,7 +200,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php index e2b6e7b6..c307f96c 100644 --- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class PinboardControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pinboard'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportPinboardWithRabbitEnabled() @@ -28,9 +28,9 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pinboard'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportPinboardWithRedisEnabled() @@ -61,13 +61,13 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pinboard'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/pinboard_export', 'pinboard.json'); $data = [ 'upload_import_file[file]' => $file, @@ -75,7 +75,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -95,7 +95,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pinboard'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/pinboard_export', 'pinboard.json'); $data = [ 'upload_import_file[file]' => $file, @@ -103,7 +103,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -126,10 +126,10 @@ class PinboardControllerTest extends WallabagCoreTestCase $this->assertContains('foot', $tags, 'It includes the "foot" tag'); $this->assertContains('varnish', $tags, 'It includes the "varnish" tag'); $this->assertContains('PHP', $tags, 'It includes the "PHP" tag'); - $this->assertEquals(3, count($tags)); + $this->assertSame(3, count($tags)); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); - $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); + $this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); } public function testImportPinboardWithFileAndMarkAllAsRead() @@ -140,7 +140,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pinboard'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard-read.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/pinboard_export', 'pinboard-read.json'); $data = [ 'upload_import_file[file]' => $file, @@ -149,7 +149,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -185,7 +185,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pinboard'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -193,7 +193,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php index 7d6a300f..17ce1a2a 100644 --- a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php @@ -13,8 +13,8 @@ class PocketControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pocket'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('button[type=submit]')->count()); } public function testImportPocketWithRabbitEnabled() @@ -26,8 +26,8 @@ class PocketControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pocket'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('button[type=submit]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -42,8 +42,8 @@ class PocketControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/pocket'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('button[type=submit]')->count()); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } @@ -55,7 +55,7 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/auth'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); } public function testImportPocketAuth() @@ -76,7 +76,7 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/auth'); - $this->assertEquals(301, $client->getResponse()->getStatusCode()); + $this->assertSame(301, $client->getResponse()->getStatusCode()); $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location')); } @@ -98,9 +98,9 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/callback'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); - $this->assertEquals('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); + $this->assertSame('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); } public function testImportPocketCallback() @@ -132,8 +132,8 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/callback'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); - $this->assertEquals('flashes.import.notice.summary', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); + $this->assertSame('flashes.import.notice.summary', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php index bde0a600..e1915150 100644 --- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class ReadabilityControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/readability'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportReadabilityWithRabbitEnabled() @@ -28,9 +28,9 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/readability'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportReadabilityWithRedisEnabled() @@ -61,13 +61,13 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/readability'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/readability.json', 'readability.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/readability.json', 'readability.json'); $data = [ 'upload_import_file[file]' => $file, @@ -75,7 +75,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -95,7 +95,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/readability'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/readability.json', 'readability.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/readability.json', 'readability.json'); $data = [ 'upload_import_file[file]' => $file, @@ -103,7 +103,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -124,10 +124,10 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $tags = $content->getTags(); $this->assertContains('foot', $tags, 'It includes the "foot" tag'); - $this->assertEquals(1, count($tags)); + $this->assertSame(1, count($tags)); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); - $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); + $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); } public function testImportReadabilityWithFileAndMarkAllAsRead() @@ -138,7 +138,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/readability'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/readability-read.json', 'readability-read.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/readability-read.json', 'readability-read.json'); $data = [ 'upload_import_file[file]' => $file, @@ -147,7 +147,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -183,7 +183,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/readability'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -191,7 +191,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index 2c492c20..25625c35 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class WallabagV1ControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v1'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportWallabagWithRabbitEnabled() @@ -28,9 +28,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v1'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportWallabagWithRedisEnabled() @@ -62,13 +62,13 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v1'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); $data = [ 'upload_import_file[file]' => $file, @@ -76,7 +76,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -96,7 +96,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v1'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); $data = [ 'upload_import_file[file]' => $file, @@ -104,7 +104,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -126,7 +126,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $tags = $content->getTags(); $this->assertContains('foot', $tags, 'It includes the "foot" tag'); $this->assertContains('Framabag', $tags, 'It includes the "Framabag" tag'); - $this->assertEquals(2, count($tags)); + $this->assertSame(2, count($tags)); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); } @@ -139,7 +139,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v1'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); $data = [ 'upload_import_file[file]' => $file, @@ -148,7 +148,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -184,7 +184,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v1'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -192,7 +192,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php index 24893259..a94adcaf 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class WallabagV2ControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v2'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportWallabagWithRabbitEnabled() @@ -28,9 +28,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v2'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportWallabagWithRedisEnabled() @@ -62,13 +62,13 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v2'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); $data = [ 'upload_import_file[file]' => $file, @@ -76,7 +76,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -96,7 +96,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v2'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); + $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); $data = [ 'upload_import_file[file]' => $file, @@ -104,7 +104,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -126,7 +126,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $tags = $content->getTags(); $this->assertContains('foot', $tags, 'It includes the "foot" tag'); - $this->assertEquals(1, count($tags)); + $this->assertSame(1, count($tags)); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -144,10 +144,10 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $this->assertContains('foot', $tags, 'It includes the "foot" tag'); $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag'); $this->assertContains('blog', $tags, 'It includes the "blog" tag'); - $this->assertEquals(3, count($tags)); + $this->assertSame(3, count($tags)); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); - $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); + $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); $this->assertTrue($content->isStarred(), 'Entry is starred'); } @@ -159,7 +159,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/wallabag-v2'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -167,7 +167,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php index cec19534..5559ac7e 100644 --- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\ImportBundle\Import\ChromeImport; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\ChromeImport; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class ChromeImportTest extends \PHPUnit_Framework_TestCase { @@ -19,56 +19,19 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase protected $contentProxy; protected $tagsAssigner; - private function getChromeImport($unsetUser = false, $dispatched = 0) - { - $this->user = new User(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $wallabag->setLogger($logger); - - if (false === $unsetUser) { - $wallabag->setUser($this->user); - } - - return $wallabag; - } - public function testInit() { $chromeImport = $this->getChromeImport(); - $this->assertEquals('Chrome', $chromeImport->getName()); + $this->assertSame('Chrome', $chromeImport->getName()); $this->assertNotEmpty($chromeImport->getUrl()); - $this->assertEquals('import.chrome.description', $chromeImport->getDescription()); + $this->assertSame('import.chrome.description', $chromeImport->getDescription()); } public function testImport() { $chromeImport = $this->getChromeImport(false, 1); - $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); + $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -95,13 +58,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase $res = $chromeImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary()); } public function testImportAndMarkAllAsRead() { $chromeImport = $this->getChromeImport(false, 1); - $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); + $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -133,13 +96,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary()); } public function testImportWithRabbit() { $chromeImport = $this->getChromeImport(); - $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); + $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -173,13 +136,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase $res = $chromeImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary()); } public function testImportWithRedis() { $chromeImport = $this->getChromeImport(); - $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); + $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -211,7 +174,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase $res = $chromeImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary()); $this->assertNotEmpty($redisMock->lpop('chrome')); } @@ -219,7 +182,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase public function testImportBadFile() { $chromeImport = $this->getChromeImport(); - $chromeImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); + $chromeImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx'); $res = $chromeImport->import(); @@ -227,13 +190,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportUserNotDefined() { $chromeImport = $this->getChromeImport(true); - $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); + $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks'); $res = $chromeImport->import(); @@ -241,6 +204,43 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); + } + + private function getChromeImport($unsetUser = false, $dispatched = 0) + { + $this->user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $wallabag->setLogger($logger); + + if (false === $unsetUser) { + $wallabag->setUser($this->user); + } + + return $wallabag; } } diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php index c186c820..a1783bfc 100644 --- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\ImportBundle\Import\FirefoxImport; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\FirefoxImport; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class FirefoxImportTest extends \PHPUnit_Framework_TestCase { @@ -19,56 +19,19 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase protected $contentProxy; protected $tagsAssigner; - private function getFirefoxImport($unsetUser = false, $dispatched = 0) - { - $this->user = new User(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $wallabag->setLogger($logger); - - if (false === $unsetUser) { - $wallabag->setUser($this->user); - } - - return $wallabag; - } - public function testInit() { $firefoxImport = $this->getFirefoxImport(); - $this->assertEquals('Firefox', $firefoxImport->getName()); + $this->assertSame('Firefox', $firefoxImport->getName()); $this->assertNotEmpty($firefoxImport->getUrl()); - $this->assertEquals('import.firefox.description', $firefoxImport->getDescription()); + $this->assertSame('import.firefox.description', $firefoxImport->getDescription()); } public function testImport() { $firefoxImport = $this->getFirefoxImport(false, 2); - $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); + $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -95,13 +58,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $res = $firefoxImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $firefoxImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 2, 'queued' => 0], $firefoxImport->getSummary()); } public function testImportAndMarkAllAsRead() { $firefoxImport = $this->getFirefoxImport(false, 1); - $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); + $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -133,13 +96,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary()); + $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary()); } public function testImportWithRabbit() { $firefoxImport = $this->getFirefoxImport(); - $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); + $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -173,13 +136,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $res = $firefoxImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary()); } public function testImportWithRedis() { $firefoxImport = $this->getFirefoxImport(); - $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); + $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -211,7 +174,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $res = $firefoxImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary()); $this->assertNotEmpty($redisMock->lpop('firefox')); } @@ -219,7 +182,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase public function testImportBadFile() { $firefoxImport = $this->getFirefoxImport(); - $firefoxImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); + $firefoxImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx'); $res = $firefoxImport->import(); @@ -227,13 +190,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportUserNotDefined() { $firefoxImport = $this->getFirefoxImport(true); - $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); + $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json'); $res = $firefoxImport->import(); @@ -241,6 +204,43 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); + } + + private function getFirefoxImport($unsetUser = false, $dispatched = 0) + { + $this->user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $wallabag->setLogger($logger); + + if (false === $unsetUser) { + $wallabag->setUser($this->user); + } + + return $wallabag; } } diff --git a/tests/Wallabag/ImportBundle/Import/ImportChainTest.php b/tests/Wallabag/ImportBundle/Import/ImportChainTest.php index 32568ce5..a9a9915e 100644 --- a/tests/Wallabag/ImportBundle/Import/ImportChainTest.php +++ b/tests/Wallabag/ImportBundle/Import/ImportChainTest.php @@ -16,6 +16,6 @@ class ImportChainTest extends \PHPUnit_Framework_TestCase $importChain->addImport($import, 'alias'); $this->assertCount(1, $importChain->getAll()); - $this->assertEquals($import, $importChain->getAll()['alias']); + $this->assertSame($import, $importChain->getAll()['alias']); } } diff --git a/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php b/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php index 71a007a9..207054f4 100644 --- a/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php +++ b/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php @@ -36,7 +36,7 @@ class ImportCompilerPassTest extends \PHPUnit_Framework_TestCase $this->assertTrue($definition->hasMethodCall('addImport')); $calls = $definition->getMethodCalls(); - $this->assertEquals('pocket', $calls[0][1][1]); + $this->assertSame('pocket', $calls[0][1][1]); } protected function process(ContainerBuilder $container) diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php index 9158c8a2..274dc326 100644 --- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\ImportBundle\Import\InstapaperImport; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\InstapaperImport; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class InstapaperImportTest extends \PHPUnit_Framework_TestCase { @@ -20,70 +20,19 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase protected $tagsAssigner; protected $uow; - private function getInstapaperImport($unsetUser = false, $dispatched = 0) - { - $this->user = new User(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') - ->disableOriginalConstructor() - ->getMock(); - - $this->em - ->expects($this->any()) - ->method('getUnitOfWork') - ->willReturn($this->uow); - - $this->uow - ->expects($this->any()) - ->method('getScheduledEntityInsertions') - ->willReturn([]); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $import->setLogger($logger); - - if (false === $unsetUser) { - $import->setUser($this->user); - } - - return $import; - } - public function testInit() { $instapaperImport = $this->getInstapaperImport(); - $this->assertEquals('Instapaper', $instapaperImport->getName()); + $this->assertSame('Instapaper', $instapaperImport->getName()); $this->assertNotEmpty($instapaperImport->getUrl()); - $this->assertEquals('import.instapaper.description', $instapaperImport->getDescription()); + $this->assertSame('import.instapaper.description', $instapaperImport->getDescription()); } public function testImport() { $instapaperImport = $this->getInstapaperImport(false, 4); - $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); + $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -110,13 +59,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase $res = $instapaperImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 4, 'queued' => 0], $instapaperImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 4, 'queued' => 0], $instapaperImport->getSummary()); } public function testImportAndMarkAllAsRead() { $instapaperImport = $this->getInstapaperImport(false, 1); - $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); + $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -148,13 +97,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 3, 'imported' => 1, 'queued' => 0], $instapaperImport->getSummary()); + $this->assertSame(['skipped' => 3, 'imported' => 1, 'queued' => 0], $instapaperImport->getSummary()); } public function testImportWithRabbit() { $instapaperImport = $this->getInstapaperImport(); - $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); + $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -188,13 +137,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase $res = $instapaperImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary()); } public function testImportWithRedis() { $instapaperImport = $this->getInstapaperImport(); - $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); + $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -226,7 +175,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase $res = $instapaperImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary()); $this->assertNotEmpty($redisMock->lpop('instapaper')); } @@ -234,7 +183,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase public function testImportBadFile() { $instapaperImport = $this->getInstapaperImport(); - $instapaperImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); + $instapaperImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx'); $res = $instapaperImport->import(); @@ -242,13 +191,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('InstapaperImport: unable to read file', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportUserNotDefined() { $instapaperImport = $this->getInstapaperImport(true); - $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); + $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv'); $res = $instapaperImport->import(); @@ -256,6 +205,57 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('InstapaperImport: user is not defined', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); + } + + private function getInstapaperImport($unsetUser = false, $dispatched = 0) + { + $this->user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') + ->disableOriginalConstructor() + ->getMock(); + + $this->em + ->expects($this->any()) + ->method('getUnitOfWork') + ->willReturn($this->uow); + + $this->uow + ->expects($this->any()) + ->method('getScheduledEntityInsertions') + ->willReturn([]); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $import->setLogger($logger); + + if (false === $unsetUser) { + $import->setUser($this->user); + } + + return $import; } } diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php index b81ebe15..fe59f867 100644 --- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php @@ -2,19 +2,19 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\CoreBundle\Entity\Config; -use Wallabag\ImportBundle\Import\PocketImport; use GuzzleHttp\Client; -use GuzzleHttp\Subscriber\Mock; use GuzzleHttp\Message\Response; use GuzzleHttp\Stream\Stream; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use GuzzleHttp\Subscriber\Mock; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Config; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\PocketImport; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class PocketImportTest extends \PHPUnit_Framework_TestCase { @@ -26,66 +26,13 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase protected $tagsAssigner; protected $uow; - private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) - { - $this->user = new User(); - - $config = new Config($this->user); - $config->setPocketConsumerKey('xxx'); - - $this->user->setConfig($config); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') - ->disableOriginalConstructor() - ->getMock(); - - $this->em - ->expects($this->any()) - ->method('getUnitOfWork') - ->willReturn($this->uow); - - $this->uow - ->expects($this->any()) - ->method('getScheduledEntityInsertions') - ->willReturn([]); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); - $pocket->setUser($this->user); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $pocket->setLogger($logger); - - return $pocket; - } - public function testInit() { $pocketImport = $this->getPocketImport(); - $this->assertEquals('Pocket', $pocketImport->getName()); + $this->assertSame('Pocket', $pocketImport->getName()); $this->assertNotEmpty($pocketImport->getUrl()); - $this->assertEquals('import.pocket.description', $pocketImport->getDescription()); + $this->assertSame('import.pocket.description', $pocketImport->getDescription()); } public function testOAuthRequest() @@ -103,7 +50,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect'); - $this->assertEquals('wunderbar_code', $code); + $this->assertSame('wunderbar_code', $code); } public function testOAuthRequestBadResponse() @@ -125,7 +72,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('PocketImport: Failed to request token', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testOAuthAuthorize() @@ -144,7 +91,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $res = $pocketImport->authorize('wunderbar_code'); $this->assertTrue($res); - $this->assertEquals('wunderbar_token', $pocketImport->getAccessToken()); + $this->assertSame('wunderbar_token', $pocketImport->getAccessToken()); } public function testOAuthAuthorizeBadResponse() @@ -166,7 +113,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('PocketImport: Failed to authorize client', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } /** @@ -291,7 +238,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $res = $pocketImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary()); + $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary()); } /** @@ -386,7 +333,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $res = $pocketImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $pocketImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 2, 'queued' => 0], $pocketImport->getSummary()); } /** @@ -425,7 +372,7 @@ JSON; { "status": 1, "list": { - "229279690": '.$body.' + "229279690": ' . $body . ' } } ')), @@ -472,7 +419,7 @@ JSON; $res = $pocketImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary()); } /** @@ -511,7 +458,7 @@ JSON; { "status": 1, "list": { - "229279690": '.$body.' + "229279690": ' . $body . ' } } ')), @@ -551,7 +498,7 @@ JSON; $res = $pocketImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary()); $this->assertNotEmpty($redisMock->lpop('pocket')); } @@ -577,7 +524,7 @@ JSON; $records = $this->logHandler->getRecords(); $this->assertContains('PocketImport: Failed to import', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportWithExceptionFromGraby() @@ -630,6 +577,59 @@ JSON; $res = $pocketImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary()); + } + + private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) + { + $this->user = new User(); + + $config = new Config($this->user); + $config->setPocketConsumerKey('xxx'); + + $this->user->setConfig($config); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') + ->disableOriginalConstructor() + ->getMock(); + + $this->em + ->expects($this->any()) + ->method('getUnitOfWork') + ->willReturn($this->uow); + + $this->uow + ->expects($this->any()) + ->method('getScheduledEntityInsertions') + ->willReturn([]); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); + $pocket->setUser($this->user); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $pocket->setLogger($logger); + + return $pocket; } } diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php index 8f466d38..1822cdaa 100644 --- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\ImportBundle\Import\ReadabilityImport; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\ReadabilityImport; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class ReadabilityImportTest extends \PHPUnit_Framework_TestCase { @@ -19,56 +19,19 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase protected $contentProxy; protected $tagsAssigner; - private function getReadabilityImport($unsetUser = false, $dispatched = 0) - { - $this->user = new User(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $wallabag->setLogger($logger); - - if (false === $unsetUser) { - $wallabag->setUser($this->user); - } - - return $wallabag; - } - public function testInit() { $readabilityImport = $this->getReadabilityImport(); - $this->assertEquals('Readability', $readabilityImport->getName()); + $this->assertSame('Readability', $readabilityImport->getName()); $this->assertNotEmpty($readabilityImport->getUrl()); - $this->assertEquals('import.readability.description', $readabilityImport->getDescription()); + $this->assertSame('import.readability.description', $readabilityImport->getDescription()); } public function testImport() { $readabilityImport = $this->getReadabilityImport(false, 3); - $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); + $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -95,13 +58,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $res = $readabilityImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 3, 'queued' => 0], $readabilityImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 3, 'queued' => 0], $readabilityImport->getSummary()); } public function testImportAndMarkAllAsRead() { $readabilityImport = $this->getReadabilityImport(false, 1); - $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability-read.json'); + $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability-read.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -133,13 +96,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $readabilityImport->getSummary()); + $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $readabilityImport->getSummary()); } public function testImportWithRabbit() { $readabilityImport = $this->getReadabilityImport(); - $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); + $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -173,13 +136,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $res = $readabilityImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary()); } public function testImportWithRedis() { $readabilityImport = $this->getReadabilityImport(); - $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); + $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -211,7 +174,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $res = $readabilityImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary()); $this->assertNotEmpty($redisMock->lpop('readability')); } @@ -219,7 +182,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase public function testImportBadFile() { $readabilityImport = $this->getReadabilityImport(); - $readabilityImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); + $readabilityImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx'); $res = $readabilityImport->import(); @@ -227,13 +190,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('ReadabilityImport: unable to read file', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportUserNotDefined() { $readabilityImport = $this->getReadabilityImport(true); - $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); + $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json'); $res = $readabilityImport->import(); @@ -241,6 +204,43 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('ReadabilityImport: user is not defined', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); + } + + private function getReadabilityImport($unsetUser = false, $dispatched = 0) + { + $this->user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $wallabag->setLogger($logger); + + if (false === $unsetUser) { + $wallabag->setUser($this->user); + } + + return $wallabag; } } diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php index 834b7ef5..822ad694 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\ImportBundle\Import\WallabagV1Import; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\WallabagV1Import; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase { @@ -22,77 +22,19 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase protected $fetchingErrorMessageTitle = 'No title found'; protected $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please troubleshoot this issue.'; - private function getWallabagV1Import($unsetUser = false, $dispatched = 0) - { - $this->user = new User(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') - ->disableOriginalConstructor() - ->getMock(); - - $this->em - ->expects($this->any()) - ->method('getUnitOfWork') - ->willReturn($this->uow); - - $this->uow - ->expects($this->any()) - ->method('getScheduledEntityInsertions') - ->willReturn([]); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $wallabag = new WallabagV1Import( - $this->em, - $this->contentProxy, - $this->tagsAssigner, - $dispatcher, - $this->fetchingErrorMessageTitle, - $this->fetchingErrorMessage - ); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $wallabag->setLogger($logger); - - if (false === $unsetUser) { - $wallabag->setUser($this->user); - } - - return $wallabag; - } - public function testInit() { $wallabagV1Import = $this->getWallabagV1Import(); - $this->assertEquals('wallabag v1', $wallabagV1Import->getName()); + $this->assertSame('wallabag v1', $wallabagV1Import->getName()); $this->assertNotEmpty($wallabagV1Import->getUrl()); - $this->assertEquals('import.wallabag_v1.description', $wallabagV1Import->getDescription()); + $this->assertSame('import.wallabag_v1.description', $wallabagV1Import->getDescription()); } public function testImport() { $wallabagV1Import = $this->getWallabagV1Import(false, 1); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -119,13 +61,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV1Import->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $wallabagV1Import->getSummary()); + $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $wallabagV1Import->getSummary()); } public function testImportAndMarkAllAsRead() { $wallabagV1Import = $this->getWallabagV1Import(false, 3); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1-read.json'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1-read.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -157,13 +99,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 3, 'queued' => 0], $wallabagV1Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 3, 'queued' => 0], $wallabagV1Import->getSummary()); } public function testImportWithRabbit() { $wallabagV1Import = $this->getWallabagV1Import(); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -197,13 +139,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV1Import->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); } public function testImportWithRedis() { $wallabagV1Import = $this->getWallabagV1Import(); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -235,7 +177,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV1Import->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); $this->assertNotEmpty($redisMock->lpop('wallabag_v1')); } @@ -243,7 +185,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase public function testImportBadFile() { $wallabagV1Import = $this->getWallabagV1Import(); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx'); $res = $wallabagV1Import->import(); @@ -251,13 +193,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('WallabagImport: unable to read file', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportUserNotDefined() { $wallabagV1Import = $this->getWallabagV1Import(true); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json'); $res = $wallabagV1Import->import(); @@ -265,6 +207,64 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); + } + + private function getWallabagV1Import($unsetUser = false, $dispatched = 0) + { + $this->user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') + ->disableOriginalConstructor() + ->getMock(); + + $this->em + ->expects($this->any()) + ->method('getUnitOfWork') + ->willReturn($this->uow); + + $this->uow + ->expects($this->any()) + ->method('getScheduledEntityInsertions') + ->willReturn([]); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new WallabagV1Import( + $this->em, + $this->contentProxy, + $this->tagsAssigner, + $dispatcher, + $this->fetchingErrorMessageTitle, + $this->fetchingErrorMessage + ); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $wallabag->setLogger($logger); + + if (false === $unsetUser) { + $wallabag->setUser($this->user); + } + + return $wallabag; } } diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index 5cc04aa5..fab50a45 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\ImportBundle\Import; -use Wallabag\ImportBundle\Import\WallabagV2Import; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\ImportBundle\Redis\Producer; -use Monolog\Logger; +use M6Web\Component\RedisMock\RedisMockFactory; use Monolog\Handler\TestHandler; +use Monolog\Logger; use Simpleue\Queue\RedisQueue; -use M6Web\Component\RedisMock\RedisMockFactory; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\ImportBundle\Import\WallabagV2Import; +use Wallabag\ImportBundle\Redis\Producer; +use Wallabag\UserBundle\Entity\User; class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase { @@ -20,70 +20,19 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase protected $tagsAssigner; protected $uow; - private function getWallabagV2Import($unsetUser = false, $dispatched = 0) - { - $this->user = new User(); - - $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') - ->disableOriginalConstructor() - ->getMock(); - - $this->em - ->expects($this->any()) - ->method('getUnitOfWork') - ->willReturn($this->uow); - - $this->uow - ->expects($this->any()) - ->method('getScheduledEntityInsertions') - ->willReturn([]); - - $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') - ->disableOriginalConstructor() - ->getMock(); - - $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $dispatcher - ->expects($this->exactly($dispatched)) - ->method('dispatch'); - - $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); - - $this->logHandler = new TestHandler(); - $logger = new Logger('test', [$this->logHandler]); - $wallabag->setLogger($logger); - - if (false === $unsetUser) { - $wallabag->setUser($this->user); - } - - return $wallabag; - } - public function testInit() { $wallabagV2Import = $this->getWallabagV2Import(); - $this->assertEquals('wallabag v2', $wallabagV2Import->getName()); + $this->assertSame('wallabag v2', $wallabagV2Import->getName()); $this->assertNotEmpty($wallabagV2Import->getUrl()); - $this->assertEquals('import.wallabag_v2.description', $wallabagV2Import->getDescription()); + $this->assertSame('import.wallabag_v2.description', $wallabagV2Import->getDescription()); } public function testImport() { $wallabagV2Import = $this->getWallabagV2Import(false, 2); - $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); + $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -106,13 +55,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV2Import->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); + $this->assertSame(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); } public function testImportAndMarkAllAsRead() { $wallabagV2Import = $this->getWallabagV2Import(false, 2); - $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); + $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2-read.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -144,13 +93,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); } public function testImportWithRabbit() { $wallabagV2Import = $this->getWallabagV2Import(); - $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); + $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -180,13 +129,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV2Import->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary()); } public function testImportWithRedis() { $wallabagV2Import = $this->getWallabagV2Import(); - $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); + $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -214,7 +163,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV2Import->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary()); $this->assertNotEmpty($redisMock->lpop('wallabag_v2')); } @@ -222,7 +171,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase public function testImportBadFile() { $wallabagV1Import = $this->getWallabagV2Import(); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.jsonx'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.jsonx'); $res = $wallabagV1Import->import(); @@ -230,13 +179,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('WallabagImport: unable to read file', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportUserNotDefined() { $wallabagV1Import = $this->getWallabagV2Import(true); - $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); + $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json'); $res = $wallabagV1Import->import(); @@ -244,24 +193,24 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $records = $this->logHandler->getRecords(); $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); - $this->assertEquals('ERROR', $records[0]['level_name']); + $this->assertSame('ERROR', $records[0]['level_name']); } public function testImportEmptyFile() { $wallabagV2Import = $this->getWallabagV2Import(); - $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-empty.json'); + $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2-empty.json'); $res = $wallabagV2Import->import(); $this->assertFalse($res); - $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 0], $wallabagV2Import->getSummary()); + $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 0], $wallabagV2Import->getSummary()); } public function testImportWithExceptionFromGraby() { $wallabagV2Import = $this->getWallabagV2Import(false, 2); - $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); + $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -284,6 +233,57 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase $res = $wallabagV2Import->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); + $this->assertSame(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); + } + + private function getWallabagV2Import($unsetUser = false, $dispatched = 0) + { + $this->user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork') + ->disableOriginalConstructor() + ->getMock(); + + $this->em + ->expects($this->any()) + ->method('getUnitOfWork') + ->willReturn($this->uow); + + $this->uow + ->expects($this->any()) + ->method('getScheduledEntityInsertions') + ->willReturn([]); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $wallabag->setLogger($logger); + + if (false === $unsetUser) { + $wallabag->setUser($this->user); + } + + return $wallabag; } } diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php index b46256a6..adc2cf09 100644 --- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php +++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php @@ -12,7 +12,7 @@ class ManageControllerTest extends WallabagCoreTestCase $client->request('GET', '/users/list'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertContains('login', $client->getResponse()->headers->get('location')); } @@ -23,16 +23,16 @@ class ManageControllerTest extends WallabagCoreTestCase // Create a new user in the database $crawler = $client->request('GET', '/users/list'); - $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/'); + $this->assertSame(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/'); $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link()); // Fill in the form and submit it - $form = $crawler->selectButton('user.form.save')->form(array( + $form = $crawler->selectButton('user.form.save')->form([ 'new_user[username]' => 'test_user', 'new_user[email]' => 'test@test.io', 'new_user[plainPassword][first]' => 'testtest', 'new_user[plainPassword][second]' => 'testtest', - )); + ]); $client->submit($form); $client->followRedirect(); @@ -44,12 +44,12 @@ class ManageControllerTest extends WallabagCoreTestCase // Edit the user $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link()); - $form = $crawler->selectButton('user.form.save')->form(array( + $form = $crawler->selectButton('user.form.save')->form([ 'user[name]' => 'Foo User', 'user[username]' => 'test_user', 'user[email]' => 'test@test.io', 'user[enabled]' => true, - )); + ]); $client->submit($form); $crawler = $client->followRedirect(); @@ -73,10 +73,10 @@ class ManageControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); - $crawler = $client->request('GET', '/users/'.$this->getLoggedInUserId().'/edit'); + $crawler = $client->request('GET', '/users/' . $this->getLoggedInUserId() . '/edit'); $disabled = $crawler->selectButton('user.form.delete')->extract('disabled'); - $this->assertEquals('disabled', $disabled[0]); + $this->assertSame('disabled', $disabled[0]); } public function testUserSearch() diff --git a/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php b/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php index 6191ea13..9e33cdca 100644 --- a/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php +++ b/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php @@ -2,14 +2,14 @@ namespace Tests\Wallabag\UserBundle\EventListener; +use Monolog\Handler\TestHandler; +use Monolog\Logger; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; -use Wallabag\UserBundle\EventListener\AuthenticationFailureListener; -use Monolog\Logger; -use Monolog\Handler\TestHandler; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Security\Core\AuthenticationEvents; use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent; +use Wallabag\UserBundle\EventListener\AuthenticationFailureListener; class AuthenticationFailureListenerTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php index 01796ded..e5a145b8 100644 --- a/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php +++ b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php @@ -8,8 +8,8 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Wallabag\CoreBundle\Entity\Config; -use Wallabag\UserBundle\EventListener\CreateConfigListener; use Wallabag\UserBundle\Entity\User; +use Wallabag\UserBundle\EventListener\CreateConfigListener; class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php index 21412da6..7381ccf1 100644 --- a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php +++ b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php @@ -68,8 +68,8 @@ TWIG; $msg = $this->spool->getMessages()[0]; $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); - $this->assertEquals(['nobody@test.io' => 'wallabag test'], $msg->getFrom()); - $this->assertEquals('subject', $msg->getSubject()); + $this->assertSame(['nobody@test.io' => 'wallabag test'], $msg->getFrom()); + $this->assertSame('subject', $msg->getSubject()); $this->assertContains('text body http://0.0.0.0/support', $msg->toString()); $this->assertContains('html body 666666', $msg->toString()); } -- cgit v1.2.3