diff --git a/Tests/Command/CreateDatabaseDoctrineTest.php b/Tests/Command/CreateDatabaseDoctrineTest.php index a90b36555..805661193 100644 --- a/Tests/Command/CreateDatabaseDoctrineTest.php +++ b/Tests/Command/CreateDatabaseDoctrineTest.php @@ -39,7 +39,10 @@ public function testExecute() : void array_merge(['command' => $command->getName()]) ); - $this->assertContains('Created database ' . sys_get_temp_dir() . '/' . $dbName . ' for connection named ' . $connectionName, $commandTester->getDisplay()); + $this->assertStringContainsString( + 'Created database ' . sys_get_temp_dir() . '/' . $dbName . ' for connection named ' . $connectionName, + $commandTester->getDisplay() + ); } /** @@ -81,12 +84,18 @@ public function testExecuteWithShardAlias(string $shardOption) : void $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName(), $shardOption => 1]); - $this->assertContains('Created database ' . sys_get_temp_dir() . '/shard_1 for connection named ' . $connectionName, $commandTester->getDisplay()); + $this->assertStringContainsString( + 'Created database ' . sys_get_temp_dir() . '/shard_1 for connection named ' . $connectionName, + $commandTester->getDisplay() + ); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName(), $shardOption => 2]); - $this->assertContains('Created database ' . sys_get_temp_dir() . '/shard_2 for connection named ' . $connectionName, $commandTester->getDisplay()); + $this->assertStringContainsString( + 'Created database ' . sys_get_temp_dir() . '/shard_2 for connection named ' . $connectionName, + $commandTester->getDisplay() + ); } public function provideShardOption() : Generator diff --git a/Tests/Command/DropDatabaseDoctrineTest.php b/Tests/Command/DropDatabaseDoctrineTest.php index 3064cc0ad..eef28598a 100644 --- a/Tests/Command/DropDatabaseDoctrineTest.php +++ b/Tests/Command/DropDatabaseDoctrineTest.php @@ -37,7 +37,7 @@ public function testExecute(array $options) : void array_merge(['command' => $command->getName()], $options) ); - $this->assertContains( + $this->assertStringContainsString( sprintf( 'Dropped database %s for connection named %s', sys_get_temp_dir() . '/' . $dbName, @@ -77,7 +77,7 @@ public function testExecuteWithoutOptionForceWillFailWithAttentionMessage() : vo array_merge(['command' => $command->getName()]) ); - $this->assertContains( + $this->assertStringContainsString( sprintf( 'Would drop the database %s for connection named %s.', sys_get_temp_dir() . '/' . $dbName, @@ -85,7 +85,10 @@ public function testExecuteWithoutOptionForceWillFailWithAttentionMessage() : vo ), $commandTester->getDisplay() ); - $this->assertContains('Please run the operation with --force to execute', $commandTester->getDisplay()); + $this->assertStringContainsString( + 'Please run the operation with --force to execute', + $commandTester->getDisplay() + ); } public function provideForceOption() : Generator diff --git a/Tests/Command/ImportMappingDoctrineCommandTest.php b/Tests/Command/ImportMappingDoctrineCommandTest.php index 5433bd9fe..91d293431 100644 --- a/Tests/Command/ImportMappingDoctrineCommandTest.php +++ b/Tests/Command/ImportMappingDoctrineCommandTest.php @@ -70,7 +70,11 @@ public function testExecuteXmlWithBundle() : void $expectedMetadataPath = sys_get_temp_dir() . '/import_mapping_bundle/Resources/config/doctrine/Product.orm.xml'; $this->assertFileExists($expectedMetadataPath); - $this->assertContains('"Doctrine\Bundle\DoctrineBundle\Tests\Command\Entity\Product"', file_get_contents($expectedMetadataPath), 'Metadata contains correct namespace'); + $this->assertStringContainsString( + '"Doctrine\Bundle\DoctrineBundle\Tests\Command\Entity\Product"', + file_get_contents($expectedMetadataPath), + 'Metadata contains correct namespace' + ); } public function testExecuteAnnotationsWithBundle() : void @@ -82,7 +86,11 @@ public function testExecuteAnnotationsWithBundle() : void $expectedMetadataPath = sys_get_temp_dir() . '/import_mapping_bundle/Entity/Product.php'; $this->assertFileExists($expectedMetadataPath); - $this->assertContains('namespace Doctrine\Bundle\DoctrineBundle\Tests\Command\Entity;', file_get_contents($expectedMetadataPath), 'File contains correct namespace'); + $this->assertStringContainsString( + 'namespace Doctrine\Bundle\DoctrineBundle\Tests\Command\Entity;', + file_get_contents($expectedMetadataPath), + 'File contains correct namespace' + ); } /** @@ -103,7 +111,11 @@ public function testExecuteXmlWithNamespace() : void $expectedMetadataPath = $this->kernel->getProjectDir() . '/config/doctrine/Product.orm.xml'; $this->assertFileExists($expectedMetadataPath); - $this->assertContains('"Some\Namespace\Entity\Product"', file_get_contents($expectedMetadataPath), 'Metadata contains correct namespace'); + $this->assertStringContainsString( + '"Some\Namespace\Entity\Product"', + file_get_contents($expectedMetadataPath), + 'Metadata contains correct namespace' + ); } public function testExecuteAnnotationsWithNamespace() : void @@ -116,7 +128,11 @@ public function testExecuteAnnotationsWithNamespace() : void $expectedMetadataPath = $this->kernel->getProjectDir() . '/src/Entity/Product.php'; $this->assertFileExists($expectedMetadataPath); - $this->assertContains('namespace Some\Namespace\Entity;', file_get_contents($expectedMetadataPath), 'Metadata contains correct namespace'); + $this->assertStringContainsString( + 'namespace Some\Namespace\Entity;', + file_get_contents($expectedMetadataPath), + 'Metadata contains correct namespace' + ); } } diff --git a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index 6762310a1..aaf4d4e67 100644 --- a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -647,7 +647,10 @@ public function testSecondLevelCache() : void $this->assertEquals(600, $myEntityRegionArgs[2]); $this->assertEquals('doctrine.orm.default_second_level_cache.region.my_query_region', $myQueryRegionArgs[0]); - $this->assertContains('/doctrine/orm/slc/filelock', $myQueryRegionArgs[1]); + $this->assertStringContainsString( + '/doctrine/orm/slc/filelock', + $myQueryRegionArgs[1] + ); $this->assertEquals(60, $myQueryRegionArgs[2]); $this->assertEquals('doctrine.orm.default_second_level_cache.regions_configuration', $slcFactoryArgs[0]); diff --git a/Tests/ProfilerTest.php b/Tests/ProfilerTest.php index 8276d554f..05f85f620 100644 --- a/Tests/ProfilerTest.php +++ b/Tests/ProfilerTest.php @@ -93,7 +93,7 @@ public function testRender() : void html_entity_decode($expectedEscapedSql) ); - $this->assertContains($expectedEscapedSql, $output); + $this->assertStringContainsString($expectedEscapedSql, $output); $this->assertSame(1, preg_match('/' . str_replace( ' ',