From 732ec8a2eb8dd94de9826bf926554c52b2d00220 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 15 Jun 2020 13:37:50 +0200 Subject: [PATCH] Fix deprecated method in tests --- .../Controller/DeveloperControllerTest.php | 4 +- .../Controller/EntryRestControllerTest.php | 46 +++++------ .../Controller/SearchRestControllerTest.php | 4 +- .../Command/CleanDuplicatesCommandTest.php | 10 +-- .../CoreBundle/Command/ExportCommandTest.php | 13 ++- .../Command/GenerateUrlHashesCommandTest.php | 10 +-- .../CoreBundle/Command/InstallCommandTest.php | 58 ++++++------- .../Command/ListUserCommandTest.php | 8 +- .../Command/ReloadEntryCommandTest.php | 8 +- .../Command/ShowUserCommandTest.php | 21 +++-- .../CoreBundle/Command/TagAllCommandTest.php | 13 ++- .../Controller/ConfigControllerTest.php | 82 +++++++++---------- .../Controller/EntryControllerTest.php | 64 +++++++-------- .../Controller/ExportControllerTest.php | 18 ++-- .../Controller/FeedControllerTest.php | 6 +- ...IgnoreOriginInstanceRuleControllerTest.php | 24 +++--- .../Controller/SecurityControllerTest.php | 10 +-- .../SiteCredentialControllerTest.php | 18 ++-- .../Controller/TagControllerTest.php | 8 +- .../CoreBundle/Helper/ContentProxyTest.php | 20 ++--- .../CoreBundle/Helper/CryptoProxyTest.php | 13 ++- .../CoreBundle/Helper/DownloadImagesTest.php | 14 ++-- .../UsernameFeedTokenConverterTest.php | 7 +- .../Command/ImportCommandTest.php | 27 +++--- .../Command/RedisWorkerCommandTest.php | 18 ++-- .../Controller/ChromeControllerTest.php | 6 +- .../Controller/ElcuratorControllerTest.php | 4 +- .../Controller/FirefoxControllerTest.php | 6 +- .../Controller/ImportControllerTest.php | 2 +- .../Controller/InstapaperControllerTest.php | 8 +- .../Controller/PinboardControllerTest.php | 8 +- .../Controller/PocketControllerTest.php | 6 +- .../Controller/ReadabilityControllerTest.php | 8 +- .../Controller/WallabagV1ControllerTest.php | 8 +- .../Controller/WallabagV2ControllerTest.php | 6 +- .../ImportBundle/Import/ChromeImportTest.php | 6 +- .../ImportBundle/Import/FirefoxImportTest.php | 6 +- .../Import/InstapaperImportTest.php | 6 +- .../ImportBundle/Import/PocketImportTest.php | 12 +-- .../Import/ReadabilityImportTest.php | 6 +- .../Import/WallabagV1ImportTest.php | 6 +- .../Import/WallabagV2ImportTest.php | 6 +- .../Controller/ManageControllerTest.php | 2 +- .../UserBundle/Mailer/AuthCodeMailerTest.php | 4 +- 44 files changed, 314 insertions(+), 326 deletions(-) diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index e3d692906..fecd616d3 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php @@ -31,7 +31,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(\count($nbClients), \count($newNbClients)); $this->assertGreaterThan(1, $alert = $crawler->filter('.settings table strong')->extract(['_text'])); - $this->assertContains('My app', $alert[0]); + $this->assertStringContainsString('My app', $alert[0]); } public function testCreateToken() @@ -100,7 +100,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase // Try to remove an admin's client with a wrong user $this->logInAs('bob'); $client->request('GET', '/developer'); - $this->assertContains('no_client', $client->getResponse()->getContent()); + $this->assertStringContainsString('no_client', $client->getResponse()->getContent()); $this->logInAs('bob'); $client->request('GET', '/developer/client/delete/' . $adminApiClient->getId()); diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 8b7898eea..644727448 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -70,7 +70,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $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->assertStringContainsString('application/epub', $this->client->getResponse()->getContent()); $this->assertSame('application/epub+zip', $this->client->getResponse()->headers->get('Content-Type')); // re-auth client for mobi @@ -85,7 +85,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $client->request('GET', '/api/entries/' . $entry->getId() . '/export.pdf'); $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains('PDF-', $client->getResponse()->getContent()); + $this->assertStringContainsString('PDF-', $client->getResponse()->getContent()); $this->assertSame('application/pdf', $client->getResponse()->headers->get('Content-Type')); // re-auth client for pdf @@ -93,14 +93,14 @@ class EntryRestControllerTest extends WallabagApiTestCase $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')); + $this->assertStringContainsString('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->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains('application/csv', $client->getResponse()->headers->get('Content-Type')); + $this->assertStringContainsString('application/csv', $client->getResponse()->headers->get('Content-Type')); } public function testGetOneEntryWrongUser() @@ -189,13 +189,13 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('archive=1', $content['_links'][$link]['href']); - $this->assertContains('starred=1', $content['_links'][$link]['href']); - $this->assertContains('sort=updated', $content['_links'][$link]['href']); - $this->assertContains('order=asc', $content['_links'][$link]['href']); - $this->assertContains('tags=foo', $content['_links'][$link]['href']); - $this->assertContains('since=1443274283', $content['_links'][$link]['href']); - $this->assertContains('public=0', $content['_links'][$link]['href']); + $this->assertStringContainsString('archive=1', $content['_links'][$link]['href']); + $this->assertStringContainsString('starred=1', $content['_links'][$link]['href']); + $this->assertStringContainsString('sort=updated', $content['_links'][$link]['href']); + $this->assertStringContainsString('order=asc', $content['_links'][$link]['href']); + $this->assertStringContainsString('tags=foo', $content['_links'][$link]['href']); + $this->assertStringContainsString('since=1443274283', $content['_links'][$link]['href']); + $this->assertStringContainsString('public=0', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -241,7 +241,7 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('public=1', $content['_links'][$link]['href']); + $this->assertStringContainsString('public=1', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -293,8 +293,8 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('starred=1', $content['_links'][$link]['href']); - $this->assertContains('sort=updated', $content['_links'][$link]['href']); + $this->assertStringContainsString('starred=1', $content['_links'][$link]['href']); + $this->assertStringContainsString('sort=updated', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -321,7 +321,7 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('archive=1', $content['_links'][$link]['href']); + $this->assertStringContainsString('archive=1', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -351,7 +351,7 @@ 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->assertStringContainsString('tags=' . urlencode('foo,bar'), $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -385,7 +385,7 @@ class EntryRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('since=1443274283', $content['_links'][$link]['href']); + $this->assertStringContainsString('since=1443274283', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -413,7 +413,7 @@ 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->assertStringContainsString('since=' . ($future->getTimestamp() + 1000), $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -690,7 +690,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('bob', $content['published_by']); $this->assertSame('awesome', $content['content']); $this->assertFalse($content['is_public'], 'Entry is no more shared'); - $this->assertContains('2017-03-06', $content['published_at']); + $this->assertStringContainsString('2017-03-06', $content['published_at']); } public function testPatchEntryWithoutQuotes() @@ -1191,7 +1191,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertInternalType('int', $content[0]['entry']); + $this->assertIsInt($content[0]['entry']); $this->assertSame('http://0.0.0.0/entry4', $content[0]['url']); $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') @@ -1263,10 +1263,10 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertInternalType('int', $content[0]['entry']); + $this->assertIsInt($content[0]['entry']); $this->assertSame('https://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->assertIsInt($content[1]['entry']); $this->assertSame('http://0.0.0.0/entry2', $content[1]['url']); } @@ -1336,7 +1336,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->client->request('POST', '/api/entries/lists?urls=' . json_encode($list)); $this->assertSame(400, $this->client->getResponse()->getStatusCode()); - $this->assertContains('API limit reached', $this->client->getResponse()->getContent()); + $this->assertStringContainsString('API limit reached', $this->client->getResponse()->getContent()); } public function testRePostEntryAndReUsePublishedAt() diff --git a/tests/Wallabag/ApiBundle/Controller/SearchRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/SearchRestControllerTest.php index fd5246393..9a354da71 100644 --- a/tests/Wallabag/ApiBundle/Controller/SearchRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/SearchRestControllerTest.php @@ -32,7 +32,7 @@ class SearchRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('term=entry', $content['_links'][$link]['href']); + $this->assertStringContainsString('term=entry', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); @@ -61,7 +61,7 @@ class SearchRestControllerTest extends WallabagApiTestCase foreach (['self', 'first', 'last'] as $link) { $this->assertArrayHasKey('href', $content['_links'][$link]); - $this->assertContains('term=entry', $content['_links'][$link]['href']); + $this->assertStringContainsString('term=entry', $content['_links'][$link]['href']); } $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php index 5ca9785dc..ab0d3f879 100644 --- a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php @@ -22,8 +22,8 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('Cleaning through 3 user accounts', $tester->getDisplay()); - $this->assertContains('Finished cleaning. 0 duplicates found in total', $tester->getDisplay()); + $this->assertStringContainsString('Cleaning through 3 user accounts', $tester->getDisplay()); + $this->assertStringContainsString('Finished cleaning. 0 duplicates found in total', $tester->getDisplay()); } public function testRunCleanDuplicatesCommandWithBadUsername() @@ -39,7 +39,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase 'username' => 'unknown', ]); - $this->assertContains('User "unknown" not found', $tester->getDisplay()); + $this->assertStringContainsString('User "unknown" not found', $tester->getDisplay()); } public function testRunCleanDuplicatesCommandForUser() @@ -55,7 +55,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Cleaned 0 duplicates for user admin', $tester->getDisplay()); + $this->assertStringContainsString('Cleaned 0 duplicates for user admin', $tester->getDisplay()); } public function testDuplicate() @@ -96,7 +96,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Cleaned 1 duplicates for user admin', $tester->getDisplay()); + $this->assertStringContainsString('Cleaned 1 duplicates for user admin', $tester->getDisplay()); $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertCount(1, $nbEntries); diff --git a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php index 210b2ab64..318531ff5 100644 --- a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php @@ -9,12 +9,11 @@ use Wallabag\CoreBundle\Command\ExportCommand; class ExportCommandTest extends WallabagCoreTestCase { - /** - * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Not enough arguments (missing: "username") - */ public function testExportCommandWithoutUsername() { + $this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class); + $this->expectExceptionMessage('Not enough arguments (missing: "username")'); + $application = new Application($this->getClient()->getKernel()); $application->add(new ExportCommand()); @@ -39,7 +38,7 @@ class ExportCommandTest extends WallabagCoreTestCase 'username' => 'unknown', ]); - $this->assertContains('User "unknown" not found', $tester->getDisplay()); + $this->assertStringContainsString('User "unknown" not found', $tester->getDisplay()); } public function testExportCommand() @@ -55,8 +54,8 @@ class ExportCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Exporting 5 entrie(s) for user admin...', $tester->getDisplay()); - $this->assertContains('Done', $tester->getDisplay()); + $this->assertStringContainsString('Exporting 5 entrie(s) for user admin...', $tester->getDisplay()); + $this->assertStringContainsString('Done', $tester->getDisplay()); $this->assertFileExists('admin-export.json'); } diff --git a/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php b/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php index 17eed210b..5870a037f 100644 --- a/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php @@ -22,8 +22,8 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('Generating hashed urls for "3" users', $tester->getDisplay()); - $this->assertContains('Finished generated hashed urls', $tester->getDisplay()); + $this->assertStringContainsString('Generating hashed urls for "3" users', $tester->getDisplay()); + $this->assertStringContainsString('Finished generated hashed urls', $tester->getDisplay()); } public function testRunGenerateUrlHashesCommandWithBadUsername() @@ -39,7 +39,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase 'username' => 'unknown', ]); - $this->assertContains('User "unknown" not found', $tester->getDisplay()); + $this->assertStringContainsString('User "unknown" not found', $tester->getDisplay()); } public function testRunGenerateUrlHashesCommandForUser() @@ -55,7 +55,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Generated hashed urls for user: admin', $tester->getDisplay()); + $this->assertStringContainsString('Generated hashed urls for user: admin', $tester->getDisplay()); } public function testGenerateUrls() @@ -85,7 +85,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Generated hashed urls for user: admin', $tester->getDisplay()); + $this->assertStringContainsString('Generated hashed urls for user: admin', $tester->getDisplay()); $entry = $em->getRepository('WallabagCoreBundle:Entry')->findOneByUrl($url); diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 2c3e67f33..d79636b16 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php @@ -103,10 +103,10 @@ class InstallCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('Checking system requirements.', $tester->getDisplay()); - $this->assertContains('Setting up database.', $tester->getDisplay()); - $this->assertContains('Administration setup.', $tester->getDisplay()); - $this->assertContains('Config setup.', $tester->getDisplay()); + $this->assertStringContainsString('Checking system requirements.', $tester->getDisplay()); + $this->assertStringContainsString('Setting up database.', $tester->getDisplay()); + $this->assertStringContainsString('Administration setup.', $tester->getDisplay()); + $this->assertStringContainsString('Config setup.', $tester->getDisplay()); } public function testRunInstallCommandWithReset() @@ -128,14 +128,14 @@ class InstallCommandTest extends WallabagCoreTestCase '--reset' => true, ]); - $this->assertContains('Checking system requirements.', $tester->getDisplay()); - $this->assertContains('Setting up database.', $tester->getDisplay()); - $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay()); - $this->assertContains('Administration setup.', $tester->getDisplay()); - $this->assertContains('Config setup.', $tester->getDisplay()); + $this->assertStringContainsString('Checking system requirements.', $tester->getDisplay()); + $this->assertStringContainsString('Setting up database.', $tester->getDisplay()); + $this->assertStringContainsString('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay()); + $this->assertStringContainsString('Administration setup.', $tester->getDisplay()); + $this->assertStringContainsString('Config setup.', $tester->getDisplay()); // we force to reset everything - $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay()); + $this->assertStringContainsString('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay()); } public function testRunInstallCommandWithDatabaseRemoved() @@ -174,13 +174,13 @@ class InstallCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('Checking system requirements.', $tester->getDisplay()); - $this->assertContains('Setting up database.', $tester->getDisplay()); - $this->assertContains('Administration setup.', $tester->getDisplay()); - $this->assertContains('Config setup.', $tester->getDisplay()); + $this->assertStringContainsString('Checking system requirements.', $tester->getDisplay()); + $this->assertStringContainsString('Setting up database.', $tester->getDisplay()); + $this->assertStringContainsString('Administration setup.', $tester->getDisplay()); + $this->assertStringContainsString('Config setup.', $tester->getDisplay()); // the current database doesn't already exist - $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); + $this->assertStringContainsString('Creating database and schema, clearing the cache', $tester->getDisplay()); } public function testRunInstallCommandChooseResetSchema() @@ -200,12 +200,12 @@ class InstallCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('Checking system requirements.', $tester->getDisplay()); - $this->assertContains('Setting up database.', $tester->getDisplay()); - $this->assertContains('Administration setup.', $tester->getDisplay()); - $this->assertContains('Config setup.', $tester->getDisplay()); + $this->assertStringContainsString('Checking system requirements.', $tester->getDisplay()); + $this->assertStringContainsString('Setting up database.', $tester->getDisplay()); + $this->assertStringContainsString('Administration setup.', $tester->getDisplay()); + $this->assertStringContainsString('Config setup.', $tester->getDisplay()); - $this->assertContains('Dropping schema and creating schema', $tester->getDisplay()); + $this->assertStringContainsString('Dropping schema and creating schema', $tester->getDisplay()); } public function testRunInstallCommandChooseNothing() @@ -244,12 +244,12 @@ class InstallCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('Checking system requirements.', $tester->getDisplay()); - $this->assertContains('Setting up database.', $tester->getDisplay()); - $this->assertContains('Administration setup.', $tester->getDisplay()); - $this->assertContains('Config setup.', $tester->getDisplay()); + $this->assertStringContainsString('Checking system requirements.', $tester->getDisplay()); + $this->assertStringContainsString('Setting up database.', $tester->getDisplay()); + $this->assertStringContainsString('Administration setup.', $tester->getDisplay()); + $this->assertStringContainsString('Config setup.', $tester->getDisplay()); - $this->assertContains('Creating schema', $tester->getDisplay()); + $this->assertStringContainsString('Creating schema', $tester->getDisplay()); } public function testRunInstallCommandNoInteraction() @@ -266,9 +266,9 @@ class InstallCommandTest extends WallabagCoreTestCase 'interactive' => false, ]); - $this->assertContains('Checking system requirements.', $tester->getDisplay()); - $this->assertContains('Setting up database.', $tester->getDisplay()); - $this->assertContains('Administration setup.', $tester->getDisplay()); - $this->assertContains('Config setup.', $tester->getDisplay()); + $this->assertStringContainsString('Checking system requirements.', $tester->getDisplay()); + $this->assertStringContainsString('Setting up database.', $tester->getDisplay()); + $this->assertStringContainsString('Administration setup.', $tester->getDisplay()); + $this->assertStringContainsString('Config setup.', $tester->getDisplay()); } } diff --git a/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php index 9068cf593..8a4f8a58f 100644 --- a/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php @@ -21,7 +21,7 @@ class ListUserCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('3/3 user(s) displayed.', $tester->getDisplay()); + $this->assertStringContainsString('3/3 user(s) displayed.', $tester->getDisplay()); } public function testRunListUserCommandWithLimit() @@ -37,7 +37,7 @@ class ListUserCommandTest extends WallabagCoreTestCase '--limit' => 2, ]); - $this->assertContains('2/3 user(s) displayed.', $tester->getDisplay()); + $this->assertStringContainsString('2/3 user(s) displayed.', $tester->getDisplay()); } public function testRunListUserCommandWithSearch() @@ -53,7 +53,7 @@ class ListUserCommandTest extends WallabagCoreTestCase 'search' => 'boss', ]); - $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay()); + $this->assertStringContainsString('1/3 (filtered) user(s) displayed.', $tester->getDisplay()); } public function testRunListUserCommandWithSearchAndLimit() @@ -70,6 +70,6 @@ class ListUserCommandTest extends WallabagCoreTestCase '--limit' => 1, ]); - $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay()); + $this->assertStringContainsString('1/3 (filtered) user(s) displayed.', $tester->getDisplay()); } } diff --git a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php index a5d5ac2b5..f5233194e 100644 --- a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php @@ -70,7 +70,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase $this->assertNotEmpty($reloadedEntry->getContent()); } - $this->assertContains('Done', $tester->getDisplay()); + $this->assertStringContainsString('Done', $tester->getDisplay()); } /** @@ -98,7 +98,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase $reloadedBobEntry = $entryRepository->find($this->bobEntry->getId()); $this->assertEmpty($reloadedBobEntry->getContent()); - $this->assertContains('Done', $tester->getDisplay()); + $this->assertStringContainsString('Done', $tester->getDisplay()); } public function testRunReloadEntryWithoutEntryCommand() @@ -115,7 +115,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase 'interactive' => false, ]); - $this->assertContains('No entry to reload', $tester->getDisplay()); - $this->assertNotContains('Done', $tester->getDisplay()); + $this->assertStringContainsString('No entry to reload', $tester->getDisplay()); + $this->assertStringNotContainsString('Done', $tester->getDisplay()); } } diff --git a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php index ed383a2c9..5cdb825d2 100644 --- a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php @@ -10,12 +10,11 @@ use Wallabag\UserBundle\Entity\User; class ShowUserCommandTest extends WallabagCoreTestCase { - /** - * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Not enough arguments - */ public function testRunShowUserCommandWithoutUsername() { + $this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class); + $this->expectExceptionMessage('Not enough arguments'); + $application = new Application($this->getClient()->getKernel()); $application->add(new ShowUserCommand()); @@ -40,7 +39,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase 'username' => 'unknown', ]); - $this->assertContains('User "unknown" not found', $tester->getDisplay()); + $this->assertStringContainsString('User "unknown" not found', $tester->getDisplay()); } public function testRunShowUserCommandForUser() @@ -56,11 +55,11 @@ class ShowUserCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Username: admin', $tester->getDisplay()); - $this->assertContains('Email: bigboss@wallabag.org', $tester->getDisplay()); - $this->assertContains('Display name: Big boss', $tester->getDisplay()); - $this->assertContains('2FA (email) activated', $tester->getDisplay()); - $this->assertContains('2FA (OTP) activated', $tester->getDisplay()); + $this->assertStringContainsString('Username: admin', $tester->getDisplay()); + $this->assertStringContainsString('Email: bigboss@wallabag.org', $tester->getDisplay()); + $this->assertStringContainsString('Display name: Big boss', $tester->getDisplay()); + $this->assertStringContainsString('2FA (email) activated', $tester->getDisplay()); + $this->assertStringContainsString('2FA (OTP) activated', $tester->getDisplay()); } public function testShowUser() @@ -89,6 +88,6 @@ class ShowUserCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Display name: Bug boss', $tester->getDisplay()); + $this->assertStringContainsString('Display name: Bug boss', $tester->getDisplay()); } } diff --git a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php index b1e56a10e..826570600 100644 --- a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php @@ -9,12 +9,11 @@ use Wallabag\CoreBundle\Command\TagAllCommand; class TagAllCommandTest extends WallabagCoreTestCase { - /** - * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Not enough arguments (missing: "username") - */ public function testRunTagAllCommandWithoutUsername() { + $this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class); + $this->expectExceptionMessage('Not enough arguments (missing: "username")'); + $application = new Application($this->getClient()->getKernel()); $application->add(new TagAllCommand()); @@ -39,7 +38,7 @@ class TagAllCommandTest extends WallabagCoreTestCase 'username' => 'unknown', ]); - $this->assertContains('User "unknown" not found', $tester->getDisplay()); + $this->assertStringContainsString('User "unknown" not found', $tester->getDisplay()); } public function testRunTagAllCommand() @@ -55,7 +54,7 @@ class TagAllCommandTest extends WallabagCoreTestCase 'username' => 'admin', ]); - $this->assertContains('Tagging entries for user admin...', $tester->getDisplay()); - $this->assertContains('Done', $tester->getDisplay()); + $this->assertStringContainsString('Tagging entries for user admin...', $tester->getDisplay()); + $this->assertStringContainsString('Done', $tester->getDisplay()); } } diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 92d222679..acd8d58e7 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -19,7 +19,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->request('GET', '/new'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('login', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('login', $client->getResponse()->headers->get('location')); } public function testIndex() @@ -62,7 +62,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.config_saved', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.config_saved', $crawler->filter('body')->extract(['_text'])[0]); } public function testChangeReadingSpeed() @@ -141,7 +141,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $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]); + $this->assertStringContainsString('This value should not be blank', $alert[0]); } public function dataForChangePasswordFailed() @@ -201,7 +201,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains($expectedMessage, $alert[0]); + $this->assertStringContainsString($expectedMessage, $alert[0]); } public function testChangePassword() @@ -227,7 +227,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.password_updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.password_updated', $crawler->filter('body')->extract(['_text'])[0]); } public function dataForUserFailed() @@ -269,7 +269,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains($expectedMessage, $alert[0]); + $this->assertStringContainsString($expectedMessage, $alert[0]); } public function testUserUpdate() @@ -295,7 +295,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.config.notice.user_updated', $alert[0]); + $this->assertStringContainsString('flashes.config.notice.user_updated', $alert[0]); } public function testFeedUpdateResetToken() @@ -323,7 +323,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('config.form_feed.no_token', $body[0]); + $this->assertStringContainsString('config.form_feed.no_token', $body[0]); $client->request('GET', '/generate-token'); $this->assertSame(302, $client->getResponse()->getStatusCode()); @@ -331,7 +331,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('config.form_feed.token_reset', $body[0]); + $this->assertStringContainsString('config.form_feed.token_reset', $body[0]); } public function testGenerateTokenAjax() @@ -389,7 +389,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.feed_updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.feed_updated', $crawler->filter('body')->extract(['_text'])[0]); } public function dataForFeedFailed() @@ -429,7 +429,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains($expectedMessage, $alert[0]); + $this->assertStringContainsString($expectedMessage, $alert[0]); } public function testTaggingRuleCreation() @@ -454,13 +454,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.tagging_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.tagging_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); $editLink = $crawler->filter('div[id=set5] a.mode_edit')->last()->link(); $crawler = $client->click($editLink); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('?tagging-rule=', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('?tagging-rule=', $client->getResponse()->headers->get('location')); $crawler = $client->followRedirect(); @@ -477,9 +477,9 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.tagging_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.tagging_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); - $this->assertContains('readingTime <= 30', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('readingTime <= 30', $crawler->filter('body')->extract(['_text'])[0]); $deleteLink = $crawler->filter('div[id=set5] a.delete')->last()->link(); @@ -487,7 +487,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.tagging_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.tagging_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); } public function dataForTaggingRuleFailed() @@ -537,7 +537,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); foreach ($messages as $message) { - $this->assertContains($message, $body[0]); + $this->assertStringContainsString($message, $body[0]); } } @@ -561,7 +561,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('255 characters', $body[0]); + $this->assertStringContainsString('255 characters', $body[0]); } public function testDeletingTaggingRuleFromAnOtherUser() @@ -577,7 +577,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(403, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('You can not access this rule', $body[0]); + $this->assertStringContainsString('You can not access this rule', $body[0]); } public function testEditingTaggingRuleFromAnOtherUser() @@ -593,7 +593,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(403, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('You can not access this rule', $body[0]); + $this->assertStringContainsString('You can not access this rule', $body[0]); } public function testIgnoreOriginRuleCreation() @@ -617,13 +617,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.ignore_origin_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.ignore_origin_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); $editLink = $crawler->filter('div[id=set6] a.mode_edit')->last()->link(); $crawler = $client->click($editLink); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('?ignore-origin-user-rule=', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('?ignore-origin-user-rule=', $client->getResponse()->headers->get('location')); $crawler = $client->followRedirect(); @@ -639,9 +639,9 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.ignore_origin_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.ignore_origin_rules_updated', $crawler->filter('body')->extract(['_text'])[0]); - $this->assertContains('host = "example.org"', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('host = "example.org"', $crawler->filter('body')->extract(['_text'])[0]); $deleteLink = $crawler->filter('div[id=set6] a.delete')->last()->link(); @@ -649,7 +649,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); - $this->assertContains('flashes.config.notice.ignore_origin_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.config.notice.ignore_origin_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); } public function dataForIgnoreOriginRuleCreationFail() @@ -697,7 +697,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); foreach ($messages as $message) { - $this->assertContains($message, $body[0]); + $this->assertStringContainsString($message, $body[0]); } } @@ -714,7 +714,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(403, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('You can not access this rule', $body[0]); + $this->assertStringContainsString('You can not access this rule', $body[0]); } public function testEditingIgnoreOriginRuleFromAnOtherUser() @@ -730,7 +730,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(403, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('You can not access this rule', $body[0]); + $this->assertStringContainsString('You can not access this rule', $body[0]); } public function testDemoMode() @@ -757,7 +757,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + $this->assertStringContainsString('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $config->set('demo_mode_enabled', 0); $config->set('demo_mode_username', 'wallabag'); @@ -771,7 +771,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('config.form_user.delete.button', $body[0]); + $this->assertStringContainsString('config.form_user.delete.button', $body[0]); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); @@ -792,7 +792,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/config'); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertNotContains('config.form_user.delete.button', $body[0]); + $this->assertStringNotContainsString('config.form_user.delete.button', $body[0]); $client->request('GET', '/account/delete'); $this->assertSame(403, $client->getResponse()->getStatusCode()); @@ -928,7 +928,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->click($crawler->selectLink('config.reset.annotations')->link()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + $this->assertStringContainsString('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $annotationsReset = $em ->getRepository('WallabagAnnotationBundle:Annotation') @@ -944,7 +944,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->click($crawler->selectLink('config.reset.tags')->link()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + $this->assertStringContainsString('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $tagReset = $em ->getRepository('WallabagCoreBundle:Tag') @@ -960,7 +960,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + $this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') @@ -1024,7 +1024,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->click($crawler->selectLink('config.reset.archived')->link()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + $this->assertStringContainsString('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') @@ -1081,7 +1081,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + $this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') @@ -1110,14 +1110,14 @@ class ConfigControllerTest extends WallabagCoreTestCase $client->request('GET', '/unread/list'); - $this->assertNotContains('listmode', $client->getResponse()->getContent()); + $this->assertStringNotContainsString('listmode', $client->getResponse()->getContent()); $client->request('GET', '/config/view-mode'); $crawler = $client->followRedirect(); $client->request('GET', '/unread/list'); - $this->assertContains('listmode', $client->getResponse()->getContent()); + $this->assertStringContainsString('listmode', $client->getResponse()->getContent()); $client->request('GET', '/config/view-mode'); } @@ -1169,7 +1169,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.config.notice.otp_enabled', $alert[0]); + $this->assertStringContainsString('flashes.config.notice.otp_enabled', $alert[0]); // restore user $em = $this->getEntityManager(); @@ -1196,7 +1196,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.config.notice.otp_disabled', $alert[0]); + $this->assertStringContainsString('flashes.config.notice.otp_disabled', $alert[0]); // restore user $em = $this->getEntityManager(); @@ -1273,7 +1273,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.config.notice.otp_disabled', $alert[0]); + $this->assertStringContainsString('flashes.config.notice.otp_disabled', $alert[0]); // restore user $em = $this->getEntityManager(); diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 0aa562d80..71e00f716 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -37,7 +37,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/new'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('login', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('login', $client->getResponse()->headers->get('location')); } /** @@ -54,7 +54,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('quickstart.intro.title', $body[0]); + $this->assertStringContainsString('quickstart.intro.title', $body[0]); // Test if quickstart is disabled when user has 1 entry $crawler = $client->request('GET', '/new'); @@ -73,7 +73,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/unread/list'); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('entry.list.number_on_the_page', $body[0]); + $this->assertStringContainsString('entry.list.number_on_the_page', $body[0]); } public function testGetNew() @@ -169,7 +169,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); $this->assertSame($this->url, $content->getUrl()); - $this->assertContains('la cryptomonnaie de Facebook', $content->getTitle()); + $this->assertStringContainsString('la cryptomonnaie de Facebook', $content->getTitle()); $this->assertSame('fr', $content->getLanguage()); $this->assertArrayHasKey('x-frame-options', $content->getHeaders()); $client->getContainer()->get('craue_config')->set('store_article_headers', 0); @@ -235,7 +235,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl()); } /** @@ -273,7 +273,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl()); } /** @@ -311,7 +311,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl()); } /** @@ -335,7 +335,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/', $client->getResponse()->getTargetUrl()); + $this->assertStringContainsString('/', $client->getResponse()->getTargetUrl()); $em = $client->getContainer() ->get('doctrine.orm.entity_manager'); @@ -366,7 +366,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/', $client->getResponse()->getTargetUrl()); + $this->assertStringContainsString('/', $client->getResponse()->getTargetUrl()); $entry = $em ->getRepository('WallabagCoreBundle:Entry') @@ -438,7 +438,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains($entry->getTitle(), $body[0]); + $this->assertStringContainsString($entry->getTitle(), $body[0]); } /** @@ -538,9 +538,9 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); - $this->assertContains('My updated title hehe :)', $title[0]); + $this->assertStringContainsString('My updated title hehe :)', $title[0]); $this->assertGreaterThan(1, $stats = $crawler->filter('div[class="tools grey-text"] ul[class=stats] li a[class="tool grey-text"]')->extract(['_text'])); - $this->assertContains('example.io', trim($stats[1])); + $this->assertStringContainsString('example.io', trim($stats[1])); } public function testEditRemoveOriginUrl() @@ -572,11 +572,11 @@ class EntryControllerTest extends WallabagCoreTestCase $title = $crawler->filter('div[id=article] h1')->extract(['_text']); $this->assertGreaterThan(1, $title); - $this->assertContains('My updated title hehe :)', $title[0]); + $this->assertStringContainsString('My updated title hehe :)', $title[0]); $stats = $crawler->filter('div[class="tools grey-text"] ul[class=stats] li a[class="tool grey-text"]')->extract(['_text']); $this->assertCount(1, $stats); - $this->assertNotContains('example.io', trim($stats[0])); + $this->assertStringNotContainsString('example.io', trim($stats[0])); } public function testToggleArchive() @@ -896,7 +896,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', 'unread/list' . $parameters); - $this->assertContains($parameters, $client->getResponse()->getContent()); + $this->assertStringContainsString($parameters, $client->getResponse()->getContent()); // reset pagination $crawler = $client->request('GET', '/config'); @@ -1045,14 +1045,14 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', $shareUrl); $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')); - $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); - $this->assertContains('og:title', $client->getResponse()->getContent()); - $this->assertContains('og:type', $client->getResponse()->getContent()); - $this->assertContains('og:url', $client->getResponse()->getContent()); - $this->assertContains('og:image', $client->getResponse()->getContent()); + $this->assertStringContainsString('max-age=25200', $client->getResponse()->headers->get('cache-control')); + $this->assertStringContainsString('public', $client->getResponse()->headers->get('cache-control')); + $this->assertStringContainsString('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); + $this->assertStringNotContainsString('no-cache', $client->getResponse()->headers->get('cache-control')); + $this->assertStringContainsString('og:title', $client->getResponse()->getContent()); + $this->assertStringContainsString('og:type', $client->getResponse()->getContent()); + $this->assertStringContainsString('og:url', $client->getResponse()->getContent()); + $this->assertStringContainsString('og:image', $client->getResponse()->getContent()); // sharing is now disabled $client->getContainer()->get('craue_config')->set('share_public', 0); @@ -1103,9 +1103,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); $this->assertSame($url, $entry->getUrl()); - $this->assertContains('Judo', $entry->getTitle()); + $this->assertStringContainsString('Judo', $entry->getTitle()); // instead of checking for the filename (which might change) check that the image is now local - $this->assertContains(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent()); + $this->assertStringContainsString(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent()); $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); } @@ -1191,7 +1191,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/archive/' . $entry->getId()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/' . $entry->getId(), $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('/view/' . $entry->getId(), $client->getResponse()->headers->get('location')); } public function testFilterOnHttpStatus() @@ -1469,7 +1469,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); $content = $em ->getRepository('WallabagCoreBundle:Entry') @@ -1555,23 +1555,23 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/unread/random'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Unread random'); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'Unread random'); $client->request('GET', '/starred/random'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Starred random'); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'Starred random'); $client->request('GET', '/archive/random'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Archive random'); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'Archive random'); $client->request('GET', '/untagged/random'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random'); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random'); $client->request('GET', '/all/random'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'All random'); + $this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'All random'); } public function testMass() diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index 066ca6e98..58931f20d 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -17,7 +17,7 @@ class ExportControllerTest extends WallabagCoreTestCase $client->request('GET', '/export/unread.csv'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('login', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('login', $client->getResponse()->headers->get('location')); } public function testUnknownCategoryExport() @@ -186,15 +186,15 @@ class ExportControllerTest extends WallabagCoreTestCase // +1 for title line $this->assertCount(\count($contentInDB) + 1, $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]); - $this->assertContains($contentInDB[0]['mimetype'], $csv[1]); - $this->assertContains($contentInDB[0]['language'], $csv[1]); - $this->assertContains($contentInDB[0]['createdAt']->format('d/m/Y h:i:s'), $csv[1]); + $this->assertStringContainsString($contentInDB[0]['title'], $csv[1]); + $this->assertStringContainsString($contentInDB[0]['url'], $csv[1]); + $this->assertStringContainsString($contentInDB[0]['content'], $csv[1]); + $this->assertStringContainsString($contentInDB[0]['mimetype'], $csv[1]); + $this->assertStringContainsString($contentInDB[0]['language'], $csv[1]); + $this->assertStringContainsString($contentInDB[0]['createdAt']->format('d/m/Y h:i:s'), $csv[1]); foreach ($contentInDB[0]['tags'] as $tag) { - $this->assertContains($tag['label'], $csv[1]); + $this->assertStringContainsString($tag['label'], $csv[1]); } } @@ -300,7 +300,7 @@ class ExportControllerTest extends WallabagCoreTestCase $content = new \SimpleXMLElement($client->getResponse()->getContent()); $this->assertGreaterThan(0, $content->count()); - $this->assertCount($contentInDB, $content); + $this->assertCount(\count($contentInDB), $content); $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/FeedControllerTest.php b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php index d52d7bb8a..0bd2a6206 100644 --- a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php @@ -23,8 +23,8 @@ class FeedControllerTest extends WallabagCoreTestCase $this->assertSame(1, $xpath->query('/a:feed')->length); $this->assertSame(1, $xpath->query('/a:feed/a:title')->length); - $this->assertContains('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue); - $this->assertContains('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue); + $this->assertStringContainsString('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue); + $this->assertStringContainsString('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue); $this->assertSame(1, $xpath->query('/a:feed/a:updated')->length); @@ -42,7 +42,7 @@ class FeedControllerTest extends WallabagCoreTestCase } $this->assertSame(1, $xpath->query('/a:feed/a:link[@rel="self"]')->length); - $this->assertContains($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href')); + $this->assertStringContainsString($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href')); $this->assertSame(1, $xpath->query('/a:feed/a:link[@rel="last"]')->length); diff --git a/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php b/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php index 9783cd251..521f55307 100644 --- a/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php @@ -17,8 +17,8 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $body = $crawler->filter('body')->extract(['_text'])[0]; - $this->assertContains('ignore_origin_instance_rule.description', $body); - $this->assertContains('ignore_origin_instance_rule.list.create_new_one', $body); + $this->assertStringContainsString('ignore_origin_instance_rule.description', $body); + $this->assertStringContainsString('ignore_origin_instance_rule.list.create_new_one', $body); } public function testIgnoreOriginInstanceRuleCreationEditionDeletion() @@ -33,8 +33,8 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $body = $crawler->filter('body')->extract(['_text'])[0]; - $this->assertContains('ignore_origin_instance_rule.new_ignore_origin_instance_rule', $body); - $this->assertContains('ignore_origin_instance_rule.form.back_to_list', $body); + $this->assertStringContainsString('ignore_origin_instance_rule.new_ignore_origin_instance_rule', $body); + $this->assertStringContainsString('ignore_origin_instance_rule.form.back_to_list', $body); $form = $crawler->filter('button[id=ignore_origin_instance_rule_save]')->form(); @@ -48,7 +48,7 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.ignore_origin_instance_rule.notice.added', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.ignore_origin_instance_rule.notice.added', $crawler->filter('body')->extract(['_text'])[0]); // Edition $editLink = $crawler->filter('div[id=content] table a')->last()->link(); @@ -57,12 +57,12 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains('foo.example.com', $crawler->filter('form[name=ignore_origin_instance_rule] input[type=text]')->extract(['value'])[0]); + $this->assertStringContainsString('foo.example.com', $crawler->filter('form[name=ignore_origin_instance_rule] input[type=text]')->extract(['value'])[0]); $body = $crawler->filter('body')->extract(['_text'])[0]; - $this->assertContains('ignore_origin_instance_rule.edit_ignore_origin_instance_rule', $body); - $this->assertContains('ignore_origin_instance_rule.form.back_to_list', $body); + $this->assertStringContainsString('ignore_origin_instance_rule.edit_ignore_origin_instance_rule', $body); + $this->assertStringContainsString('ignore_origin_instance_rule.form.back_to_list', $body); $form = $crawler->filter('button[id=ignore_origin_instance_rule_save]')->form(); @@ -76,7 +76,7 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.ignore_origin_instance_rule.notice.updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.ignore_origin_instance_rule.notice.updated', $crawler->filter('body')->extract(['_text'])[0]); $editLink = $crawler->filter('div[id=content] table a')->last()->link(); @@ -84,7 +84,7 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains('bar.example.com', $crawler->filter('form[name=ignore_origin_instance_rule] input[type=text]')->extract(['value'])[0]); + $this->assertStringContainsString('bar.example.com', $crawler->filter('form[name=ignore_origin_instance_rule] input[type=text]')->extract(['value'])[0]); $deleteForm = $crawler->filter('body')->selectButton('ignore_origin_instance_rule.form.delete')->form(); @@ -94,7 +94,7 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.ignore_origin_instance_rule.notice.deleted', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.ignore_origin_instance_rule.notice.deleted', $crawler->filter('body')->extract(['_text'])[0]); } public function dataForIgnoreOriginInstanceRuleCreationFail() @@ -142,7 +142,7 @@ class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); foreach ($messages as $message) { - $this->assertContains($message, $body[0]); + $this->assertStringContainsString($message, $body[0]); } } } diff --git a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php index 6b51f4035..9730dce9d 100644 --- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php @@ -13,7 +13,7 @@ class SecurityControllerTest extends WallabagCoreTestCase $client->followRedirects(); $crawler = $client->request('GET', '/config'); - $this->assertContains('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]); } public function testLoginWithout2Factor() @@ -23,7 +23,7 @@ class SecurityControllerTest extends WallabagCoreTestCase $client->followRedirects(); $crawler = $client->request('GET', '/config'); - $this->assertContains('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]); } public function testLoginWith2FactorEmail() @@ -48,7 +48,7 @@ class SecurityControllerTest extends WallabagCoreTestCase $this->logInAsUsingHttp('admin'); $crawler = $client->request('GET', '/config'); - $this->assertContains('trusted', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('trusted', $crawler->filter('body')->extract(['_text'])[0]); // restore user $user = $em @@ -81,7 +81,7 @@ class SecurityControllerTest extends WallabagCoreTestCase $this->logInAsUsingHttp('admin'); $crawler = $client->request('GET', '/config'); - $this->assertContains('trusted', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('trusted', $crawler->filter('body')->extract(['_text'])[0]); // restore user $user = $em @@ -104,6 +104,6 @@ class SecurityControllerTest extends WallabagCoreTestCase $client->followRedirects(); $client->request('GET', '/register'); - $this->assertContains('registration.submit', $client->getResponse()->getContent()); + $this->assertStringContainsString('registration.submit', $client->getResponse()->getContent()); } } diff --git a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php index f50744039..52fcd8f85 100644 --- a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php @@ -33,8 +33,8 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $body = $crawler->filter('body')->extract(['_text'])[0]; - $this->assertContains('site_credential.description', $body); - $this->assertContains('site_credential.list.create_new_one', $body); + $this->assertStringContainsString('site_credential.description', $body); + $this->assertStringContainsString('site_credential.list.create_new_one', $body); } public function testNewSiteCredential() @@ -48,8 +48,8 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $body = $crawler->filter('body')->extract(['_text'])[0]; - $this->assertContains('site_credential.new_site_credential', $body); - $this->assertContains('site_credential.form.back_to_list', $body); + $this->assertStringContainsString('site_credential.new_site_credential', $body); + $this->assertStringContainsString('site_credential.form.back_to_list', $body); $form = $crawler->filter('button[id=site_credential_save]')->form(); @@ -65,7 +65,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.site_credential.notice.added', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.site_credential.notice.added', $crawler->filter('body')->extract(['_text'])[0]); } public function testEditSiteCredential() @@ -81,8 +81,8 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $body = $crawler->filter('body')->extract(['_text'])[0]; - $this->assertContains('site_credential.edit_site_credential', $body); - $this->assertContains('site_credential.form.back_to_list', $body); + $this->assertStringContainsString('site_credential.edit_site_credential', $body); + $this->assertStringContainsString('site_credential.form.back_to_list', $body); $form = $crawler->filter('button[id=site_credential_save]')->form(); @@ -98,7 +98,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.site_credential.notice.updated', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.site_credential.notice.updated', $crawler->filter('body')->extract(['_text'])[0]); } public function testEditFromADifferentUserSiteCredential() @@ -134,7 +134,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.site_credential.notice.deleted', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.site_credential.notice.deleted', $crawler->filter('body')->extract(['_text'])[0]); } private function createSiteCredential(Client $client) diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index fb0666324..5e8f9f3de 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php @@ -213,7 +213,7 @@ class TagControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertContains('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); $freshEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -277,7 +277,7 @@ class TagControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertNotContains('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringNotContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); $freshEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -332,7 +332,7 @@ class TagControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertNotContains('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringNotContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); $freshEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -402,7 +402,7 @@ class TagControllerTest extends WallabagCoreTestCase $client->submit($form, $data); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertNotContains('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); + $this->assertStringNotContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]); $freshEntry1 = $client->getContainer() ->get('doctrine.orm.entity_manager') diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index a65ac17cf..b318cf2c5 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -176,7 +176,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertSame('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); @@ -221,7 +221,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertNull($entry->getPreviewPicture()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); @@ -357,7 +357,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertNull($entry->getLanguage()); $this->assertSame('200', $entry->getHttpStatus()); @@ -409,7 +409,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertNull($entry->getPreviewPicture()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); @@ -449,7 +449,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); $this->assertSame(4.0, $entry->getReadingTime()); @@ -492,7 +492,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); $this->assertSame(4.0, $entry->getReadingTime()); @@ -531,7 +531,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('content', $entry->getContent()); + $this->assertStringContainsString('content', $entry->getContent()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); $this->assertSame(4.0, $entry->getReadingTime()); @@ -541,7 +541,7 @@ class ContentProxyTest extends TestCase $records = $handler->getRecords(); $this->assertCount(3, $records); - $this->assertContains('Error while defining date', $records[0]['message']); + $this->assertStringContainsString('Error while defining date', $records[0]['message']); } public function testTaggerThrowException() @@ -619,7 +619,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertNotContains($escapedString, $entry->getContent()); + $this->assertStringNotContainsString($escapedString, $entry->getContent()); $this->assertSame('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); $this->assertSame('text/html', $entry->getMimetype()); $this->assertSame('fr', $entry->getLanguage()); @@ -658,7 +658,7 @@ class ContentProxyTest extends TestCase $this->assertSame('http://1.1.1.1/image.jpg', $entry->getUrl()); $this->assertSame('this is my title', $entry->getTitle()); - $this->assertContains('http://1.1.1.1/image.jpg', $entry->getContent()); + $this->assertStringContainsString('http://1.1.1.1/image.jpg', $entry->getContent()); $this->assertSame('http://1.1.1.1/image.jpg', $entry->getPreviewPicture()); $this->assertSame('image/jpeg', $entry->getMimetype()); $this->assertSame('200', $entry->getHttpStatus()); diff --git a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php index 7398f235a..92a2e9ba4 100644 --- a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php @@ -23,18 +23,15 @@ class CryptoProxyTest extends TestCase $records = $logHandler->getRecords(); $this->assertCount(2, $records); - $this->assertContains('Crypto: crypting value', $records[0]['message']); - $this->assertContains('Crypto: decrypting value', $records[1]['message']); + $this->assertStringContainsString('Crypto: crypting value', $records[0]['message']); + $this->assertStringContainsString('Crypto: decrypting value', $records[1]['message']); } - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Decrypt fail - * - * @return [type] [description] - */ public function testDecryptBadValue() { + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Decrypt fail'); + $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 3c720425a..63041254f 100644 --- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php +++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php @@ -42,7 +42,7 @@ class DownloadImagesTest extends TestCase $res = $download->processHtml(123, $html, $url); // this the base path of all image (since it's calculated using the entry id: 123) - $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res); + $this->assertStringContainsString('http://wallabag.io/assets/images/9/b/9b0ead26/', $res); } public function testProcessHtmlWithBadImage() @@ -56,7 +56,7 @@ class DownloadImagesTest extends TestCase $download = new DownloadImages($httpMockClient, 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'); + $this->assertStringContainsString('http://i.imgur.com/T9qgcHc.jpg', $res, 'Image were not replace because of content-type'); } public function singleImage() @@ -83,7 +83,7 @@ class DownloadImagesTest extends TestCase $download = new DownloadImages($httpMockClient, 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->assertStringContainsString('/assets/images/9/b/9b0ead26/ebe60399.' . $extension, $res); } public function testProcessSingleImageWithBadUrl() @@ -144,8 +144,8 @@ class DownloadImagesTest extends TestCase 'https://theconversation.com/conversation-avec-gerald-bronner-ce-nest-pas-la-post-verite-qui-nous-menace-mais-lextension-de-notre-credulite-73089' ); - $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res, 'Content-Type was empty but data is ok for an image'); - $this->assertContains('DownloadImages: Checking extension (alternative)', $logHandler->getRecords()[3]['message']); + $this->assertStringContainsString('http://wallabag.io/assets/images/9/b/9b0ead26/', $res, 'Content-Type was empty but data is ok for an image'); + $this->assertStringContainsString('DownloadImages: Checking extension (alternative)', $logHandler->getRecords()[3]['message']); } public function testProcessImageWithSrcset() @@ -161,7 +161,7 @@ class DownloadImagesTest extends TestCase $download = new DownloadImages($httpMockClient, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); $res = $download->processHtml(123, '

', 'http://piketty.blog.lemonde.fr/2017/10/12/budget-2018-la-jeunesse-sacrifiee/'); - $this->assertNotContains('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced'); + $this->assertStringNotContainsString('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced'); } public function testProcessImageWithTrickySrcset() @@ -181,7 +181,7 @@ class DownloadImagesTest extends TestCase (min-width: 626px) calc(100vw - 335px) calc(100vw - 30px)" alt="" />', 'https://css-tricks.com/the-critical-request/'); - $this->assertNotContains('f_auto,q_auto', $res, 'Image srcset attribute were not replaced'); + $this->assertStringNotContainsString('f_auto,q_auto', $res, 'Image srcset attribute were not replaced'); } public function testProcessImageWithNullPath() diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php index 48c82ddec..af009b8a1 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php @@ -136,12 +136,11 @@ class UsernameFeedTokenConverterTest extends TestCase $this->assertFalse($res); } - /** - * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - * @expectedExceptionMessage User not found - */ public function testApplyUserNotFound() { + $this->expectException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class); + $this->expectExceptionMessage('User not found'); + $repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository') ->disableOriginalConstructor() ->getMock(); diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php index 8e1c528de..1e1a38fd1 100644 --- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php +++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php @@ -9,12 +9,11 @@ use Wallabag\ImportBundle\Command\ImportCommand; class ImportCommandTest extends WallabagCoreTestCase { - /** - * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Not enough arguments - */ public function testRunImportCommandWithoutArguments() { + $this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class); + $this->expectExceptionMessage('Not enough arguments'); + $application = new Application($this->getClient()->getKernel()); $application->add(new ImportCommand()); @@ -26,12 +25,11 @@ class ImportCommandTest extends WallabagCoreTestCase ]); } - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\Exception - * @expectedExceptionMessage not found - */ public function testRunImportCommandWithoutFilepath() { + $this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class); + $this->expectExceptionMessage('not found'); + $application = new Application($this->getClient()->getKernel()); $application->add(new ImportCommand()); @@ -45,11 +43,10 @@ class ImportCommandTest extends WallabagCoreTestCase ]); } - /** - * @expectedException \Doctrine\ORM\NoResultException - */ public function testRunImportCommandWithWrongUsername() { + $this->expectException(\Doctrine\ORM\NoResultException::class); + $application = new Application($this->getClient()->getKernel()); $application->add(new ImportCommand()); @@ -78,8 +75,8 @@ class ImportCommandTest extends WallabagCoreTestCase '--importer' => 'v2', ]); - $this->assertContains('imported', $tester->getDisplay()); - $this->assertContains('already saved', $tester->getDisplay()); + $this->assertStringContainsString('imported', $tester->getDisplay()); + $this->assertStringContainsString('already saved', $tester->getDisplay()); } public function testRunImportCommandWithUserId() @@ -100,7 +97,7 @@ class ImportCommandTest extends WallabagCoreTestCase '--importer' => 'v2', ]); - $this->assertContains('imported', $tester->getDisplay()); - $this->assertContains('already saved', $tester->getDisplay()); + $this->assertStringContainsString('imported', $tester->getDisplay()); + $this->assertStringContainsString('already saved', $tester->getDisplay()); } } diff --git a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php index af62550c0..67ab757e2 100644 --- a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php +++ b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php @@ -10,12 +10,11 @@ use Wallabag\ImportBundle\Command\RedisWorkerCommand; class RedisWorkerCommandTest extends WallabagCoreTestCase { - /** - * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Not enough arguments (missing: "serviceName") - */ public function testRunRedisWorkerCommandWithoutArguments() { + $this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class); + $this->expectExceptionMessage('Not enough arguments (missing: "serviceName")'); + $application = new Application($this->getClient()->getKernel()); $application->add(new RedisWorkerCommand()); @@ -27,12 +26,11 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase ]); } - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\Exception - * @expectedExceptionMessage No queue or consumer found for service name - */ public function testRunRedisWorkerCommandWithBadService() { + $this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class); + $this->expectExceptionMessage('No queue or consumer found for service name'); + $application = new Application($this->getClient()->getKernel()); $application->add(new RedisWorkerCommand()); @@ -68,7 +66,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase '--maxIterations' => 1, ]); - $this->assertContains('Worker started at', $tester->getDisplay()); - $this->assertContains('Waiting for message', $tester->getDisplay()); + $this->assertStringContainsString('Worker started at', $tester->getDisplay()); + $this->assertStringContainsString('Waiting for message', $tester->getDisplay()); } } diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php index d3ffbb6d0..9203549fc 100644 --- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php @@ -80,7 +80,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.chrome')); @@ -108,7 +108,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -149,6 +149,6 @@ class ChromeControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php index b9919f8f5..0d342c81f 100644 --- a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php @@ -81,7 +81,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.elcurator')); @@ -109,7 +109,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 3e64f2e56..353618103 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php @@ -80,7 +80,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.firefox')); @@ -108,7 +108,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -163,6 +163,6 @@ class FirefoxControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php index f0edb78de..8156d9c0e 100644 --- a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php @@ -13,7 +13,7 @@ class ImportControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('login', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('login', $client->getResponse()->headers->get('location')); } public function testImportList() diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index 05347767d..4d9b3fe96 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -80,7 +80,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.instapaper')); @@ -108,7 +108,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -183,7 +183,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); } public function testImportInstapaperWithEmptyFile() @@ -207,6 +207,6 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php index 15646d55b..1d88c9c03 100644 --- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php @@ -80,7 +80,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.pinboard')); @@ -116,7 +116,7 @@ class PinboardControllerTest extends WallabagCoreTestCase ); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok'); @@ -177,7 +177,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); } public function testImportPinboardWithEmptyFile() @@ -201,6 +201,6 @@ class PinboardControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php index 01dd2451f..bc66ad734 100644 --- a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php @@ -77,7 +77,7 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/auth'); $this->assertSame(301, $client->getResponse()->getStatusCode()); - $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location')); } public function testImportPocketCallbackWithBadToken() @@ -99,7 +99,7 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/callback'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); + $this->assertStringContainsString('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); $this->assertSame('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); } @@ -133,7 +133,7 @@ class PocketControllerTest extends WallabagCoreTestCase $client->request('GET', '/import/pocket/callback'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); + $this->assertStringContainsString('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); $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 4f2f40536..45397362e 100644 --- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php @@ -80,7 +80,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.readability')); @@ -116,7 +116,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase ); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.20minutes.fr is ok'); @@ -175,7 +175,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); } public function testImportReadabilityWithEmptyFile() @@ -199,6 +199,6 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index 2a8e7c899..ff6059ed4 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php @@ -81,7 +81,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.wallabag_v1')); @@ -117,7 +117,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase ); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is empty'); @@ -176,7 +176,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); } public function testImportWallabagWithEmptyFile() @@ -200,6 +200,6 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php index b606e26ae..34ae84ee5 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php @@ -81,7 +81,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.wallabag_v2')); @@ -109,7 +109,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); + $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() ->get('doctrine.orm.entity_manager') @@ -175,6 +175,6 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.failed', $body[0]); + $this->assertStringContainsString('flashes.import.notice.failed', $body[0]); } } diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php index 12a789e04..3b4adbb53 100644 --- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php @@ -90,7 +90,7 @@ class ChromeImportTest extends TestCase ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $res = $chromeImport->setMarkAsRead(true)->import(); @@ -190,7 +190,7 @@ class ChromeImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']); + $this->assertStringContainsString('Wallabag Browser Import: unable to read file', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -204,7 +204,7 @@ class ChromeImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']); + $this->assertStringContainsString('Wallabag Browser Import: user is not defined', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php index eaf693775..69d7d4fb5 100644 --- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php @@ -90,7 +90,7 @@ class FirefoxImportTest extends TestCase ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $res = $firefoxImport->setMarkAsRead(true)->import(); @@ -190,7 +190,7 @@ class FirefoxImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']); + $this->assertStringContainsString('Wallabag Browser Import: unable to read file', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -204,7 +204,7 @@ class FirefoxImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']); + $this->assertStringContainsString('Wallabag Browser Import: user is not defined', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php index b5163fadb..8ef9a4684 100644 --- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php @@ -91,7 +91,7 @@ class InstapaperImportTest extends TestCase ->expects($this->once()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $res = $instapaperImport->setMarkAsRead(true)->import(); @@ -191,7 +191,7 @@ class InstapaperImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('InstapaperImport: unable to read file', $records[0]['message']); + $this->assertStringContainsString('InstapaperImport: unable to read file', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -205,7 +205,7 @@ class InstapaperImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('InstapaperImport: user is not defined', $records[0]['message']); + $this->assertStringContainsString('InstapaperImport: user is not defined', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php index 40e1626ba..259280e4f 100644 --- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php @@ -60,7 +60,7 @@ class PocketImportTest extends TestCase $this->assertFalse($code); $records = $this->logHandler->getRecords(); - $this->assertContains('PocketImport: Failed to request token', $records[0]['message']); + $this->assertStringContainsString('PocketImport: Failed to request token', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -91,7 +91,7 @@ class PocketImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('PocketImport: Failed to authorize client', $records[0]['message']); + $this->assertStringContainsString('PocketImport: Failed to authorize client', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -204,7 +204,7 @@ JSON ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived() && $persistedEntry->isStarred(); + return (bool) $persistedEntry->isArchived() && (bool) $persistedEntry->isStarred(); })); $entry = new Entry($this->user); @@ -295,7 +295,7 @@ JSON ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $entry = new Entry($this->user); @@ -491,7 +491,7 @@ JSON $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('PocketImport: Failed to import', $records[0]['message']); + $this->assertStringContainsString('PocketImport: Failed to import', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -511,7 +511,7 @@ JSON } } } - + JSON )); diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php index e55a56e02..96097f782 100644 --- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php @@ -90,7 +90,7 @@ class ReadabilityImportTest extends TestCase ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $res = $readabilityImport->setMarkAsRead(true)->import(); @@ -190,7 +190,7 @@ class ReadabilityImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('ReadabilityImport: unable to read file', $records[0]['message']); + $this->assertStringContainsString('ReadabilityImport: unable to read file', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -204,7 +204,7 @@ class ReadabilityImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('ReadabilityImport: user is not defined', $records[0]['message']); + $this->assertStringContainsString('ReadabilityImport: user is not defined', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php index 4e9f472d2..1b385c114 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php @@ -93,7 +93,7 @@ class WallabagV1ImportTest extends TestCase ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $res = $wallabagV1Import->setMarkAsRead(true)->import(); @@ -193,7 +193,7 @@ class WallabagV1ImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('WallabagImport: unable to read file', $records[0]['message']); + $this->assertStringContainsString('WallabagImport: unable to read file', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -207,7 +207,7 @@ class WallabagV1ImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); + $this->assertStringContainsString('WallabagImport: user is not defined', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index 68a5d1adf..bc6ba66d4 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php @@ -87,7 +87,7 @@ class WallabagV2ImportTest extends TestCase ->expects($this->any()) ->method('persist') ->with($this->callback(function ($persistedEntry) { - return $persistedEntry->isArchived(); + return (bool) $persistedEntry->isArchived(); })); $res = $wallabagV2Import->setMarkAsRead(true)->import(); @@ -179,7 +179,7 @@ class WallabagV2ImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('WallabagImport: unable to read file', $records[0]['message']); + $this->assertStringContainsString('WallabagImport: unable to read file', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } @@ -193,7 +193,7 @@ class WallabagV2ImportTest extends TestCase $this->assertFalse($res); $records = $this->logHandler->getRecords(); - $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); + $this->assertStringContainsString('WallabagImport: user is not defined', $records[0]['message']); $this->assertSame('ERROR', $records[0]['level_name']); } diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php index f44e6fbf6..1108499f7 100644 --- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php +++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php @@ -13,7 +13,7 @@ class ManageControllerTest extends WallabagCoreTestCase $client->request('GET', '/users/list'); $this->assertSame(302, $client->getResponse()->getStatusCode()); - $this->assertContains('login', $client->getResponse()->headers->get('location')); + $this->assertStringContainsString('login', $client->getResponse()->headers->get('location')); } public function testCompleteScenario() diff --git a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php index 815f73d8a..90248df8f 100644 --- a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php +++ b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php @@ -57,7 +57,7 @@ TWIG; $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); $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()); + $this->assertStringContainsString('text body http://0.0.0.0/support', $msg->toString()); + $this->assertStringContainsString('html body 666666', $msg->toString()); } }