minor #39781 Use ::class keyword when possible (fabpot)

This PR was merged into the 4.4 branch.

Discussion
----------

Use ::class keyword when possible

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | n/a

As we cannot easily change all occurrences of class names to use the `::class` (no PHP CS Fixer rule for now, and probably never), I've added this feature in fabbot.io for when we are 100% sure that the string is indeed a class name (I detect strings for `getMockBuilder()` or `is_class()`, ...).

For now, I use the short class name when available as a use statement, and I fall back to the FQCN when not (I don't add use statements, which should probably be done as another fixer).

Commits
-------

6c8d5808a6 Use ::class keyword when possible
This commit is contained in:
Fabien Potencier 2021-01-11 10:47:10 +01:00
commit bde3e28084
751 changed files with 3180 additions and 3180 deletions

View File

@ -66,7 +66,7 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
if ($metadata instanceof ClassMetadataInfo && class_exists('Doctrine\ORM\Mapping\Embedded') && $metadata->embeddedClasses) {
if ($metadata instanceof ClassMetadataInfo && class_exists(\Doctrine\ORM\Mapping\Embedded::class) && $metadata->embeddedClasses) {
$properties = array_filter($properties, function ($property) {
return false === strpos($property, '.');
});
@ -142,7 +142,7 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
)];
}
if ($metadata instanceof ClassMetadataInfo && class_exists('Doctrine\ORM\Mapping\Embedded') && isset($metadata->embeddedClasses[$property])) {
if ($metadata instanceof ClassMetadataInfo && class_exists(\Doctrine\ORM\Mapping\Embedded::class) && isset($metadata->embeddedClasses[$property])) {
return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $metadata->embeddedClasses[$property]['class'])];
}

View File

@ -229,7 +229,7 @@ EOTXT
private function createCollector($queries)
{
$connection = $this->getMockBuilder('Doctrine\DBAL\Connection')
$connection = $this->getMockBuilder(\Doctrine\DBAL\Connection::class)
->disableOriginalConstructor()
->getMock();
$connection->expects($this->any())
@ -249,7 +249,7 @@ EOTXT
->method('getConnection')
->willReturn($connection);
$logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock();
$logger = $this->getMockBuilder(\Doctrine\DBAL\Logging\DebugStack::class)->getMock();
$logger->queries = $queries;
$collector = new DoctrineDataCollector($registry);

View File

@ -19,7 +19,7 @@ class ContainerAwareLoaderTest extends TestCase
{
public function testShouldSetContainerOnContainerAwareFixture()
{
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
$loader = new ContainerAwareLoader($container);
$fixture = new ContainerAwareFixture();

View File

@ -23,7 +23,7 @@ class RegisterEventListenersAndSubscribersPassTest extends TestCase
{
public function testExceptionOnAbstractTaggedSubscriber()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$container = $this->createBuilder();
$abstractDefinition = new Definition('stdClass');
@ -37,7 +37,7 @@ class RegisterEventListenersAndSubscribersPassTest extends TestCase
public function testExceptionOnAbstractTaggedListener()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$container = $this->createBuilder();
$abstractDefinition = new Definition('stdClass');

View File

@ -11,7 +11,7 @@ class RegisterMappingsPassTest extends TestCase
{
public function testNoDriverParmeterException()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
$container = $this->createBuilder();
$this->process($container, [

View File

@ -31,7 +31,7 @@ class DoctrineExtensionTest extends TestCase
parent::setUp();
$this->extension = $this
->getMockBuilder('Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension')
->getMockBuilder(\Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension::class)
->setMethods([
'getMappingResourceConfigDirectory',
'getObjectManagerElementName',
@ -51,7 +51,7 @@ class DoctrineExtensionTest extends TestCase
public function testFixManagersAutoMappingsWithTwoAutomappings()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$emConfigs = [
'em1' => [
'auto_mapping' => true,
@ -234,7 +234,7 @@ class DoctrineExtensionTest extends TestCase
public function testUnrecognizedCacheDriverException()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('"unrecognized_type" is an unrecognized Doctrine cache driver.');
$cacheName = 'metadata_cache';
$container = $this->createContainer();

View File

@ -75,11 +75,11 @@ class DoctrineChoiceLoaderTest extends TestCase
protected function setUp(): void
{
$this->factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->factory = $this->getMockBuilder(ChoiceListFactoryInterface::class)->getMock();
$this->om = $this->getMockBuilder(ObjectManager::class)->getMock();
$this->repository = $this->getMockBuilder(ObjectRepository::class)->getMock();
$this->class = 'stdClass';
$this->idReader = $this->getMockBuilder('Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader')
$this->idReader = $this->getMockBuilder(IdReader::class)
->disableOriginalConstructor()
->getMock();
$this->idReader->expects($this->any())
@ -87,7 +87,7 @@ class DoctrineChoiceLoaderTest extends TestCase
->willReturn(true)
;
$this->objectLoader = $this->getMockBuilder('Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface')->getMock();
$this->objectLoader = $this->getMockBuilder(EntityLoaderInterface::class)->getMock();
$this->obj1 = (object) ['name' => 'A'];
$this->obj2 = (object) ['name' => 'B'];
$this->obj3 = (object) ['name' => 'C'];

View File

@ -33,7 +33,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
{
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
$query = $this->getMockBuilder(\QueryMock::class)
->setMethods(['setParameter', 'getResult', 'getSql', '_doExecute'])
->getMock();
@ -46,7 +46,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', [1, 2], $expectedType)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
$qb = $this->getMockBuilder(\Doctrine\ORM\QueryBuilder::class)
->setConstructorArgs([$em])
->setMethods(['getQuery'])
->getMock();
@ -66,7 +66,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
{
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
$query = $this->getMockBuilder(\QueryMock::class)
->setMethods(['setParameter', 'getResult', 'getSql', '_doExecute'])
->getMock();
@ -79,7 +79,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', [1, 2, 3, '9223372036854775808'], Connection::PARAM_INT_ARRAY)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
$qb = $this->getMockBuilder(\Doctrine\ORM\QueryBuilder::class)
->setConstructorArgs([$em])
->setMethods(['getQuery'])
->getMock();
@ -102,7 +102,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
{
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
$query = $this->getMockBuilder(\QueryMock::class)
->setMethods(['setParameter', 'getResult', 'getSql', '_doExecute'])
->getMock();
@ -115,7 +115,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', ['71c5fd46-3f16-4abb-bad7-90ac1e654a2d', 'b98e8e11-2897-44df-ad24-d2627eb7f499'], Connection::PARAM_STR_ARRAY)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
$qb = $this->getMockBuilder(\Doctrine\ORM\QueryBuilder::class)
->setConstructorArgs([$em])
->setMethods(['getQuery'])
->getMock();
@ -141,7 +141,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
$query = $this->getMockBuilder(\QueryMock::class)
->setMethods(['setParameter', 'getResult', 'getSql', '_doExecute'])
->getMock();
@ -154,7 +154,7 @@ class ORMQueryBuilderLoaderTest extends TestCase
->with('ORMQueryBuilderLoader_getEntitiesByIds_id_value', [1, 2, 3], Connection::PARAM_INT_ARRAY)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
$qb = $this->getMockBuilder(\Doctrine\ORM\QueryBuilder::class)
->setConstructorArgs([$em])
->setMethods(['getQuery'])
->getMock();

View File

@ -64,7 +64,7 @@ class CollectionToArrayTransformerTest extends TestCase
public function testTransformExpectsArrayOrCollection()
{
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->transform('Foo');
}

View File

@ -34,21 +34,21 @@ class DoctrineOrmTypeGuesserTest extends TestCase
$return = [];
// Simple field, not nullable
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
$classMetadata->fieldMappings['field'] = true;
$classMetadata->expects($this->once())->method('isNullable')->with('field')->willReturn(false);
$return[] = [$classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)];
// Simple field, nullable
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
$classMetadata->fieldMappings['field'] = true;
$classMetadata->expects($this->once())->method('isNullable')->with('field')->willReturn(true);
$return[] = [$classMetadata, new ValueGuess(false, Guess::MEDIUM_CONFIDENCE)];
// One-to-one, nullable (by default)
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true);
$mapping = ['joinColumns' => [[]]];
@ -57,7 +57,7 @@ class DoctrineOrmTypeGuesserTest extends TestCase
$return[] = [$classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)];
// One-to-one, nullable (explicit)
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true);
$mapping = ['joinColumns' => [['nullable' => true]]];
@ -66,7 +66,7 @@ class DoctrineOrmTypeGuesserTest extends TestCase
$return[] = [$classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)];
// One-to-one, not nullable
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true);
$mapping = ['joinColumns' => [['nullable' => false]]];
@ -75,7 +75,7 @@ class DoctrineOrmTypeGuesserTest extends TestCase
$return[] = [$classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)];
// One-to-many, no clue
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(false);
$return[] = [$classMetadata, null];

View File

@ -32,7 +32,7 @@ class MergeDoctrineCollectionListenerTest extends TestCase
{
$this->collection = new ArrayCollection(['test']);
$this->dispatcher = new EventDispatcher();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->factory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
$this->form = $this->getBuilder()
->getForm();
}

View File

@ -118,13 +118,13 @@ class EntityTypeTest extends BaseTypeTest
public function testClassOptionIsRequired()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\MissingOptionsException');
$this->expectException(\Symfony\Component\OptionsResolver\Exception\MissingOptionsException::class);
$this->factory->createNamed('name', static::TESTED_TYPE);
}
public function testInvalidClassOption()
{
$this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$this->factory->createNamed('name', static::TESTED_TYPE, null, [
'class' => 'foo',
]);
@ -219,7 +219,7 @@ class EntityTypeTest extends BaseTypeTest
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->createNamed('name', static::TESTED_TYPE, null, [
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@ -229,7 +229,7 @@ class EntityTypeTest extends BaseTypeTest
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
{
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@ -1242,7 +1242,7 @@ class EntityTypeTest extends BaseTypeTest
$choiceLoader2 = $form->get('property2')->getConfig()->getOption('choice_loader');
$choiceLoader3 = $form->get('property3')->getConfig()->getOption('choice_loader');
$this->assertInstanceOf('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface', $choiceLoader1);
$this->assertInstanceOf(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class, $choiceLoader1);
$this->assertSame($choiceLoader1, $choiceLoader2);
$this->assertSame($choiceLoader1, $choiceLoader3);
}
@ -1302,7 +1302,7 @@ class EntityTypeTest extends BaseTypeTest
$choiceLoader2 = $form->get('property2')->getConfig()->getOption('choice_loader');
$choiceLoader3 = $form->get('property3')->getConfig()->getOption('choice_loader');
$this->assertInstanceOf('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface', $choiceLoader1);
$this->assertInstanceOf(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class, $choiceLoader1);
$this->assertSame($choiceLoader1, $choiceLoader2);
$this->assertSame($choiceLoader1, $choiceLoader3);
}

View File

@ -21,10 +21,10 @@ class DbalLoggerTest extends TestCase
*/
public function testLog($sql, $params, $logParams)
{
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$dbalLogger = $this
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
->getMockBuilder(DbalLogger::class)
->setConstructorArgs([$logger, null])
->setMethods(['log'])
->getMock()
@ -53,10 +53,10 @@ class DbalLoggerTest extends TestCase
public function testLogNonUtf8()
{
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$dbalLogger = $this
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
->getMockBuilder(DbalLogger::class)
->setConstructorArgs([$logger, null])
->setMethods(['log'])
->getMock()
@ -76,10 +76,10 @@ class DbalLoggerTest extends TestCase
public function testLogNonUtf8Array()
{
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$dbalLogger = $this
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
->getMockBuilder(DbalLogger::class)
->setConstructorArgs([$logger, null])
->setMethods(['log'])
->getMock()
@ -107,10 +107,10 @@ class DbalLoggerTest extends TestCase
public function testLogLongString()
{
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$dbalLogger = $this
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
->getMockBuilder(DbalLogger::class)
->setConstructorArgs([$logger, null])
->setMethods(['log'])
->getMock()
@ -135,10 +135,10 @@ class DbalLoggerTest extends TestCase
public function testLogUTF8LongString()
{
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$dbalLogger = $this
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
->getMockBuilder(DbalLogger::class)
->setConstructorArgs([$logger, null])
->setMethods(['log'])
->getMock()

View File

@ -19,7 +19,7 @@ class ManagerRegistryTest extends TestCase
{
public static function setUpBeforeClass(): void
{
if (!class_exists('PHPUnit_Framework_TestCase')) {
if (!class_exists(\PHPUnit_Framework_TestCase::class)) {
self::markTestSkipped('proxy-manager-bridge is not yet compatible with namespaced phpunit versions.');
}
$test = new PhpDumperTest();

View File

@ -55,7 +55,7 @@ class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase
public function testTransactionIsRolledBackOnException()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Thrown from next middleware.');
$this->connection->expects($this->once())
->method('beginTransaction')

View File

@ -105,7 +105,7 @@ class DoctrineExtractorTest extends TestCase
private function doTestGetPropertiesWithEmbedded(bool $legacy)
{
if (!class_exists('Doctrine\ORM\Mapping\Embedded')) {
if (!class_exists(\Doctrine\ORM\Mapping\Embedded::class)) {
$this->markTestSkipped('@Embedded is not available in Doctrine ORM lower than 2.5.');
}
@ -151,7 +151,7 @@ class DoctrineExtractorTest extends TestCase
private function doTestExtractWithEmbedded(bool $legacy)
{
if (!class_exists('Doctrine\ORM\Mapping\Embedded')) {
if (!class_exists(\Doctrine\ORM\Mapping\Embedded::class)) {
$this->markTestSkipped('@Embedded is not available in Doctrine ORM lower than 2.5.');
}

View File

@ -71,7 +71,7 @@ class EntityUserProviderTest extends TestCase
->with('user1')
->willReturn($user);
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
$em = $this->getMockBuilder(\Doctrine\ORM\EntityManager::class)
->disableOriginalConstructor()
->getMock();
$em
@ -86,7 +86,7 @@ class EntityUserProviderTest extends TestCase
public function testLoadUserByUsernameWithNonUserLoaderRepositoryAndWithoutProperty()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('You must either make the "Symfony\Bridge\Doctrine\Tests\Fixtures\User" entity Doctrine Repository ("Doctrine\ORM\EntityRepository") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.');
$em = DoctrineTestHelper::createTestEntityManager();
$this->createSchema($em);
@ -107,7 +107,7 @@ class EntityUserProviderTest extends TestCase
$user1 = new User(null, null, 'user1');
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine');
$provider->refreshUser($user1);
}
@ -125,7 +125,7 @@ class EntityUserProviderTest extends TestCase
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
$user2 = new User(1, 2, 'user2');
$this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$this->expectException(\Symfony\Component\Security\Core\Exception\UsernameNotFoundException::class);
$this->expectExceptionMessage('User with id {"id1":1,"id2":2} not found');
$provider->refreshUser($user2);
@ -168,7 +168,7 @@ class EntityUserProviderTest extends TestCase
public function testLoadUserByUserNameShouldDeclineInvalidInterface()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$repository = $this->createMock(ObjectRepository::class);
$provider = new EntityUserProvider(

View File

@ -269,7 +269,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgnoreNullEnabled()
{
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new UniqueEntity([
'message' => 'myMessage',
'fields' => ['name', 'name2'],
@ -578,7 +578,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
public function testDedicatedEntityManagerNullObject()
{
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('Object manager "foo" does not exist.');
$constraint = new UniqueEntity([
'message' => 'myMessage',
@ -598,7 +598,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
public function testEntityManagerNullObject()
{
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('Unable to find the object manager associated with an entity of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity"');
$constraint = new UniqueEntity([
'message' => 'myMessage',
@ -680,7 +680,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
public function testInvalidateRepositoryForInheritance()
{
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity" entity repository does not support the "Symfony\Bridge\Doctrine\Tests\Fixtures\Person" entity. The entity should be an instance of or extend "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity".');
$constraint = new UniqueEntity([
'message' => 'myMessage',

View File

@ -46,7 +46,7 @@ class ConsoleHandlerTest extends TestCase
*/
public function testVerbosityMapping($verbosity, $level, $isHandling, array $map = [])
{
$output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock();
$output = $this->getMockBuilder(OutputInterface::class)->getMock();
$output
->expects($this->atLeastOnce())
->method('getVerbosity')
@ -61,7 +61,7 @@ class ConsoleHandlerTest extends TestCase
$levelName = Logger::getLevelName($level);
$levelName = sprintf('%-9s', $levelName);
$realOutput = $this->getMockBuilder('Symfony\Component\Console\Output\Output')->setMethods(['doWrite'])->getMock();
$realOutput = $this->getMockBuilder(\Symfony\Component\Console\Output\Output::class)->setMethods(['doWrite'])->getMock();
$realOutput->setVerbosity($verbosity);
if ($realOutput->isDebug()) {
$log = "16:21:54 $levelName [app] My info message\n";
@ -110,7 +110,7 @@ class ConsoleHandlerTest extends TestCase
public function testVerbosityChanged()
{
$output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock();
$output = $this->getMockBuilder(OutputInterface::class)->getMock();
$output
->expects($this->exactly(2))
->method('getVerbosity')
@ -131,14 +131,14 @@ class ConsoleHandlerTest extends TestCase
public function testGetFormatter()
{
$handler = new ConsoleHandler();
$this->assertInstanceOf('Symfony\Bridge\Monolog\Formatter\ConsoleFormatter', $handler->getFormatter(),
$this->assertInstanceOf(\Symfony\Bridge\Monolog\Formatter\ConsoleFormatter::class, $handler->getFormatter(),
'-getFormatter returns ConsoleFormatter by default'
);
}
public function testWritingAndFormatting()
{
$output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock();
$output = $this->getMockBuilder(OutputInterface::class)->getMock();
$output
->expects($this->any())
->method('getVerbosity')
@ -193,12 +193,12 @@ class ConsoleHandlerTest extends TestCase
$logger->info('After terminate message.');
});
$event = new ConsoleCommandEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output);
$event = new ConsoleCommandEvent(new Command('foo'), $this->getMockBuilder(\Symfony\Component\Console\Input\InputInterface::class)->getMock(), $output);
$dispatcher->dispatch($event, ConsoleEvents::COMMAND);
$this->assertStringContainsString('Before command message.', $out = $output->fetch());
$this->assertStringContainsString('After command message.', $out);
$event = new ConsoleTerminateEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output, 0);
$event = new ConsoleTerminateEvent(new Command('foo'), $this->getMockBuilder(\Symfony\Component\Console\Input\InputInterface::class)->getMock(), $output, 0);
$dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
$this->assertStringContainsString('Before terminate message.', $out = $output->fetch());
$this->assertStringContainsString('After terminate message.', $out);

View File

@ -22,13 +22,13 @@ class HttpCodeActivationStrategyTest extends TestCase
{
public function testExclusionsWithoutCode()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
new HttpCodeActivationStrategy(new RequestStack(), [['urls' => []]], Logger::WARNING);
}
public function testExclusionsWithoutUrls()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
new HttpCodeActivationStrategy(new RequestStack(), [['code' => 404]], Logger::WARNING);
}

View File

@ -109,7 +109,7 @@ class WebProcessorTest extends TestCase
private function isExtraFieldsSupported()
{
$monologWebProcessorClass = new \ReflectionClass('Monolog\Processor\WebProcessor');
$monologWebProcessorClass = new \ReflectionClass(\Monolog\Processor\WebProcessor::class);
foreach ($monologWebProcessorClass->getConstructor()->getParameters() as $parameter) {
if ('extraFields' === $parameter->getName()) {

View File

@ -332,7 +332,7 @@ class DeprecationErrorHandler
private static function getPhpUnitErrorHandler()
{
if (!isset(self::$isAtLeastPhpUnit83)) {
self::$isAtLeastPhpUnit83 = class_exists('PHPUnit\Util\ErrorHandler') && method_exists('PHPUnit\Util\ErrorHandler', '__invoke');
self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke');
}
if (!self::$isAtLeastPhpUnit83) {
return 'PHPUnit\Util\ErrorHandler::handleError';

View File

@ -133,8 +133,8 @@ class SymfonyTestsListenerTrait
echo "Testing $suiteName\n";
$this->state = 0;
if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
AnnotationRegistry::registerUniqueLoader('class_exists');
} else {
AnnotationRegistry::registerLoader('class_exists');

View File

@ -17,7 +17,7 @@ class BarCovTest extends TestCase
{
public function testBarCov()
{
if (!class_exists('PhpUnitCoverageTest\FooCov')) {
if (!class_exists(\PhpUnitCoverageTest\FooCov::class)) {
$this->markTestSkipped('This test is not part of the main Symfony test suite. It\'s here to test the CoverageListener.');
}

View File

@ -24,7 +24,7 @@ class ProcessIsolationTest extends TestCase
public function testCallingOtherErrorHandler()
{
$this->expectException('PHPUnit\Framework\Exception');
$this->expectException(\PHPUnit\Framework\Exception::class);
$this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.');
trigger_error('Test that PHPUnit\'s error handler fires.', \E_USER_WARNING);

View File

@ -262,17 +262,17 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
if (!class_exists('SymfonyExcludeListPhpunit', false)) {
if (!class_exists(\SymfonyExcludeListPhpunit::class, false)) {
class SymfonyExcludeListPhpunit {}
}
if (method_exists('PHPUnit\Util\ExcludeList', 'addDirectory')) {
if (method_exists(\PHPUnit\Util\ExcludeList::class, 'addDirectory')) {
(new PHPUnit\Util\Excludelist())->getExcludedDirectories();
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
} elseif (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName()));
class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName()));
} elseif (method_exists(\PHPUnit\Util\Blacklist::class, 'addDirectory')) {
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName()));
class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName()));
} else {
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1;
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1;
@ -397,7 +397,7 @@ if ($components) {
}
}
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
if (!class_exists('SymfonyExcludeListSimplePhpunit', false)) {
if (!class_exists(\SymfonyExcludeListSimplePhpunit::class, false)) {
class SymfonyExcludeListSimplePhpunit
{
}

View File

@ -12,7 +12,7 @@
use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
if (class_exists(\PHPUnit_Runner_Version::class) && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
$classes = [
'PHPUnit_Framework_Assert', // override PhpUnit's ForwardCompat child class
'PHPUnit_Framework_AssertionFailedError', // override PhpUnit's ForwardCompat child class
@ -110,15 +110,15 @@ if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
}
// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists(\PHPUnit_TextUI_Command::class, false) && !class_exists(\PHPUnit\TextUI\Command::class, false)) {
return;
}
// Enforce a consistent locale
setlocale(\LC_ALL, 'C');
if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
AnnotationRegistry::registerUniqueLoader('class_exists');
} else {
AnnotationRegistry::registerLoader('class_exists');

View File

@ -38,15 +38,15 @@ class PhpDumperTest extends TestCase
*/
public function testDumpContainerWithProxyServiceWillShareProxies()
{
if (!class_exists('LazyServiceProjectServiceContainer', false)) {
if (!class_exists(\LazyServiceProjectServiceContainer::class, false)) {
eval('?>'.$this->dumpLazyServiceProjectServiceContainer());
}
$container = new \LazyServiceProjectServiceContainer();
$proxy = $container->get('foo');
$this->assertInstanceOf('stdClass', $proxy);
$this->assertInstanceOf('ProxyManager\Proxy\LazyLoadingInterface', $proxy);
$this->assertInstanceOf(\stdClass::class, $proxy);
$this->assertInstanceOf(\ProxyManager\Proxy\LazyLoadingInterface::class, $proxy);
$this->assertSame($proxy, $container->get('foo'));
$this->assertFalse($proxy->isProxyInitialized());

View File

@ -38,7 +38,7 @@ class RuntimeInstantiatorTest extends TestCase
public function testInstantiateProxy()
{
$instance = new \stdClass();
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
$definition = new Definition('stdClass');
$instantiator = function () use ($instance) {
return $instance;
@ -47,8 +47,8 @@ class RuntimeInstantiatorTest extends TestCase
/* @var $proxy \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface */
$proxy = $this->instantiator->instantiateProxy($container, $definition, 'foo', $instantiator);
$this->assertInstanceOf('ProxyManager\Proxy\LazyLoadingInterface', $proxy);
$this->assertInstanceOf('ProxyManager\Proxy\ValueHolderInterface', $proxy);
$this->assertInstanceOf(\ProxyManager\Proxy\LazyLoadingInterface::class, $proxy);
$this->assertInstanceOf(\ProxyManager\Proxy\ValueHolderInterface::class, $proxy);
$this->assertFalse($proxy->isProxyInitialized());
$proxy->initializeProxy();

View File

@ -111,7 +111,7 @@ class ProxyDumperTest extends TestCase
public function testGetProxyFactoryCodeWithoutCustomMethod()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Missing factory code to construct the service "foo".');
$definition = new Definition(__CLASS__);
$definition->setLazy(true);

View File

@ -20,7 +20,7 @@ use Twig\Node\Node;
use Twig\Node\TextNode;
// BC/FC with namespaced Twig
class_exists('Twig\Node\Expression\ArrayExpression');
class_exists(ArrayExpression::class);
/**
* @author Fabien Potencier <fabien@symfony.com>

View File

@ -50,7 +50,7 @@ class AppVariableTest extends TestCase
*/
public function testGetSession()
{
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
$request = $this->getMockBuilder(Request::class)->getMock();
$request->method('hasSession')->willReturn(true);
$request->method('getSession')->willReturn($session = new Session());
@ -75,10 +75,10 @@ class AppVariableTest extends TestCase
public function testGetToken()
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->appVariable->setTokenStorage($tokenStorage);
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$tokenStorage->method('getToken')->willReturn($token);
$this->assertEquals($token, $this->appVariable->getToken());
@ -86,7 +86,7 @@ class AppVariableTest extends TestCase
public function testGetUser()
{
$this->setTokenStorage($user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock());
$this->setTokenStorage($user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock());
$this->assertEquals($user, $this->appVariable->getUser());
}
@ -100,7 +100,7 @@ class AppVariableTest extends TestCase
public function testGetTokenWithNoToken()
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->appVariable->setTokenStorage($tokenStorage);
$this->assertNull($this->appVariable->getToken());
@ -108,7 +108,7 @@ class AppVariableTest extends TestCase
public function testGetUserWithNoToken()
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->appVariable->setTokenStorage($tokenStorage);
$this->assertNull($this->appVariable->getUser());
@ -116,37 +116,37 @@ class AppVariableTest extends TestCase
public function testEnvironmentNotSet()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->appVariable->getEnvironment();
}
public function testDebugNotSet()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->appVariable->getDebug();
}
public function testGetTokenWithTokenStorageNotSet()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->appVariable->getToken();
}
public function testGetUserWithTokenStorageNotSet()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->appVariable->getUser();
}
public function testGetRequestWithRequestStackNotSet()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->appVariable->getRequest();
}
public function testGetSessionWithRequestStackNotSet()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->appVariable->getSession();
}
@ -224,7 +224,7 @@ class AppVariableTest extends TestCase
protected function setRequestStack($request)
{
$requestStackMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
$requestStackMock = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestStack::class)->getMock();
$requestStackMock->method('getCurrentRequest')->willReturn($request);
$this->appVariable->setRequestStack($requestStackMock);
@ -232,10 +232,10 @@ class AppVariableTest extends TestCase
protected function setTokenStorage($user)
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->appVariable->setTokenStorage($tokenStorage);
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$tokenStorage->method('getToken')->willReturn($token);
$token->method('getUser')->willReturn($user);
@ -251,11 +251,11 @@ class AppVariableTest extends TestCase
$flashBag = new FlashBag();
$flashBag->initialize($flashMessages);
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock();
$session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock();
$session->method('isStarted')->willReturn($sessionHasStarted);
$session->method('getFlashBag')->willReturn($flashBag);
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
$request = $this->getMockBuilder(Request::class)->getMock();
$request->method('hasSession')->willReturn(true);
$request->method('getSession')->willReturn($session);
$this->setRequestStack($request);

View File

@ -91,7 +91,7 @@ class DebugCommandTest extends TestCase
public function testMalformedTemplateName()
{
$this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
$this->expectException(\Symfony\Component\Console\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Malformed namespaced template name "@foo" (expecting "@namespace/template_name").');
$this->createCommandTester()->execute(['name' => '@foo']);
}

View File

@ -48,7 +48,7 @@ class LintCommandTest extends TestCase
public function testLintFileNotReadable()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$tester = $this->createCommandTester();
$filename = $this->createFile('');
unlink($filename);

View File

@ -67,7 +67,7 @@ class DumpExtensionTest extends TestCase
public function testDump($context, $args, $expectedOutput, $debug = true)
{
$extension = new DumpExtension(new VarCloner());
$twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), [
$twig = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), [
'debug' => $debug,
'cache' => false,
'optimizations' => 0,
@ -124,7 +124,7 @@ class DumpExtensionTest extends TestCase
'</pre><script>Sfdump("%s")</script>'
);
$extension = new DumpExtension(new VarCloner(), $dumper);
$twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), [
$twig = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), [
'debug' => true,
'cache' => false,
'optimizations' => 0,

View File

@ -50,7 +50,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
'bootstrap_3_horizontal_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
}

View File

@ -46,7 +46,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
'bootstrap_3_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
}
@ -88,7 +88,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
'bootstrap_3_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
$view = $this->factory

View File

@ -52,7 +52,7 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori
'bootstrap_4_horizontal_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
}

View File

@ -50,7 +50,7 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
'bootstrap_4_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
}
@ -92,7 +92,7 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
'bootstrap_4_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
$view = $this->factory

View File

@ -53,7 +53,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
'form_div_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
}
@ -181,7 +181,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
'form_div_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
$view = $this->factory

View File

@ -50,7 +50,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
'form_table_layout.html.twig',
'custom_widgets.html.twig',
], $environment);
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $this->renderer);
}

View File

@ -62,7 +62,7 @@ class HttpFoundationExtensionTest extends TestCase
*/
public function testGenerateAbsoluteUrlWithRequestContext($path, $baseUrl, $host, $scheme, $httpPort, $httpsPort, $expected)
{
if (!class_exists('Symfony\Component\Routing\RequestContext')) {
if (!class_exists(RequestContext::class)) {
$this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.');
}
@ -77,7 +77,7 @@ class HttpFoundationExtensionTest extends TestCase
*/
public function testGenerateAbsoluteUrlWithoutRequestAndRequestContext($path)
{
if (!class_exists('Symfony\Component\Routing\RequestContext')) {
if (!class_exists(RequestContext::class)) {
$this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.');
}
@ -120,7 +120,7 @@ class HttpFoundationExtensionTest extends TestCase
*/
public function testGenerateRelativePath($expected, $path, $pathinfo)
{
if (!method_exists('Symfony\Component\HttpFoundation\Request', 'getRelativeUriForPath')) {
if (!method_exists(Request::class, 'getRelativeUriForPath')) {
$this->markTestSkipped('Your version of Symfony HttpFoundation is too old.');
}

View File

@ -24,7 +24,7 @@ class HttpKernelExtensionTest extends TestCase
{
public function testFragmentWithError()
{
$this->expectException('Twig\Error\RuntimeError');
$this->expectException(\Twig\Error\RuntimeError::class);
$renderer = $this->getFragmentHandler($this->throwException(new \Exception('foo')));
$this->renderTemplate($renderer);
@ -41,13 +41,13 @@ class HttpKernelExtensionTest extends TestCase
public function testUnknownFragmentRenderer()
{
$context = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
$context = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestStack::class)
->disableOriginalConstructor()
->getMock()
;
$renderer = new FragmentHandler($context);
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The "inline" renderer does not exist.');
$renderer->render('/foo');
@ -55,11 +55,11 @@ class HttpKernelExtensionTest extends TestCase
protected function getFragmentHandler($return)
{
$strategy = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface')->getMock();
$strategy = $this->getMockBuilder(\Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface::class)->getMock();
$strategy->expects($this->once())->method('getName')->willReturn('inline');
$strategy->expects($this->once())->method('render')->will($return);
$context = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
$context = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestStack::class)
->disableOriginalConstructor()
->getMock()
;
@ -75,7 +75,7 @@ class HttpKernelExtensionTest extends TestCase
$twig = new Environment($loader, ['debug' => true, 'cache' => false]);
$twig->addExtension(new HttpKernelExtension());
$loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Twig\RuntimeLoader\RuntimeLoaderInterface::class)->getMock();
$loader->expects($this->any())->method('load')->willReturnMap([
['Symfony\Bridge\Twig\Extension\HttpKernelRuntime', new HttpKernelRuntime($renderer)],
]);

View File

@ -24,8 +24,8 @@ class RoutingExtensionTest extends TestCase
*/
public function testEscaping($template, $mustBeEscaped)
{
$twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), ['debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0]);
$twig->addExtension(new RoutingExtension($this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock()));
$twig = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), ['debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0]);
$twig->addExtension(new RoutingExtension($this->getMockBuilder(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class)->getMock()));
$nodes = $twig->parse($twig->tokenize(new Source($template, '')));

View File

@ -18,7 +18,7 @@ trait RuntimeLoaderProvider
{
protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer)
{
$loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Twig\RuntimeLoader\RuntimeLoaderInterface::class)->getMock();
$loader->expects($this->any())->method('load')->will($this->returnValueMap([
['Symfony\Component\Form\FormRenderer', $renderer],
]));

View File

@ -21,7 +21,7 @@ class StopwatchExtensionTest extends TestCase
{
public function testFailIfStoppingWrongEvent()
{
$this->expectException('Twig\Error\SyntaxError');
$this->expectException(\Twig\Error\SyntaxError::class);
$this->testTiming('{% stopwatch "foo" %}{% endstopwatch "bar" %}', []);
}
@ -55,7 +55,7 @@ class StopwatchExtensionTest extends TestCase
protected function getStopwatch($events = [])
{
$events = \is_array($events) ? $events : [$events];
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
$stopwatch = $this->getMockBuilder(\Symfony\Component\Stopwatch\Stopwatch::class)->getMock();
$expectedCalls = 0;
$expectedStartCalls = [];

View File

@ -58,14 +58,14 @@ class TranslationExtensionTest extends TestCase
public function testTransUnknownKeyword()
{
$this->expectException('Twig\Error\SyntaxError');
$this->expectException(\Twig\Error\SyntaxError::class);
$this->expectExceptionMessage('Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.');
$this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render();
}
public function testTransComplexBody()
{
$this->expectException('Twig\Error\SyntaxError');
$this->expectException(\Twig\Error\SyntaxError::class);
$this->expectExceptionMessage('A message inside a trans tag must be a simple text in "index" at line 2.');
$this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render();
}
@ -75,7 +75,7 @@ class TranslationExtensionTest extends TestCase
*/
public function testTransChoiceComplexBody()
{
$this->expectException('Twig\Error\SyntaxError');
$this->expectException(\Twig\Error\SyntaxError::class);
$this->expectExceptionMessage('A message inside a transchoice tag must be a simple text in "index" at line 2.');
$this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render();
}

View File

@ -24,7 +24,7 @@ class DumpNodeTest extends TestCase
{
$node = new DumpNode('bar', null, 7);
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
$compiler = new Compiler($env);
$expected = <<<'EOTXT'
@ -48,7 +48,7 @@ EOTXT;
{
$node = new DumpNode('bar', null, 7);
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
$compiler = new Compiler($env);
$expected = <<<'EOTXT'
@ -75,7 +75,7 @@ EOTXT;
]);
$node = new DumpNode('bar', $vars, 7);
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
$compiler = new Compiler($env);
$expected = <<<'EOTXT'
@ -99,7 +99,7 @@ EOTXT;
]);
$node = new DumpNode('bar', $vars, 7);
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
$compiler = new Compiler($env);
$expected = <<<'EOTXT'

View File

@ -54,7 +54,7 @@ class FormThemeTest extends TestCase
$node = new FormThemeNode($form, $resources, 0);
$environment = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$environment = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
$formRenderer = new FormRenderer($this->getMockBuilder(FormRendererEngineInterface::class)->getMock());
$this->registerTwigRuntimeLoader($environment, $formRenderer);
$compiler = new Compiler($environment);

View File

@ -31,7 +31,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_widget', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
$this->assertEquals(
sprintf(
@ -54,7 +54,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_widget', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
$this->assertEquals(
sprintf(
@ -74,7 +74,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
$this->assertEquals(
sprintf(
@ -94,7 +94,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
// "label" => null must not be included in the output!
// Otherwise the default label is overwritten with null.
@ -116,7 +116,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
// "label" => null must not be included in the output!
// Otherwise the default label is overwritten with null.
@ -137,7 +137,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
$this->assertEquals(
sprintf(
@ -161,7 +161,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
// "label" => null must not be included in the output!
// Otherwise the default label is overwritten with null.
@ -190,7 +190,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
$this->assertEquals(
sprintf(
@ -218,7 +218,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
// "label" => null must not be included in the output!
// Otherwise the default label is overwritten with null.
@ -255,7 +255,7 @@ class SearchAndRenderBlockNodeTest extends TestCase
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
$compiler = new Compiler(new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock()));
// "label" => null must not be included in the output!
// Otherwise the default label is overwritten with null.

View File

@ -29,7 +29,7 @@ class TransNodeTest extends TestCase
$vars = new NameExpression('foo', 0);
$node = new TransNode($body, null, null, $vars);
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]);
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), ['strict_variables' => true]);
$compiler = new Compiler($env);
$this->assertEquals(

View File

@ -26,7 +26,7 @@ class TranslationDefaultDomainNodeVisitorTest extends TestCase
/** @dataProvider getDefaultDomainAssignmentTestData */
public function testDefaultDomainAssignment(Node $node)
{
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$visitor = new TranslationDefaultDomainNodeVisitor();
// visit trans_default_domain tag
@ -52,7 +52,7 @@ class TranslationDefaultDomainNodeVisitorTest extends TestCase
/** @dataProvider getDefaultDomainAssignmentTestData */
public function testNewModuleWithoutDefaultDomainTag(Node $node)
{
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$visitor = new TranslationDefaultDomainNodeVisitor();
// visit trans_default_domain tag

View File

@ -25,7 +25,7 @@ class TranslationNodeVisitorTest extends TestCase
/** @dataProvider getMessagesExtractionTestData */
public function testMessagesExtraction(Node $node, array $expectedMessages)
{
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$visitor = new TranslationNodeVisitor();
$visitor->enable();
$visitor->enterNode($node, $env);

View File

@ -28,7 +28,7 @@ class FormThemeTokenParserTest extends TestCase
*/
public function testCompile($source, $expected)
{
$env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$env = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$env->addTokenParser(new FormThemeTokenParser());
$source = new Source($source, '');
$stream = $env->tokenize($source);

View File

@ -26,7 +26,7 @@ class TwigExtractorTest extends TestCase
*/
public function testExtract($template, $messages)
{
$loader = $this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock();
$twig = new Environment($loader, [
'strict_variables' => true,
'debug' => true,
@ -102,7 +102,7 @@ class TwigExtractorTest extends TestCase
*/
public function testExtractSyntaxError($resources, array $messages)
{
$twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$twig = new Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
$twig->addExtension(new TranslationExtension($this->getMockBuilder(TranslatorInterface::class)->getMock()));
$extractor = new TwigExtractor($twig);

View File

@ -26,7 +26,7 @@ class TwigEngineTest extends TestCase
{
$engine = $this->getTwig();
$this->assertTrue($engine->exists($this->getMockForAbstractClass('Twig\Template', [], '', false)));
$this->assertTrue($engine->exists($this->getMockForAbstractClass(\Twig\Template::class, [], '', false)));
}
public function testExistsWithNonExistentTemplates()
@ -63,7 +63,7 @@ class TwigEngineTest extends TestCase
public function testRenderWithError()
{
$this->expectException('Twig\Error\SyntaxError');
$this->expectException(\Twig\Error\SyntaxError::class);
$engine = $this->getTwig();
$engine->render(new TemplateReference('error'));
@ -75,7 +75,7 @@ class TwigEngineTest extends TestCase
'index' => 'foo',
'error' => '{{ foo }',
]));
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$parser = $this->getMockBuilder(\Symfony\Component\Templating\TemplateNameParserInterface::class)->getMock();
return new TwigEngine($twig, $parser);
}

View File

@ -82,7 +82,7 @@ EOT
new TableSeparator(),
['Version', \PHP_VERSION],
['Architecture', (\PHP_INT_SIZE * 8).' bits'],
['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
['Intl locale', class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'],
['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],

View File

@ -197,7 +197,7 @@ class FrameworkExtension extends Extension
// default in the Form and Validator component). If disabled, an identity
// translator will be used and everything will still work as expected.
if ($this->isConfigEnabled($container, $config['translator']) || $this->isConfigEnabled($container, $config['form']) || $this->isConfigEnabled($container, $config['validation'])) {
if (!class_exists('Symfony\Component\Translation\Translator') && $this->isConfigEnabled($container, $config['translator'])) {
if (!class_exists(Translator::class) && $this->isConfigEnabled($container, $config['translator'])) {
throw new LogicException('Translation support cannot be enabled as the Translation component is not installed. Try running "composer require symfony/translation".');
}
@ -268,14 +268,14 @@ class FrameworkExtension extends Extension
$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
if ($this->isConfigEnabled($container, $config['form'])) {
if (!class_exists('Symfony\Component\Form\Form')) {
if (!class_exists(\Symfony\Component\Form\Form::class)) {
throw new LogicException('Form support cannot be enabled as the Form component is not installed. Try running "composer require symfony/form".');
}
$this->formConfigEnabled = true;
$this->registerFormConfiguration($config, $container, $loader);
if (class_exists('Symfony\Component\Validator\Validation')) {
if (class_exists(\Symfony\Component\Validator\Validation::class)) {
$config['validation']['enabled'] = true;
} else {
$container->setParameter('validator.translation_domain', 'validators');
@ -288,7 +288,7 @@ class FrameworkExtension extends Extension
}
if ($this->isConfigEnabled($container, $config['assets'])) {
if (!class_exists('Symfony\Component\Asset\Package')) {
if (!class_exists(\Symfony\Component\Asset\Package::class)) {
throw new LogicException('Asset support cannot be enabled as the Asset component is not installed. Try running "composer require symfony/asset".');
}
@ -298,7 +298,7 @@ class FrameworkExtension extends Extension
if ($this->isConfigEnabled($container, $config['templating'])) {
@trigger_error('Enabling the Templating component is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
if (!class_exists('Symfony\Component\Templating\PhpEngine')) {
if (!class_exists(\Symfony\Component\Templating\PhpEngine::class)) {
throw new LogicException('Templating support cannot be enabled as the Templating component is not installed. Try running "composer require symfony/templating".');
}
@ -351,7 +351,7 @@ class FrameworkExtension extends Extension
$this->registerSecretsConfiguration($config['secrets'], $container, $loader);
if ($this->isConfigEnabled($container, $config['serializer'])) {
if (!class_exists('Symfony\Component\Serializer\Serializer')) {
if (!class_exists(\Symfony\Component\Serializer\Serializer::class)) {
throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed. Try running "composer require symfony/serializer-pack".');
}
@ -1170,18 +1170,18 @@ class FrameworkExtension extends Extension
$dirs = [];
$transPaths = [];
$nonExistingDirs = [];
if (class_exists('Symfony\Component\Validator\Validation')) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validation');
if (class_exists(\Symfony\Component\Validator\Validation::class)) {
$r = new \ReflectionClass(\Symfony\Component\Validator\Validation::class);
$dirs[] = $transPaths[] = \dirname($r->getFileName()).'/Resources/translations';
}
if (class_exists('Symfony\Component\Form\Form')) {
$r = new \ReflectionClass('Symfony\Component\Form\Form');
if (class_exists(\Symfony\Component\Form\Form::class)) {
$r = new \ReflectionClass(\Symfony\Component\Form\Form::class);
$dirs[] = $transPaths[] = \dirname($r->getFileName()).'/Resources/translations';
}
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
if (class_exists(\Symfony\Component\Security\Core\Exception\AuthenticationException::class)) {
$r = new \ReflectionClass(\Symfony\Component\Security\Core\Exception\AuthenticationException::class);
$dirs[] = $transPaths[] = \dirname($r->getFileName(), 2).'/Resources/translations';
}
@ -1281,7 +1281,7 @@ class FrameworkExtension extends Extension
return;
}
if (!class_exists('Symfony\Component\Validator\Validation')) {
if (!class_exists(\Symfony\Component\Validator\Validation::class)) {
throw new LogicException('Validation support cannot be enabled as the Validator component is not installed. Try running "composer require symfony/validator".');
}
@ -1351,8 +1351,8 @@ class FrameworkExtension extends Extension
$files['yaml' === $extension ? 'yml' : $extension][] = $path;
};
if (interface_exists('Symfony\Component\Form\FormInterface')) {
$reflClass = new \ReflectionClass('Symfony\Component\Form\FormInterface');
if (interface_exists(\Symfony\Component\Form\FormInterface::class)) {
$reflClass = new \ReflectionClass(\Symfony\Component\Form\FormInterface::class);
$fileRecorder('xml', \dirname($reflClass->getFileName()).'/Resources/config/validation.xml');
}
@ -1413,7 +1413,7 @@ class FrameworkExtension extends Extension
return;
}
if (!class_exists('Doctrine\Common\Annotations\Annotation')) {
if (!class_exists(\Doctrine\Common\Annotations\Annotation::class)) {
throw new LogicException('Annotations cannot be enabled as the Doctrine Annotation library is not installed.');
}
@ -1425,7 +1425,7 @@ class FrameworkExtension extends Extension
}
if ('none' !== $config['cache']) {
if (!class_exists('Doctrine\Common\Cache\CacheProvider')) {
if (!class_exists(\Doctrine\Common\Cache\CacheProvider::class)) {
throw new LogicException('Annotations cannot be enabled as the Doctrine Cache library is not installed.');
}
@ -1469,7 +1469,7 @@ class FrameworkExtension extends Extension
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
if (!class_exists(PropertyAccessor::class)) {
return;
}
@ -1523,7 +1523,7 @@ class FrameworkExtension extends Extension
return;
}
if (!class_exists('Symfony\Component\Security\Csrf\CsrfToken')) {
if (!class_exists(\Symfony\Component\Security\Csrf\CsrfToken::class)) {
throw new LogicException('CSRF support cannot be enabled as the Security CSRF component is not installed. Try running "composer require symfony/security-csrf".');
}
@ -1554,7 +1554,7 @@ class FrameworkExtension extends Extension
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
if (!class_exists(PropertyAccessor::class)) {
$container->removeAlias('serializer.property_accessor');
$container->removeDefinition('serializer.normalizer.object');
}
@ -1643,7 +1643,7 @@ class FrameworkExtension extends Extension
$loader->load('property_info.xml');
if (interface_exists('phpDocumentor\Reflection\DocBlockFactoryInterface')) {
if (interface_exists(\phpDocumentor\Reflection\DocBlockFactoryInterface::class)) {
$definition = $container->register('property_info.php_doc_extractor', 'Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor');
$definition->setPrivate(true);
$definition->addTag('property_info.description_extractor', ['priority' => -1000]);

View File

@ -125,7 +125,7 @@ class AnnotationsCacheWarmerTest extends TestCase
*/
private function getReadOnlyReader()
{
$readerMock = $this->getMockBuilder('Doctrine\Common\Annotations\Reader')->getMock();
$readerMock = $this->getMockBuilder(Reader::class)->getMock();
$readerMock->expects($this->exactly(0))->method('getClassAnnotations');
$readerMock->expects($this->exactly(0))->method('getClassAnnotation');
$readerMock->expects($this->exactly(0))->method('getMethodAnnotations');

View File

@ -24,7 +24,7 @@ class TemplateFinderTest extends TestCase
public function testFindAllTemplates()
{
$kernel = $this
->getMockBuilder('Symfony\Component\HttpKernel\Kernel')
->getMockBuilder(\Symfony\Component\HttpKernel\Kernel::class)
->disableOriginalConstructor()
->getMock()
;

View File

@ -89,7 +89,7 @@ class CachePoolDeleteCommandTest extends TestCase
private function getKernel()
{
$container = $this
->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)
->getMock();
$kernel = $this

View File

@ -55,7 +55,7 @@ class CachePruneCommandTest extends TestCase
private function getKernel()
{
$container = $this
->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)
->getMock();
$kernel = $this

View File

@ -55,7 +55,7 @@ class RouterMatchCommandTest extends TestCase
$routeCollection = new RouteCollection();
$routeCollection->add('foo', new Route('foo'));
$requestContext = new RequestContext();
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
$router = $this->getMockBuilder(\Symfony\Component\Routing\RouterInterface::class)->getMock();
$router
->expects($this->any())
->method('getRouteCollection')
@ -70,7 +70,7 @@ class RouterMatchCommandTest extends TestCase
private function getKernel()
{
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
$container
->expects($this->atLeastOnce())
->method('has')

View File

@ -101,7 +101,7 @@ class TranslationDebugCommandTest extends TestCase
{
$this->fs->mkdir($this->translationDir.'/customDir/translations');
$this->fs->mkdir($this->translationDir.'/customDir/templates');
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel->expects($this->once())
->method('getBundle')
->with($this->equalTo($this->translationDir.'/customDir'))
@ -116,8 +116,8 @@ class TranslationDebugCommandTest extends TestCase
public function testDebugInvalidDirectory()
{
$this->expectException('InvalidArgumentException');
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$this->expectException(\InvalidArgumentException::class);
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel->expects($this->once())
->method('getBundle')
->with($this->equalTo('dir'))
@ -142,7 +142,7 @@ class TranslationDebugCommandTest extends TestCase
private function createCommandTester($extractedMessages = [], $loadedMessages = [], $kernel = null, array $transPaths = [], array $viewsPaths = []): CommandTester
{
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
$translator = $this->getMockBuilder(\Symfony\Component\Translation\Translator::class)
->disableOriginalConstructor()
->getMock();
@ -151,7 +151,7 @@ class TranslationDebugCommandTest extends TestCase
->method('getFallbackLocales')
->willReturn(['en']);
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
$extractor = $this->getMockBuilder(\Symfony\Component\Translation\Extractor\ExtractorInterface::class)->getMock();
$extractor
->expects($this->any())
->method('extract')
@ -161,7 +161,7 @@ class TranslationDebugCommandTest extends TestCase
}
);
$loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Reader\TranslationReader::class)->getMock();
$loader
->expects($this->any())
->method('read')
@ -182,7 +182,7 @@ class TranslationDebugCommandTest extends TestCase
['test', true, $this->getBundle('test')],
];
}
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel
->expects($this->any())
->method('getBundle')
@ -212,7 +212,7 @@ class TranslationDebugCommandTest extends TestCase
private function getBundle($path)
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
$bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\BundleInterface::class)->getMock();
$bundle
->expects($this->any())
->method('getPath')

View File

@ -154,7 +154,7 @@ class TranslationUpdateCommandTest extends TestCase
*/
private function createCommandTester($extractedMessages = [], $loadedMessages = [], HttpKernel\KernelInterface $kernel = null, array $transPaths = [], array $viewsPaths = [])
{
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
$translator = $this->getMockBuilder(\Symfony\Component\Translation\Translator::class)
->disableOriginalConstructor()
->getMock();
@ -163,7 +163,7 @@ class TranslationUpdateCommandTest extends TestCase
->method('getFallbackLocales')
->willReturn(['en']);
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
$extractor = $this->getMockBuilder(\Symfony\Component\Translation\Extractor\ExtractorInterface::class)->getMock();
$extractor
->expects($this->any())
->method('extract')
@ -175,7 +175,7 @@ class TranslationUpdateCommandTest extends TestCase
}
);
$loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Reader\TranslationReader::class)->getMock();
$loader
->expects($this->any())
->method('read')
@ -185,7 +185,7 @@ class TranslationUpdateCommandTest extends TestCase
}
);
$writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock();
$writer = $this->getMockBuilder(\Symfony\Component\Translation\Writer\TranslationWriter::class)->getMock();
$writer
->expects($this->any())
->method('getFormats')
@ -204,7 +204,7 @@ class TranslationUpdateCommandTest extends TestCase
['test', true, $this->getBundle('test')],
];
}
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel
->expects($this->any())
->method('getBundle')
@ -233,7 +233,7 @@ class TranslationUpdateCommandTest extends TestCase
private function getBundle($path)
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
$bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\BundleInterface::class)->getMock();
$bundle
->expects($this->any())
->method('getPath')

View File

@ -60,7 +60,7 @@ bar';
public function testLintFileNotReadable()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$tester = $this->createCommandTester();
$filename = $this->createFile('');
unlink($filename);

View File

@ -30,7 +30,7 @@ class ApplicationTest extends TestCase
{
public function testBundleInterfaceImplementation()
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
$bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\BundleInterface::class)->getMock();
$kernel = $this->getKernel([$bundle], true);
@ -110,7 +110,7 @@ class ApplicationTest extends TestCase
*/
public function testBundleCommandsHaveRightContainer()
{
$command = $this->getMockForAbstractClass('Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand', ['foo'], '', true, true, true, ['setContainer']);
$command = $this->getMockForAbstractClass(\Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand::class, ['foo'], '', true, true, true, ['setContainer']);
$command->setCode(function () {});
$command->expects($this->exactly(2))->method('setContainer');
@ -259,10 +259,10 @@ class ApplicationTest extends TestCase
private function getKernel(array $bundles, $useDispatcher = false)
{
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
if ($useDispatcher) {
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
$dispatcher
->expects($this->atLeastOnce())
->method('dispatch')
@ -287,7 +287,7 @@ class ApplicationTest extends TestCase
->willReturnOnConsecutiveCalls([], [])
;
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
$kernel->expects($this->once())->method('boot');
$kernel
->expects($this->any())
@ -305,7 +305,7 @@ class ApplicationTest extends TestCase
private function createBundleMock(array $commands)
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
$bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\Bundle::class)->getMock();
$bundle
->expects($this->once())
->method('registerCommands')

View File

@ -68,7 +68,7 @@ class AbstractControllerTest extends ControllerTraitTest
public function testMissingParameterBag()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
$this->expectExceptionMessage('TestAbstractController::getParameter()" method is missing a parameter bag');
$container = new Container();

View File

@ -151,7 +151,7 @@ class ControllerNameParserTest extends TestCase
'FooBundle' => $this->getBundle('TestBundle\FooBundle', 'FooBundle'),
];
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel
->expects($this->any())
->method('getBundle')
@ -180,7 +180,7 @@ class ControllerNameParserTest extends TestCase
private function getBundle($namespace, $name)
{
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
$bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\BundleInterface::class)->getMock();
$bundle->expects($this->any())->method('getName')->willReturn($name);
$bundle->expects($this->any())->method('getNamespace')->willReturn($namespace);

View File

@ -32,8 +32,8 @@ class ControllerResolverTest extends ContainerControllerResolverTest
$controller = $resolver->getController($request);
$this->assertInstanceOf('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController', $controller[0]);
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $controller[0]->getContainer());
$this->assertInstanceOf(\Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::class, $controller[0]);
$this->assertInstanceOf(ContainerInterface::class, $controller[0]->getContainer());
$this->assertSame('testAction', $controller[1]);
}
@ -45,8 +45,8 @@ class ControllerResolverTest extends ContainerControllerResolverTest
$controller = $resolver->getController($request);
$this->assertInstanceOf('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController', $controller);
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $controller->getContainer());
$this->assertInstanceOf(\Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::class, $controller);
$this->assertInstanceOf(ContainerInterface::class, $controller->getContainer());
}
/**
@ -69,8 +69,8 @@ class ControllerResolverTest extends ContainerControllerResolverTest
$controller = $resolver->getController($request);
$this->assertInstanceOf('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController', $controller[0]);
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $controller[0]->getContainer());
$this->assertInstanceOf(\Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::class, $controller[0]);
$this->assertInstanceOf(ContainerInterface::class, $controller[0]->getContainer());
$this->assertSame('testAction', $controller[1]);
}
@ -200,12 +200,12 @@ class ControllerResolverTest extends ContainerControllerResolverTest
protected function createMockParser()
{
return $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser')->disableOriginalConstructor()->getMock();
return $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock();
}
protected function createMockContainer()
{
return $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
return $this->getMockBuilder(ContainerInterface::class)->getMock();
}
}

View File

@ -43,7 +43,7 @@ abstract class ControllerTraitTest extends TestCase
$requestStack = new RequestStack();
$requestStack->push($request);
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernelInterface::class)->getMock();
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
return new Response($request->getRequestFormat().'--'.$request->getLocale());
});
@ -90,7 +90,7 @@ abstract class ControllerTraitTest extends TestCase
public function testGetUserWithEmptyContainer()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('The SecurityBundle is not registered in your application.');
$controller = $this->createController();
$controller->setContainer(new Container());
@ -100,7 +100,7 @@ abstract class ControllerTraitTest extends TestCase
private function getContainerWithTokenStorage($token = null): Container
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::class)->getMock();
$tokenStorage
->expects($this->once())
->method('getToken')
@ -169,7 +169,7 @@ abstract class ControllerTraitTest extends TestCase
public function testFile()
{
$container = new Container();
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernelInterface::class)->getMock();
$container->set('http_kernel', $kernel);
$controller = $this->createController();
@ -270,7 +270,7 @@ abstract class ControllerTraitTest extends TestCase
public function testFileWhichDoesNotExist()
{
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
$this->expectException(\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException::class);
$controller = $this->createController();
$controller->file('some-file.txt', 'test.php');
@ -278,7 +278,7 @@ abstract class ControllerTraitTest extends TestCase
public function testIsGranted()
{
$authorizationChecker = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface')->getMock();
$authorizationChecker = $this->getMockBuilder(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class)->getMock();
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(true);
$container = new Container();
@ -292,8 +292,8 @@ abstract class ControllerTraitTest extends TestCase
public function testdenyAccessUnlessGranted()
{
$this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
$authorizationChecker = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface')->getMock();
$this->expectException(\Symfony\Component\Security\Core\Exception\AccessDeniedException::class);
$authorizationChecker = $this->getMockBuilder(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class)->getMock();
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(false);
$container = new Container();
@ -307,7 +307,7 @@ abstract class ControllerTraitTest extends TestCase
public function testRenderViewTwig()
{
$twig = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
$twig = $this->getMockBuilder(\Twig\Environment::class)->disableOriginalConstructor()->getMock();
$twig->expects($this->once())->method('render')->willReturn('bar');
$container = new Container();
@ -321,7 +321,7 @@ abstract class ControllerTraitTest extends TestCase
public function testRenderTwig()
{
$twig = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
$twig = $this->getMockBuilder(\Twig\Environment::class)->disableOriginalConstructor()->getMock();
$twig->expects($this->once())->method('render')->willReturn('bar');
$container = new Container();
@ -335,7 +335,7 @@ abstract class ControllerTraitTest extends TestCase
public function testStreamTwig()
{
$twig = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
$twig = $this->getMockBuilder(\Twig\Environment::class)->disableOriginalConstructor()->getMock();
$container = new Container();
$container->set('twig', $twig);
@ -343,12 +343,12 @@ abstract class ControllerTraitTest extends TestCase
$controller = $this->createController();
$controller->setContainer($container);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $controller->stream('foo'));
$this->assertInstanceOf(\Symfony\Component\HttpFoundation\StreamedResponse::class, $controller->stream('foo'));
}
public function testRedirectToRoute()
{
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
$router = $this->getMockBuilder(\Symfony\Component\Routing\RouterInterface::class)->getMock();
$router->expects($this->once())->method('generate')->willReturn('/foo');
$container = new Container();
@ -358,7 +358,7 @@ abstract class ControllerTraitTest extends TestCase
$controller->setContainer($container);
$response = $controller->redirectToRoute('foo');
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response);
$this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $response);
$this->assertSame('/foo', $response->getTargetUrl());
$this->assertSame(302, $response->getStatusCode());
}
@ -369,7 +369,7 @@ abstract class ControllerTraitTest extends TestCase
public function testAddFlash()
{
$flashBag = new FlashBag();
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock();
$session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\Session::class)->getMock();
$session->expects($this->once())->method('getFlashBag')->willReturn($flashBag);
$container = new Container();
@ -386,12 +386,12 @@ abstract class ControllerTraitTest extends TestCase
{
$controller = $this->createController();
$this->assertInstanceOf('Symfony\Component\Security\Core\Exception\AccessDeniedException', $controller->createAccessDeniedException());
$this->assertInstanceOf(\Symfony\Component\Security\Core\Exception\AccessDeniedException::class, $controller->createAccessDeniedException());
}
public function testIsCsrfTokenValid()
{
$tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
$tokenManager = $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock();
$tokenManager->expects($this->once())->method('isTokenValid')->willReturn(true);
$container = new Container();
@ -405,7 +405,7 @@ abstract class ControllerTraitTest extends TestCase
public function testGenerateUrl()
{
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
$router = $this->getMockBuilder(\Symfony\Component\Routing\RouterInterface::class)->getMock();
$router->expects($this->once())->method('generate')->willReturn('/foo');
$container = new Container();
@ -422,7 +422,7 @@ abstract class ControllerTraitTest extends TestCase
$controller = $this->createController();
$response = $controller->redirect('https://dunglas.fr', 301);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response);
$this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $response);
$this->assertSame('https://dunglas.fr', $response->getTargetUrl());
$this->assertSame(301, $response->getStatusCode());
}
@ -432,7 +432,7 @@ abstract class ControllerTraitTest extends TestCase
*/
public function testRenderViewTemplating()
{
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
$templating = $this->getMockBuilder(\Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::class)->getMock();
$templating->expects($this->once())->method('render')->willReturn('bar');
$container = new Container();
@ -449,7 +449,7 @@ abstract class ControllerTraitTest extends TestCase
*/
public function testRenderTemplating()
{
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
$templating = $this->getMockBuilder(\Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::class)->getMock();
$templating->expects($this->once())->method('render')->willReturn('bar');
$container = new Container();
@ -466,7 +466,7 @@ abstract class ControllerTraitTest extends TestCase
*/
public function testStreamTemplating()
{
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
$templating = $this->getMockBuilder(\Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::class)->getMock();
$container = new Container();
$container->set('templating', $templating);
@ -474,21 +474,21 @@ abstract class ControllerTraitTest extends TestCase
$controller = $this->createController();
$controller->setContainer($container);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $controller->stream('foo'));
$this->assertInstanceOf(\Symfony\Component\HttpFoundation\StreamedResponse::class, $controller->stream('foo'));
}
public function testCreateNotFoundException()
{
$controller = $this->createController();
$this->assertInstanceOf('Symfony\Component\HttpKernel\Exception\NotFoundHttpException', $controller->createNotFoundException());
$this->assertInstanceOf(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class, $controller->createNotFoundException());
}
public function testCreateForm()
{
$form = new Form($this->getMockBuilder(FormConfigInterface::class)->getMock());
$formFactory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$formFactory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
$formFactory->expects($this->once())->method('create')->willReturn($form);
$container = new Container();
@ -502,9 +502,9 @@ abstract class ControllerTraitTest extends TestCase
public function testCreateFormBuilder()
{
$formBuilder = $this->getMockBuilder('Symfony\Component\Form\FormBuilderInterface')->getMock();
$formBuilder = $this->getMockBuilder(\Symfony\Component\Form\FormBuilderInterface::class)->getMock();
$formFactory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$formFactory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
$formFactory->expects($this->once())->method('createBuilder')->willReturn($formBuilder);
$container = new Container();

View File

@ -22,7 +22,7 @@ class TemplateControllerTest extends TestCase
{
public function testTwig()
{
$twig = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
$twig = $this->getMockBuilder(\Twig\Environment::class)->disableOriginalConstructor()->getMock();
$twig->expects($this->exactly(2))->method('render')->willReturn('bar');
$controller = new TemplateController($twig);
@ -47,7 +47,7 @@ class TemplateControllerTest extends TestCase
public function testNoTwigNorTemplating()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
$controller = new TemplateController();

View File

@ -113,7 +113,7 @@ class CachePoolPassTest extends TestCase
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid "cache.pool" tag for service "app.cache_pool": accepted attributes are');
$container = new ContainerBuilder();
$container->setParameter('kernel.container_class', 'app');

View File

@ -61,7 +61,7 @@ class CachePoolPrunerPassTest extends TestCase
public function testCompilerPassThrowsOnInvalidDefinitionClass()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Class "Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\NotFound" used for service "pool.not-found" cannot be found.');
$container = new ContainerBuilder();
$container->register('console.command.cache_pool_prune')->addArgument([]);

View File

@ -27,7 +27,7 @@ class ProfilerPassTest extends TestCase
*/
public function testTemplateNoIdThrowsException()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$builder = new ContainerBuilder();
$builder->register('profiler', 'ProfilerClass');
$builder->register('my_collector_service')

View File

@ -54,7 +54,7 @@ class WorkflowGuardListenerPassTest extends TestCase
public function testExceptionIfTheTokenStorageServiceIsNotPresent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
$this->expectExceptionMessage('The "security.token_storage" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
@ -66,7 +66,7 @@ class WorkflowGuardListenerPassTest extends TestCase
public function testExceptionIfTheAuthorizationCheckerServiceIsNotPresent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
$this->expectExceptionMessage('The "security.authorization_checker" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.token_storage', TokenStorageInterface::class);
@ -78,7 +78,7 @@ class WorkflowGuardListenerPassTest extends TestCase
public function testExceptionIfTheAuthenticationTrustResolverServiceIsNotPresent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
$this->expectExceptionMessage('The "security.authentication.trust_resolver" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.token_storage', TokenStorageInterface::class);
@ -90,7 +90,7 @@ class WorkflowGuardListenerPassTest extends TestCase
public function testExceptionIfTheRoleHierarchyServiceIsNotPresent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
$this->expectExceptionMessage('The "security.role_hierarchy" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.token_storage', TokenStorageInterface::class);

View File

@ -66,7 +66,7 @@ class ConfigurationTest extends TestCase
*/
public function testInvalidSessionName($sessionName)
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(InvalidConfigurationException::class);
$processor = new Processor();
$processor->processConfiguration(
new Configuration(true),

View File

@ -127,7 +127,7 @@ abstract class FrameworkExtensionTest extends TestCase
public function testCsrfProtectionNeedsSessionToBeEnabled()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('CSRF protection needs sessions to be enabled.');
$this->createContainerFromFile('csrf_needs_session');
}
@ -167,7 +167,7 @@ abstract class FrameworkExtensionTest extends TestCase
*/
public function testAmbiguousWhenBothTemplatingAndFragments()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->createContainerFromFile('template_and_fragments');
}
@ -331,28 +331,28 @@ abstract class FrameworkExtensionTest extends TestCase
public function testWorkflowAreValidated()
{
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
$this->expectExceptionMessage('A transition from a place/state must have an unique name. Multiple transitions named "go" from place/state "first" were found on StateMachine "my_workflow".');
$this->createContainerFromFile('workflow_not_valid');
}
public function testWorkflowCannotHaveBothTypeAndService()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('"type" and "service" cannot be used together.');
$this->createContainerFromFile('workflow_legacy_with_type_and_service');
}
public function testWorkflowCannotHaveBothSupportsAndSupportStrategy()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('"supports" and "support_strategy" cannot be used together.');
$this->createContainerFromFile('workflow_with_support_and_support_strategy');
}
public function testWorkflowShouldHaveOneOfSupportsAndSupportStrategy()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('"supports" or "support_strategy" should be configured.');
$this->createContainerFromFile('workflow_without_support_and_support_strategy');
}
@ -362,7 +362,7 @@ abstract class FrameworkExtensionTest extends TestCase
*/
public function testWorkflowCannotHaveBothArgumentsAndService()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('"arguments" and "service" cannot be used together.');
$this->createContainerFromFile('workflow_legacy_with_arguments_and_service');
}
@ -524,7 +524,7 @@ abstract class FrameworkExtensionTest extends TestCase
public function testRouterRequiresResourceOption()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$container = $this->createContainer();
$loader = new FrameworkExtension();
$loader->load([['router' => true]], $container);
@ -815,14 +815,14 @@ abstract class FrameworkExtensionTest extends TestCase
public function testMessengerMiddlewareFactoryErroneousFormat()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid middleware at path "framework.messenger": a map with a single factory id as key and its arguments as value was expected, {"foo":["qux"],"bar":["baz"]} given.');
$this->createContainerFromFile('messenger_middleware_factory_erroneous_format');
}
public function testMessengerInvalidTransportRouting()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Invalid Messenger routing configuration: the "Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage" class is being routed to a sender called "invalid". This is not a valid transport or service id.');
$this->createContainerFromFile('messenger_routing_invalid_transport');
}
@ -838,19 +838,19 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertSame($container->getParameter('kernel.cache_dir').'/translations', $options['cache_dir']);
$files = array_map('realpath', $options['resource_files']['en']);
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
$ref = new \ReflectionClass(\Symfony\Component\Validator\Validation::class);
$this->assertContains(
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
$files,
'->registerTranslatorConfiguration() finds Validator translation resources'
);
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
$ref = new \ReflectionClass(\Symfony\Component\Form\Form::class);
$this->assertContains(
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
$files,
'->registerTranslatorConfiguration() finds Form translation resources'
);
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
$ref = new \ReflectionClass(\Symfony\Component\Security\Core\Security::class);
$this->assertContains(
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', \DIRECTORY_SEPARATOR),
$files,
@ -921,7 +921,7 @@ abstract class FrameworkExtensionTest extends TestCase
*/
public function testTemplatingRequiresAtLeastOneEngine()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$container = $this->createContainer();
$loader = new FrameworkExtension();
$loader->load([['templating' => null]], $container);
@ -932,7 +932,7 @@ abstract class FrameworkExtensionTest extends TestCase
$container = $this->createContainerFromFile('full');
$projectDir = $container->getParameter('kernel.project_dir');
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
$ref = new \ReflectionClass(\Symfony\Component\Form\Form::class);
$xmlMappings = [
\dirname($ref->getFileName()).'/Resources/config/validation.xml',
strtr($projectDir.'/config/validator/foo.xml', '/', \DIRECTORY_SEPARATOR),
@ -969,7 +969,7 @@ abstract class FrameworkExtensionTest extends TestCase
{
$container = $this->createContainerFromFile('validation_annotations', ['kernel.charset' => 'UTF-8'], false);
$this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator'));
$this->assertInstanceOf(\Symfony\Component\Validator\Validator\ValidatorInterface::class, $container->get('validator'));
}
public function testAnnotations()
@ -1097,7 +1097,7 @@ abstract class FrameworkExtensionTest extends TestCase
*/
public function testCannotConfigureStrictEmailAndEmailValidationModeAtTheSameTime()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('"strict_email" and "email_validation_mode" cannot be used together.');
$this->createContainerFromFile('validation_strict_email_and_validation_mode');
}

View File

@ -25,7 +25,7 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
public function testAssetsCannotHavePathAndUrl()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->createContainerFromClosure(function ($container) {
$container->loadFromExtension('framework', [
'assets' => [
@ -38,7 +38,7 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
public function testAssetPackageCannotHavePathAndUrl()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->createContainerFromClosure(function ($container) {
$container->loadFromExtension('framework', [
'assets' => [
@ -55,7 +55,7 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
public function testWorkflowValidationStateMachine()
{
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
$this->expectExceptionMessage('A transition from a place/state must have an unique name. Multiple transitions named "a_to_b" from place/state "a" were found on StateMachine "article".');
$this->createContainerFromClosure(function ($container) {
$container->loadFromExtension('framework', [
@ -157,7 +157,7 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
*/
public function testWorkflowValidationSingleState()
{
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
$this->expectExceptionMessage('The marking store of workflow "article" can not store many places. But the transition "a_to_b" has too many output (2). Only one is accepted.');
$this->createContainerFromClosure(function ($container) {
$container->loadFromExtension('framework', [

View File

@ -67,7 +67,7 @@ class CachePoolClearCommandTest extends AbstractWebTestCase
public function testClearUnexistingPool()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
$this->expectExceptionMessage('You have requested a non-existent service "unknown_pool"');
$this->createCommandTester()
->execute(['pools' => ['unknown_pool']], ['decorated' => false]);

View File

@ -63,7 +63,7 @@ class RouterDebugCommandTest extends AbstractWebTestCase
public function testSearchWithThrow()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The route "gerard" does not exist.');
$tester = $this->createCommandTester();
$tester->execute(['name' => 'gerard'], ['interactive' => true]);

View File

@ -29,7 +29,7 @@ class MicroKernelTraitTest extends TestCase
$this->assertEquals('halloween', $response->getContent());
$this->assertEquals('Have a great day!', $kernel->getContainer()->getParameter('halloween'));
$this->assertInstanceOf('stdClass', $kernel->getContainer()->get('halloween'));
$this->assertInstanceOf(\stdClass::class, $kernel->getContainer()->get('halloween'));
}
public function testAsEventSubscriber()

View File

@ -25,7 +25,7 @@ class RouterTest extends TestCase
{
public function testConstructThrowsOnNonSymfonyNorPsr11Container()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('You should either pass a "Symfony\Component\DependencyInjection\ContainerInterface" instance or provide the $parameters argument of the "Symfony\Bundle\FrameworkBundle\Routing\Router::__construct" method');
new Router($this->createMock(ContainerInterface::class), 'foo');
}
@ -293,7 +293,7 @@ class RouterTest extends TestCase
public function testEnvPlaceholders()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Using "%env(FOO)%" is not allowed in routing configuration.');
$routes = new RouteCollection();
@ -305,7 +305,7 @@ class RouterTest extends TestCase
public function testEnvPlaceholdersWithSfContainer()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Using "%env(FOO)%" is not allowed in routing configuration.');
$routes = new RouteCollection();
@ -375,7 +375,7 @@ class RouterTest extends TestCase
public function testExceptionOnNonExistentParameterWithSfContainer()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException');
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException::class);
$this->expectExceptionMessage('You have requested a non-existent parameter "nope".');
$routes = new RouteCollection();
@ -389,7 +389,7 @@ class RouterTest extends TestCase
public function testExceptionOnNonStringParameter()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type "object".');
$routes = new RouteCollection();
@ -404,7 +404,7 @@ class RouterTest extends TestCase
public function testExceptionOnNonStringParameterWithSfContainer()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type "object".');
$routes = new RouteCollection();
@ -504,7 +504,7 @@ class RouterTest extends TestCase
private function getServiceContainer(RouteCollection $routes): Container
{
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(LoaderInterface::class)->getMock();
$loader
->expects($this->any())
@ -512,7 +512,7 @@ class RouterTest extends TestCase
->willReturn($routes)
;
$sc = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')->setMethods(['get'])->getMock();
$sc = $this->getMockBuilder(Container::class)->setMethods(['get'])->getMock();
$sc
->expects($this->once())

View File

@ -49,7 +49,7 @@ class DelegatingEngineTest extends TestCase
public function testGetInvalidEngine()
{
$this->expectException('RuntimeException');
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('No engine is able to work with the template "template.php"');
$firstEngine = $this->getEngineMock('template.php', false);
$secondEngine = $this->getEngineMock('template.php', false);
@ -83,12 +83,12 @@ class DelegatingEngineTest extends TestCase
$container = $this->getContainerMock(['engine' => $engine]);
$delegatingEngine = new DelegatingEngine($container, ['engine']);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $delegatingEngine->renderResponse('template.php', ['foo' => 'bar']));
$this->assertInstanceOf(Response::class, $delegatingEngine->renderResponse('template.php', ['foo' => 'bar']));
}
private function getEngineMock($template, $supports)
{
$engine = $this->getMockBuilder('Symfony\Component\Templating\EngineInterface')->getMock();
$engine = $this->getMockBuilder(\Symfony\Component\Templating\EngineInterface::class)->getMock();
$engine->expects($this->once())
->method('supports')
@ -100,7 +100,7 @@ class DelegatingEngineTest extends TestCase
private function getFrameworkEngineMock($template, $supports)
{
$engine = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
$engine = $this->getMockBuilder(\Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::class)->getMock();
$engine->expects($this->once())
->method('supports')

View File

@ -36,14 +36,14 @@ class GlobalVariablesTest extends TestCase
public function testGetTokenNoToken()
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->container->set('security.token_storage', $tokenStorage);
$this->assertNull($this->globals->getToken());
}
public function testGetToken()
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->container->set('security.token_storage', $tokenStorage);
@ -62,7 +62,7 @@ class GlobalVariablesTest extends TestCase
public function testGetUserNoToken()
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$this->container->set('security.token_storage', $tokenStorage);
$this->assertNull($this->globals->getUser());
}
@ -72,8 +72,8 @@ class GlobalVariablesTest extends TestCase
*/
public function testGetUser($user, $expectedUser)
{
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
$tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$this->container->set('security.token_storage', $tokenStorage);
@ -92,9 +92,9 @@ class GlobalVariablesTest extends TestCase
public function getUserProvider()
{
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$std = new \stdClass();
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
return [
[$user, $user],

View File

@ -36,7 +36,7 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
{
// should be moved to the Form component once absolute file paths are supported
// by the default name parser in the Templating component
$reflClass = new \ReflectionClass('Symfony\Bundle\FrameworkBundle\FrameworkBundle');
$reflClass = new \ReflectionClass(\Symfony\Bundle\FrameworkBundle\FrameworkBundle::class);
$root = realpath(\dirname($reflClass->getFileName()).'/Resources/views');
$rootTheme = realpath(__DIR__.'/Resources');
$templateNameParser = new StubTemplateNameParser($root, $rootTheme);

View File

@ -80,7 +80,7 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
{
// should be moved to the Form component once absolute file paths are supported
// by the default name parser in the Templating component
$reflClass = new \ReflectionClass('Symfony\Bundle\FrameworkBundle\FrameworkBundle');
$reflClass = new \ReflectionClass(\Symfony\Bundle\FrameworkBundle\FrameworkBundle::class);
$root = realpath(\dirname($reflClass->getFileName()).'/Resources/views');
$rootTheme = realpath(__DIR__.'/Resources');
$templateNameParser = new StubTemplateNameParser($root, $rootTheme);

View File

@ -21,7 +21,7 @@ class StopwatchHelperTest extends TestCase
{
public function testDevEnvironment()
{
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
$stopwatch = $this->getMockBuilder(\Symfony\Component\Stopwatch\Stopwatch::class)->getMock();
$stopwatch->expects($this->once())
->method('start')
->with('foo');

View File

@ -82,7 +82,7 @@ class TemplateLocatorTest extends TestCase
public function testThrowsAnExceptionWhenTemplateIsNotATemplateReferenceInterface()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$locator = new TemplateLocator($this->getFileLocator());
$locator->locate('template');
}
@ -90,7 +90,7 @@ class TemplateLocatorTest extends TestCase
protected function getFileLocator()
{
return $this
->getMockBuilder('Symfony\Component\Config\FileLocator')
->getMockBuilder(\Symfony\Component\Config\FileLocator::class)
->setMethods(['locate'])
->setConstructorArgs(['/path/to/fallback'])
->getMock()

View File

@ -29,7 +29,7 @@ class PhpEngineTest extends TestCase
public function testEvaluateAddsAppGlobal()
{
$container = $this->getContainer();
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
$loader = $this->getMockForAbstractClass(\Symfony\Component\Templating\Loader\Loader::class);
$engine = new PhpEngine(new TemplateNameParser(), $container, $loader, $app = new GlobalVariables($container));
$globals = $engine->getGlobals();
$this->assertSame($app, $globals['app']);
@ -38,7 +38,7 @@ class PhpEngineTest extends TestCase
public function testEvaluateWithoutAvailableRequest()
{
$container = new Container();
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
$loader = $this->getMockForAbstractClass(\Symfony\Component\Templating\Loader\Loader::class);
$engine = new PhpEngine(new TemplateNameParser(), $container, $loader, new GlobalVariables($container));
$this->assertFalse($container->has('request_stack'));
@ -48,9 +48,9 @@ class PhpEngineTest extends TestCase
public function testGetInvalidHelper()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$container = $this->getContainer();
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
$loader = $this->getMockForAbstractClass(\Symfony\Component\Templating\Loader\Loader::class);
$engine = new PhpEngine(new TemplateNameParser(), $container, $loader);
$engine->get('non-existing-helper');

View File

@ -25,7 +25,7 @@ class TemplateNameParserTest extends TestCase
protected function setUp(): void
{
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel
->expects($this->any())
->method('getBundle')
@ -79,7 +79,7 @@ class TemplateNameParserTest extends TestCase
public function testParseValidNameWithNotFoundBundle()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->parser->parse('BarBundle:Post:index.html.php');
}
}

View File

@ -49,13 +49,13 @@ class TimedPhpEngineTest extends TestCase
private function getContainer(): Container
{
return $this->getMockBuilder('Symfony\Component\DependencyInjection\Container')->getMock();
return $this->getMockBuilder(Container::class)->getMock();
}
private function getTemplateNameParser(): TemplateNameParserInterface
{
$templateReference = $this->getMockBuilder('Symfony\Component\Templating\TemplateReferenceInterface')->getMock();
$templateNameParser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$templateReference = $this->getMockBuilder(\Symfony\Component\Templating\TemplateReferenceInterface::class)->getMock();
$templateNameParser = $this->getMockBuilder(TemplateNameParserInterface::class)->getMock();
$templateNameParser->expects($this->any())
->method('parse')
->willReturn($templateReference);
@ -65,14 +65,14 @@ class TimedPhpEngineTest extends TestCase
private function getGlobalVariables(): GlobalVariables
{
return $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables')
return $this->getMockBuilder(GlobalVariables::class)
->disableOriginalConstructor()
->getMock();
}
private function getStorage(): StringStorage
{
return $this->getMockBuilder('Symfony\Component\Templating\Storage\StringStorage')
return $this->getMockBuilder(StringStorage::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
}
@ -82,7 +82,7 @@ class TimedPhpEngineTest extends TestCase
*/
private function getLoader($storage): Loader
{
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
$loader = $this->getMockForAbstractClass(Loader::class);
$loader->expects($this->once())
->method('load')
->willReturn($storage);
@ -92,13 +92,13 @@ class TimedPhpEngineTest extends TestCase
private function getStopwatchEvent(): StopwatchEvent
{
return $this->getMockBuilder('Symfony\Component\Stopwatch\StopwatchEvent')
return $this->getMockBuilder(StopwatchEvent::class)
->disableOriginalConstructor()
->getMock();
}
private function getStopwatch(): Stopwatch
{
return $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
return $this->getMockBuilder(Stopwatch::class)->getMock();
}
}

View File

@ -94,7 +94,7 @@ class TranslatorTest extends TestCase
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
// do it another time as the cache is primed now
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Loader\LoaderInterface::class)->getMock();
$loader->expects($this->never())->method('load');
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir]);
@ -124,7 +124,7 @@ class TranslatorTest extends TestCase
$this->assertEquals('other choice 1 (PT-BR)', $translator->transChoice('other choice', 1));
// do it another time as the cache is primed now
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Loader\LoaderInterface::class)->getMock();
$loader->expects($this->never())->method('load');
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir]);
@ -137,9 +137,9 @@ class TranslatorTest extends TestCase
public function testTransWithCachingWithInvalidLocale()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid "invalid locale" locale.');
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Loader\LoaderInterface::class)->getMock();
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir], 'loader', TranslatorWithInvalidLocale::class);
$translator->trans('foo');
@ -170,9 +170,9 @@ class TranslatorTest extends TestCase
public function testInvalidOptions()
{
$this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$this->expectException(\Symfony\Component\Translation\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The Translator does not support the following options: \'foo\'');
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
(new Translator($container, new MessageFormatter(), 'en', [], ['foo' => 'bar']));
}
@ -182,7 +182,7 @@ class TranslatorTest extends TestCase
{
$someCatalogue = $this->getCatalogue('some_locale', []);
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Loader\LoaderInterface::class)->getMock();
$loader->expects($this->exactly(2))
->method('load')
@ -300,7 +300,7 @@ class TranslatorTest extends TestCase
protected function getLoader()
{
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Loader\LoaderInterface::class)->getMock();
$loader
->expects($this->exactly(7))
->method('load')
@ -336,7 +336,7 @@ class TranslatorTest extends TestCase
protected function getContainer($loader)
{
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
$container
->expects($this->any())
->method('get')
@ -377,7 +377,7 @@ class TranslatorTest extends TestCase
$translator->setFallbackLocales(['fr']);
$translator->warmup($this->tmpDir);
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader = $this->getMockBuilder(\Symfony\Component\Translation\Loader\LoaderInterface::class)->getMock();
$loader
->expects($this->never())
->method('load');

View File

@ -115,7 +115,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
$loader->load('security_debug.xml');
}
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
$container->removeDefinition('security.expression_language');
$container->removeDefinition('security.access.expression_voter');
}
@ -707,7 +707,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
return $this->expressions[$id];
}
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
}

View File

@ -24,7 +24,7 @@ class AddSecurityVotersPassTest extends TestCase
{
public function testNoVoters()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->expectException(LogicException::class);
$this->expectExceptionMessage('No security voters found. You need to tag at least one with "security.voter".');
$container = new ContainerBuilder();
$container

View File

@ -610,7 +610,7 @@ abstract class CompleteConfigurationTest extends TestCase
public function testAccessDecisionManagerServiceAndStrategyCannotBeUsedAtTheSameTime()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.');
$this->getContainer('access_decision_manager_service_and_strategy');
}
@ -628,14 +628,14 @@ abstract class CompleteConfigurationTest extends TestCase
public function testFirewallUndefinedUserProvider()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
$this->getContainer('firewall_undefined_provider');
}
public function testFirewallListenerUndefinedProvider()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
$this->getContainer('listener_undefined_provider');
}

View File

@ -34,7 +34,7 @@ class MainConfigurationTest extends TestCase
public function testNoConfigForProvider()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$config = [
'providers' => [
'stub' => [],
@ -48,7 +48,7 @@ class MainConfigurationTest extends TestCase
public function testManyConfigForProvider()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$config = [
'providers' => [
'stub' => [

View File

@ -127,7 +127,7 @@ class AbstractFactoryTest extends TestCase
protected function callFactory($id, $config, $userProviderId, $defaultEntryPointId)
{
$factory = $this->getMockForAbstractClass('Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory', []);
$factory = $this->getMockForAbstractClass(\Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory::class, []);
$factory
->expects($this->once())

View File

@ -41,7 +41,7 @@ class GuardAuthenticationFactoryTest extends TestCase
*/
public function testAddInvalidConfiguration(array $inputConfig)
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$factory = new GuardAuthenticationFactory();
$nodeDefinition = new ArrayNodeDefinition('guard');
$factory->addConfiguration($nodeDefinition);
@ -132,7 +132,7 @@ class GuardAuthenticationFactoryTest extends TestCase
public function testCannotOverrideDefaultEntryPoint()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
// any existing default entry point is used
$config = [
'authenticators' => ['authenticator123'],
@ -143,7 +143,7 @@ class GuardAuthenticationFactoryTest extends TestCase
public function testMultipleAuthenticatorsRequiresEntryPoint()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
// any existing default entry point is used
$config = [
'authenticators' => ['authenticator123', 'authenticatorABC'],

View File

@ -26,7 +26,7 @@ class SecurityExtensionTest extends TestCase
{
public function testInvalidCheckPath()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('The check_path "/some_area/login_check" for login method "form_login" is not matched by the firewall pattern "/secured_area/.*".');
$container = $this->getRawContainer();
@ -50,7 +50,7 @@ class SecurityExtensionTest extends TestCase
public function testFirewallWithoutAuthenticationListener()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('No authentication listener registered for firewall "some_firewall"');
$container = $this->getRawContainer();
@ -71,7 +71,7 @@ class SecurityExtensionTest extends TestCase
public function testFirewallWithInvalidUserProvider()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('Unable to create definition for "security.user.provider.concrete.my_foo" user provider');
$container = $this->getRawContainer();
@ -190,7 +190,7 @@ class SecurityExtensionTest extends TestCase
public function testMissingProviderForListener()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
$this->expectExceptionMessage('Not configuring explicitly the provider for the "http_basic" listener on "ambiguous" firewall is ambiguous as there is more than one registered provider.');
$container = $this->getRawContainer();
$container->loadFromExtension('security', [

Some files were not shown because too many files have changed in this diff Show More