Fix deprecated method in tests

This commit is contained in:
Jeremy Benoist
2020-06-15 13:37:50 +02:00
parent 7332d1f4e5
commit 732ec8a2eb
44 changed files with 314 additions and 326 deletions

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