Skip to content

Commit ca03f69

Browse files
committed
Use ::class keyword when possible
1 parent fdf759d commit ca03f69

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function testPropertyAccessCacheWithDebug()
137137

138138
public function testCsrfProtectionNeedsSessionToBeEnabled()
139139
{
140-
$this->expectException('LogicException');
140+
$this->expectException(\LogicException::class);
141141
$this->expectExceptionMessage('CSRF protection needs sessions to be enabled.');
142142
$this->createContainerFromFile('csrf_needs_session');
143143
}
@@ -317,21 +317,21 @@ public function testWorkflows()
317317

318318
public function testWorkflowAreValidated()
319319
{
320-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
320+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
321321
$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".');
322322
$this->createContainerFromFile('workflow_not_valid');
323323
}
324324

325325
public function testWorkflowCannotHaveBothSupportsAndSupportStrategy()
326326
{
327-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
327+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
328328
$this->expectExceptionMessage('"supports" and "support_strategy" cannot be used together.');
329329
$this->createContainerFromFile('workflow_with_support_and_support_strategy');
330330
}
331331

332332
public function testWorkflowShouldHaveOneOfSupportsAndSupportStrategy()
333333
{
334-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
334+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
335335
$this->expectExceptionMessage('"supports" or "support_strategy" should be configured.');
336336
$this->createContainerFromFile('workflow_without_support_and_support_strategy');
337337
}
@@ -513,7 +513,7 @@ public function testRouter()
513513

514514
public function testRouterRequiresResourceOption()
515515
{
516-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
516+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
517517
$container = $this->createContainer();
518518
$loader = new FrameworkExtension();
519519
$loader->load([['router' => true]], $container);
@@ -774,14 +774,14 @@ public function testMessengerWithMultipleBuses()
774774

775775
public function testMessengerMiddlewareFactoryErroneousFormat()
776776
{
777-
$this->expectException('InvalidArgumentException');
777+
$this->expectException(\InvalidArgumentException::class);
778778
$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.');
779779
$this->createContainerFromFile('messenger_middleware_factory_erroneous_format');
780780
}
781781

782782
public function testMessengerInvalidTransportRouting()
783783
{
784-
$this->expectException('LogicException');
784+
$this->expectException(\LogicException::class);
785785
$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.');
786786
$this->createContainerFromFile('messenger_routing_invalid_transport');
787787
}
@@ -797,19 +797,19 @@ public function testTranslator()
797797
$this->assertSame($container->getParameter('kernel.cache_dir').'/translations', $options['cache_dir']);
798798

799799
$files = array_map('realpath', $options['resource_files']['en']);
800-
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
800+
$ref = new \ReflectionClass(\Symfony\Component\Validator\Validation::class);
801801
$this->assertContains(
802802
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
803803
$files,
804804
'->registerTranslatorConfiguration() finds Validator translation resources'
805805
);
806-
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
806+
$ref = new \ReflectionClass(\Symfony\Component\Form\Form::class);
807807
$this->assertContains(
808808
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
809809
$files,
810810
'->registerTranslatorConfiguration() finds Form translation resources'
811811
);
812-
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
812+
$ref = new \ReflectionClass(\Symfony\Component\Security\Core\Security::class);
813813
$this->assertContains(
814814
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', \DIRECTORY_SEPARATOR),
815815
$files,
@@ -866,7 +866,7 @@ public function testValidation()
866866
$container = $this->createContainerFromFile('full');
867867
$projectDir = $container->getParameter('kernel.project_dir');
868868

869-
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
869+
$ref = new \ReflectionClass(\Symfony\Component\Form\Form::class);
870870
$xmlMappings = [
871871
\dirname($ref->getFileName()).'/Resources/config/validation.xml',
872872
strtr($projectDir.'/config/validator/foo.xml', '/', \DIRECTORY_SEPARATOR),
@@ -900,7 +900,7 @@ public function testValidationService()
900900
{
901901
$container = $this->createContainerFromFile('validation_annotations', ['kernel.charset' => 'UTF-8'], false);
902902

903-
$this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator.alias'));
903+
$this->assertInstanceOf(\Symfony\Component\Validator\Validator\ValidatorInterface::class, $container->get('validator.alias'));
904904
}
905905

906906
public function testAnnotations()

0 commit comments

Comments
 (0)