Merge pull request #4441 from wallabag/feature/drop-php-7.1

Jump to PHP 7.2+
This commit is contained in:
Jérémy Benoist 2020-06-16 10:30:02 +02:00 committed by GitHub
commit 142d03354d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 1610 additions and 1611 deletions

1
.gitignore vendored
View file

@ -14,6 +14,7 @@
!/bin/console
!/bin/symfony_requirements
.php_cs.cache
.phpunit.result.cache
# Parameters
/app/config/parameters.yml

View file

@ -22,7 +22,6 @@ if: |
branch = master
php:
- 7.1
- 7.2
- 7.3
- 7.4
@ -51,7 +50,6 @@ before_install:
- PHP=$TRAVIS_PHP_VERSION
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- composer self-update --no-progress
# install imagick
- pear config-set preferred_state beta
- pecl channel-update pecl.php.net
@ -71,7 +69,7 @@ before_script:
script:
- if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi;
# PHPStan needs PHPUnit to be installed and cache app to be generated
- if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then php bin/phpstan analyse src tests --no-progress --level 1 ; fi;
- if [[ $CS_FIXER = run ]]; then php bin/phpstan analyse ; fi;
- if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi;

View file

@ -30,7 +30,7 @@ class AppKernel extends Kernel
new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Craue\ConfigBundle\CraueConfigBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new BabDev\PagerfantaBundle\BabDevPagerfantaBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(),
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),

View file

@ -3,6 +3,8 @@
"type": "project",
"description": "open source self hostable read-it-later web application",
"keywords": [
"poche",
"wallabag",
"read-it-later",
"read it later"
],
@ -22,7 +24,7 @@
},
{
"name": "Jérémy Benoist",
"homepage": "http://www.j0k3r.net",
"homepage": "https://www.j0k3r.net",
"role": "Developer"
}
],
@ -31,7 +33,7 @@
"issues": "https://github.com/wallabag/wallabag/issues"
},
"require": {
"php": ">=7.1.3",
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-curl": "*",
"ext-dom": "*",
@ -47,6 +49,7 @@
"ext-tidy": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"babdev/pagerfanta-bundle": "^2.4",
"bdunogier/guzzle-site-authenticator": "^1.0.0",
"craue/config-bundle": "^2.3.0",
"defuse/php-encryption": "^2.1",
@ -64,7 +67,7 @@
"incenteev/composer-parameter-handler": "^2.1",
"j0k3r/graby": "^2.0",
"javibravo/simpleue": "^2.0",
"jms/serializer-bundle": "~2.2",
"jms/serializer-bundle": "~3.6",
"kphoen/rulerz-bundle": "~0.13",
"laminas/laminas-code": "^3.4",
"laminas/laminas-diactoros": "^2.3",
@ -93,22 +96,22 @@
"twig/extensions": "^1.5",
"wallabag/php-mobi": "~1.0",
"wallabag/phpepub": "^4.0.7.2",
"white-october/pagerfanta-bundle": "^1.1",
"willdurand/hateoas-bundle": "~1.3"
"willdurand/hateoas-bundle": "~2.1"
},
"require-dev": {
"dama/doctrine-test-bundle": "^5.0",
"dama/doctrine-test-bundle": "^6.0",
"doctrine/doctrine-fixtures-bundle": "~3.0",
"friendsofphp/php-cs-fixer": "~2.13",
"guzzlehttp/psr7": "^1.0",
"m6web/redis-mock": "^5.0",
"php-http/mock-client": "^1.0",
"phpstan/phpstan": "^0.11.0",
"phpstan/phpstan-doctrine": "^0.11.0",
"phpstan/phpstan-phpunit": "^0.11.0",
"phpstan/phpstan-symfony": "^0.11.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.0",
"phpstan/phpstan-doctrine": "^0.12.0",
"phpstan/phpstan-phpunit": "^0.12.0",
"phpstan/phpstan-symfony": "^0.12.0",
"symfony/maker-bundle": "^1.18",
"symfony/phpunit-bridge": "~4.3.8"
"symfony/phpunit-bridge": "~5.1.1"
},
"suggest": {
"ext-imagick": "To keep GIF animation when downloading image is enabled"
@ -159,7 +162,7 @@
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.1.3"
"php": "7.2.5"
},
"sort-packages": true
},

2470
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,14 @@
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
level: 1
paths:
- src
- tests
symfony:
container_xml_path: %rootDir%/../../../var/cache/test/appTestDebugProjectContainer.xml
# https://github.com/phpstan/phpstan/issues/694#issuecomment-350724288
autoload_files:
- vendor/bin/.phpunit/phpunit-7.4/vendor/autoload.php
- vendor/bin/.phpunit/phpunit-8.3-0/vendor/autoload.php
inferPrivatePropertyTypeFromConstructor: true

View file

@ -4,7 +4,7 @@ namespace Wallabag\AnnotationBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\AnnotationBundle\Entity\Annotation;
use Wallabag\CoreBundle\DataFixtures\EntryFixtures;
use Wallabag\UserBundle\DataFixtures\UserFixtures;

View file

@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\UserBundle\DataFixtures\UserFixtures;
@ -13,7 +13,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$adminConfig = new Config($this->getReference('admin-user'));

View file

@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\UserBundle\DataFixtures\UserFixtures;
@ -13,7 +13,7 @@ class EntryFixtures extends Fixture implements DependentFixtureInterface
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$entries = [
'entry1' => [

View file

@ -3,7 +3,7 @@
namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
@ -23,7 +23,7 @@ class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAware
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
foreach ($this->container->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) {
$newIgnoreOriginInstanceRule = new IgnoreOriginInstanceRule();

View file

@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule;
use Wallabag\UserBundle\DataFixtures\UserFixtures;
@ -13,7 +13,7 @@ class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureIn
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$rule = new IgnoreOriginUserRule();
$rule->setRule('host = "example.fr"');

View file

@ -3,7 +3,7 @@
namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Wallabag\CoreBundle\Entity\InternalSetting;
@ -23,7 +23,7 @@ class InternalSettingFixtures extends Fixture implements ContainerAwareInterface
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) {
$newSetting = new InternalSetting();

View file

@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Wallabag\CoreBundle\Entity\SiteCredential;
@ -25,7 +25,7 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$credential = new SiteCredential($this->getReference('admin-user'));
$credential->setHost('.super.com');

View file

@ -3,7 +3,7 @@
namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\Tag;
class TagFixtures extends Fixture
@ -11,7 +11,7 @@ class TagFixtures extends Fixture
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$tags = [
'foo-bar-tag' => 'foo bar', //tag used for EntryControllerTest

View file

@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\TaggingRule;
class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
@ -12,7 +12,7 @@ class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$tr1 = new TaggingRule();
$tr1->setRule('content matches "spurs"');

View file

@ -3,7 +3,7 @@
namespace Wallabag\UserBundle\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Wallabag\UserBundle\Entity\User;
class UserFixtures extends Fixture

View file

@ -17,7 +17,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
*/
protected $user;
public function setUp()
public function setUp(): void
{
$this->client = $this->createAuthorizedClient();
}

View file

@ -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());

View file

@ -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()

View file

@ -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'));

View file

@ -17,7 +17,7 @@ abstract class WallabagApiTestCase extends WebTestCase
*/
protected $user;
public function setUp()
public function setUp(): void
{
$this->client = $this->createAuthorizedClient();
}

View file

@ -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);

View file

@ -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');
}

View file

@ -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);

View file

@ -18,19 +18,19 @@ use Wallabag\CoreBundle\Command\InstallCommand;
class InstallCommandTest extends WallabagCoreTestCase
{
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
// disable doctrine-test-bundle
StaticDriver::setKeepStaticConnections(false);
}
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
// enable doctrine-test-bundle
StaticDriver::setKeepStaticConnections(true);
}
public function setUp()
public function setUp(): void
{
parent::setUp();
@ -66,7 +66,7 @@ class InstallCommandTest extends WallabagCoreTestCase
$this->resetDatabase($this->getClient());
}
public function tearDown()
public function tearDown(): void
{
$databasePath = getenv('TEST_DATABASE_PATH');
// Remove variable environnement
@ -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());
}
}

View file

@ -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());
}
}

View file

@ -22,7 +22,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
*/
public $bobEntry;
public function setUp()
public function setUp(): void
{
parent::setUp();
@ -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());
}
}

View file

@ -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());
}
}

View file

@ -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());
}
}

View file

@ -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();

View file

@ -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()

View file

@ -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->assertSame(\count($contentInDB), $content->count());
$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);

View file

@ -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);

View file

@ -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]);
}
}
}

View file

@ -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());
}
}

View file

@ -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)

View file

@ -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')

View file

@ -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());

View file

@ -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');
}

View file

@ -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, '<div><img src="http://i.imgur.com/T9qgcHc.jpg" /></div>', '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, '<p><img class="alignnone wp-image-1153" src="http://piketty.blog.lemonde.fr/files/2017/10/F1FR-530x375.jpg" alt="" width="628" height="444" srcset="http://piketty.blog.lemonde.fr/files/2017/10/F1FR-530x375.jpg 530w, http://piketty.blog.lemonde.fr/files/2017/10/F1FR-768x543.jpg 768w, http://piketty.blog.lemonde.fr/files/2017/10/F1FR-900x636.jpg 900w" sizes="(max-width: 628px) 100vw, 628px" /></p>', '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="" /></figure>', '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()

View file

@ -20,7 +20,7 @@ class RedirectTest extends TestCase
/** @var UsernamePasswordToken */
private $token;
public function setUp()
public function setUp(): void
{
$this->routerMock = $this->getMockBuilder('Symfony\Component\Routing\Router')
->disableOriginalConstructor()

View file

@ -20,7 +20,7 @@ class RuleBasedIgnoreOriginProcessorTest extends TestCase
private $logger;
private $handler;
public function setUp()
public function setUp(): void
{
$this->rulerz = $this->getRulerZMock();
$this->logger = $this->getLogger();

View file

@ -21,7 +21,7 @@ class RuleBasedTaggerTest extends TestCase
private $logger;
private $handler;
public function setUp()
public function setUp(): void
{
$this->rulerz = $this->getRulerZMock();
$this->tagRepository = $this->getTagRepositoryMock();

View file

@ -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();

View file

@ -18,7 +18,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
*/
private $client = null;
public function setUp()
public function setUp(): void
{
parent::setUp();

View file

@ -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());
}
}

View file

@ -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());
}
}

View file

@ -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]);
}
}

View file

@ -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')

View file

@ -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]);
}
}

View file

@ -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()

View file

@ -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]);
}
}

View file

@ -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]);
}
}

View file

@ -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]);
}
}

View file

@ -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]);
}
}

View file

@ -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]);
}
}

View file

@ -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]);
}
}

View file

@ -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']);
}

View file

@ -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']);
}

View file

@ -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']);
}

View file

@ -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
));

View file

@ -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']);
}

View file

@ -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']);
}

View file

@ -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']);
}

View file

@ -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()

View file

@ -19,7 +19,7 @@ class AuthenticationFailureListenerTest extends TestCase
private $listener;
private $dispatcher;
protected function setUp()
protected function setUp(): void
{
$request = Request::create('/');
$request->request->set('_username', 'admin');

View file

@ -22,7 +22,7 @@ class CreateConfigListenerTest extends TestCase
private $request;
private $response;
protected function setUp()
protected function setUp(): void
{
$session = new Session(new MockArraySessionStorage());
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')

View file

@ -14,7 +14,7 @@ class AuthCodeMailerTest extends TestCase
protected $spool;
protected $twig;
protected function setUp()
protected function setUp(): void
{
$this->spool = new CountableMemorySpool();
$transport = new \Swift_Transport_SpoolTransport(
@ -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());
}
}