');
@@ -36,7 +36,7 @@ class LinkTest extends TestCase
public function testAbsoluteBaseUriIsMandatoryWhenLinkUrlIsRelative()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$dom = new \DOMDocument();
$dom->loadHTML('
foo');
diff --git a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
index 2c216cbe7f..f896fba2da 100644
--- a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
+++ b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
@@ -231,8 +231,8 @@ class DebugClassLoader
public static function enable(): void
{
// Ensures we don't hit https://bugs.php.net/42098
- class_exists('Symfony\Component\ErrorHandler\ErrorHandler');
- class_exists('Psr\Log\LogLevel');
+ class_exists(\Symfony\Component\ErrorHandler\ErrorHandler::class);
+ class_exists(\Psr\Log\LogLevel::class);
if (!\is_array($functions = spl_autoload_functions())) {
return;
diff --git a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
index c77d3711fc..141459f72c 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
@@ -51,7 +51,7 @@ class DebugClassLoaderTest extends TestCase
$reflProp = $reflClass->getProperty('classLoader');
$reflProp->setAccessible(true);
- $this->assertNotInstanceOf('Symfony\Component\ErrorHandler\DebugClassLoader', $reflProp->getValue($function[0]));
+ $this->assertNotInstanceOf(DebugClassLoader::class, $reflProp->getValue($function[0]));
return;
}
@@ -62,7 +62,7 @@ class DebugClassLoaderTest extends TestCase
public function testThrowingClass()
{
- $this->expectException('Exception');
+ $this->expectException(\Exception::class);
$this->expectExceptionMessage('boo');
try {
class_exists(Fixtures\Throwing::class);
@@ -77,14 +77,14 @@ class DebugClassLoaderTest extends TestCase
public function testNameCaseMismatch()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Case mismatch between loaded and declared class names');
class_exists(TestingCaseMismatch::class, true);
}
public function testFileCaseMismatch()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Case mismatch between class and real file names');
if (!file_exists(__DIR__.'/Fixtures/CaseMismatch.php')) {
$this->markTestSkipped('Can only be run on case insensitive filesystems');
@@ -95,7 +95,7 @@ class DebugClassLoaderTest extends TestCase
public function testPsr4CaseMismatch()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Case mismatch between loaded and declared class names');
class_exists(__NAMESPACE__.'\Fixtures\Psr4CaseMismatch', true);
}
@@ -176,7 +176,7 @@ class DebugClassLoaderTest extends TestCase
$e = error_reporting(0);
trigger_error('', E_USER_NOTICE);
- class_exists('Symfony\Bridge\ErrorHandler\Tests\Fixtures\ExtendsDeprecatedParent', true);
+ class_exists(\Symfony\Bridge\ErrorHandler\Tests\Fixtures\ExtendsDeprecatedParent::class, true);
error_reporting($e);
restore_error_handler();
diff --git a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php
index 4239be1ed3..6ced55c069 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php
@@ -35,7 +35,7 @@ class ErrorHandlerTest extends TestCase
$handler = ErrorHandler::register();
try {
- $this->assertInstanceOf('Symfony\Component\ErrorHandler\ErrorHandler', $handler);
+ $this->assertInstanceOf(ErrorHandler::class, $handler);
$this->assertSame($handler, ErrorHandler::register());
$newHandler = new ErrorHandler();
@@ -62,7 +62,7 @@ class ErrorHandlerTest extends TestCase
public function testErrorGetLast()
{
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$handler = ErrorHandler::register();
$handler->setDefaultLogger($logger);
$handler->screamAt(\E_ALL);
@@ -194,7 +194,7 @@ class ErrorHandlerTest extends TestCase
public function testDefaultLogger()
{
try {
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$handler = ErrorHandler::register();
$handler->setDefaultLogger($logger, \E_NOTICE);
@@ -269,7 +269,7 @@ class ErrorHandlerTest extends TestCase
restore_error_handler();
restore_exception_handler();
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$warnArgCheck = function ($logLevel, $message, $context) {
$this->assertEquals('info', $logLevel);
@@ -294,7 +294,7 @@ class ErrorHandlerTest extends TestCase
restore_error_handler();
restore_exception_handler();
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$line = null;
$logArgCheck = function ($level, $message, $context) use (&$line) {
@@ -395,7 +395,7 @@ class ErrorHandlerTest extends TestCase
$this->assertSame('User Deprecated: Foo deprecation', $exception->getMessage());
};
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger
->expects($this->once())
->method('log')
@@ -413,7 +413,7 @@ class ErrorHandlerTest extends TestCase
public function testHandleException(string $expectedMessage, \Throwable $exception)
{
try {
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$handler = ErrorHandler::register();
$logArgCheck = function ($level, $message, $context) use ($expectedMessage, $exception) {
@@ -505,7 +505,7 @@ class ErrorHandlerTest extends TestCase
$bootLogger->log(LogLevel::WARNING, 'Foo message', ['exception' => $exception]);
- $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $mockLogger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$mockLogger->expects($this->once())
->method('log')
->with(LogLevel::WARNING, 'Foo message', ['exception' => $exception]);
@@ -520,7 +520,7 @@ class ErrorHandlerTest extends TestCase
$exception = new \Exception('Foo message');
- $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $mockLogger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$mockLogger->expects($this->once())
->method('log')
->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', ['exception' => $exception]);
@@ -535,7 +535,7 @@ class ErrorHandlerTest extends TestCase
public function testHandleFatalError()
{
try {
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$handler = ErrorHandler::register();
$error = [
@@ -584,7 +584,7 @@ class ErrorHandlerTest extends TestCase
public function testCustomExceptionHandler()
{
- $this->expectException('Exception');
+ $this->expectException(\Exception::class);
$handler = new ErrorHandler();
$handler->setExceptionHandler(function ($e) use ($handler) {
$handler->setExceptionHandler(null);
diff --git a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
index da28110516..bf2cebf6c0 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
@@ -28,7 +28,7 @@ class RegisterListenersPassTest extends TestCase
*/
public function testEventSubscriberWithoutInterface()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$builder = new ContainerBuilder();
$builder->register('event_dispatcher');
$builder->register('my_event_subscriber', 'stdClass')
@@ -98,7 +98,7 @@ class RegisterListenersPassTest extends TestCase
public function testAbstractEventListener()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The service "foo" tagged "kernel.event_listener" must not be abstract.');
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', []);
@@ -110,7 +110,7 @@ class RegisterListenersPassTest extends TestCase
public function testAbstractEventSubscriber()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The service "foo" tagged "kernel.event_subscriber" must not be abstract.');
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', []);
@@ -180,7 +180,7 @@ class RegisterListenersPassTest extends TestCase
public function testEventSubscriberUnresolvableClassName()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('You have requested a non-existent parameter "subscriber.class"');
$container = new ContainerBuilder();
$container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []);
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
index 6ac335199a..12cb47a866 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
@@ -33,7 +33,7 @@ class ImmutableEventDispatcherTest extends TestCase
protected function setUp(): void
{
- $this->innerDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
+ $this->innerDispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
$this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
}
@@ -79,7 +79,7 @@ class ImmutableEventDispatcherTest extends TestCase
public function testAddSubscriberDisallowed()
{
$this->expectException(\BadMethodCallException::class);
- $subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock();
+ $subscriber = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventSubscriberInterface::class)->getMock();
$this->dispatcher->addSubscriber($subscriber);
}
@@ -93,7 +93,7 @@ class ImmutableEventDispatcherTest extends TestCase
public function testRemoveSubscriberDisallowed()
{
$this->expectException(\BadMethodCallException::class);
- $subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock();
+ $subscriber = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventSubscriberInterface::class)->getMock();
$this->dispatcher->removeSubscriber($subscriber);
}
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
index d7e23cb41a..996361f58f 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
@@ -23,14 +23,14 @@ class ExpressionFunctionTest extends TestCase
{
public function testFunctionDoesNotExist()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('PHP function "fn_does_not_exist" does not exist.');
ExpressionFunction::fromPhp('fn_does_not_exist');
}
public function testFunctionNamespaced()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('An expression function name must be defined when PHP function "Symfony\Component\ExpressionLanguage\Tests\fn_namespaced" is namespaced.');
ExpressionFunction::fromPhp('Symfony\Component\ExpressionLanguage\Tests\fn_namespaced');
}
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
index bd044621fe..4311e98eef 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
@@ -21,8 +21,8 @@ class ExpressionLanguageTest extends TestCase
{
public function testCachedParse()
{
- $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock();
- $cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock();
+ $cacheMock = $this->getMockBuilder(\Psr\Cache\CacheItemPoolInterface::class)->getMock();
+ $cacheItemMock = $this->getMockBuilder(\Psr\Cache\CacheItemInterface::class)->getMock();
$savedParsedExpression = null;
$expressionLanguage = new ExpressionLanguage($cacheMock);
@@ -107,7 +107,7 @@ class ExpressionLanguageTest extends TestCase
public function testParseThrowsInsteadOfNotice()
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$this->expectExceptionMessage('Unexpected end of expression around position 6 for expression `node.`.');
$expressionLanguage = new ExpressionLanguage();
$expressionLanguage->parse('node.', ['node']);
@@ -115,7 +115,7 @@ class ExpressionLanguageTest extends TestCase
public function shortCircuitProviderEvaluate()
{
- $object = $this->getMockBuilder('stdClass')->setMethods(['foo'])->getMock();
+ $object = $this->getMockBuilder(\stdClass::class)->setMethods(['foo'])->getMock();
$object->expects($this->never())->method('foo');
return [
@@ -155,8 +155,8 @@ class ExpressionLanguageTest extends TestCase
public function testCachingWithDifferentNamesOrder()
{
- $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock();
- $cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock();
+ $cacheMock = $this->getMockBuilder(\Psr\Cache\CacheItemPoolInterface::class)->getMock();
+ $cacheItemMock = $this->getMockBuilder(\Psr\Cache\CacheItemInterface::class)->getMock();
$expressionLanguage = new ExpressionLanguage($cacheMock);
$savedParsedExpression = null;
@@ -211,7 +211,7 @@ class ExpressionLanguageTest extends TestCase
*/
public function testRegisterAfterParse($registerCallback)
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$el = new ExpressionLanguage();
$el->parse('1 + 1', []);
$registerCallback($el);
@@ -222,7 +222,7 @@ class ExpressionLanguageTest extends TestCase
*/
public function testRegisterAfterEval($registerCallback)
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$el = new ExpressionLanguage();
$el->evaluate('1 + 1');
$registerCallback($el);
@@ -230,7 +230,7 @@ class ExpressionLanguageTest extends TestCase
public function testCallBadCallable()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessageMatches('/Unable to call method "\w+" of object "\w+"./');
$el = new ExpressionLanguage();
$el->evaluate('foo.myfunction()', ['foo' => new \stdClass()]);
@@ -241,7 +241,7 @@ class ExpressionLanguageTest extends TestCase
*/
public function testRegisterAfterCompile($registerCallback)
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$el = new ExpressionLanguage();
$el->compile('1 + 1');
$registerCallback($el);
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
index 35aead6862..c909eacc25 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
@@ -39,7 +39,7 @@ class LexerTest extends TestCase
public function testTokenizeThrowsErrorWithMessage()
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$this->expectExceptionMessage('Unexpected character "\'" around position 33 for expression `service(faulty.expression.example\').dummyMethod()`.');
$expression = "service(faulty.expression.example').dummyMethod()";
$this->lexer->tokenize($expression);
@@ -47,7 +47,7 @@ class LexerTest extends TestCase
public function testTokenizeThrowsErrorOnUnclosedBrace()
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$this->expectExceptionMessage('Unclosed "(" around position 7 for expression `service(unclosed.expression.dummyMethod()`.');
$expression = 'service(unclosed.expression.dummyMethod()';
$this->lexer->tokenize($expression);
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
index 99575f9f62..ca41d3f93d 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
@@ -21,7 +21,7 @@ class ParserTest extends TestCase
{
public function testParseWithInvalidName()
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$this->expectExceptionMessage('Variable "foo" is not valid around position 1 for expression `foo`.');
$lexer = new Lexer();
$parser = new Parser([]);
@@ -30,7 +30,7 @@ class ParserTest extends TestCase
public function testParseWithZeroInNames()
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$this->expectExceptionMessage('Variable "foo" is not valid around position 1 for expression `foo`.');
$lexer = new Lexer();
$parser = new Parser([]);
@@ -198,7 +198,7 @@ class ParserTest extends TestCase
*/
public function testParseWithInvalidPostfixData($expr, $names = [])
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$lexer = new Lexer();
$parser = new Parser([]);
$parser->parse($lexer->tokenize($expr), $names);
@@ -228,7 +228,7 @@ class ParserTest extends TestCase
public function testNameProposal()
{
- $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectException(\Symfony\Component\ExpressionLanguage\SyntaxError::class);
$this->expectExceptionMessage('Did you mean "baz"?');
$lexer = new Lexer();
$parser = new Parser([]);
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index 4158f88f85..c901bdc9bd 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -33,7 +33,7 @@ class FilesystemTest extends FilesystemTestCase
public function testCopyFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
@@ -42,7 +42,7 @@ class FilesystemTest extends FilesystemTestCase
public function testCopyUnreadableFileFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
// skip test on Windows; PHP can't easily set file as unreadable on Windows
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test cannot run on Windows.');
@@ -118,7 +118,7 @@ class FilesystemTest extends FilesystemTestCase
public function testCopyWithOverrideWithReadOnlyTargetFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
// skip test on Windows; PHP can't easily set file as unwritable on Windows
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test cannot run on Windows.');
@@ -220,7 +220,7 @@ class FilesystemTest extends FilesystemTestCase
public function testMkdirCreatesDirectoriesFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
$dir = $basePath.'2';
@@ -240,7 +240,7 @@ class FilesystemTest extends FilesystemTestCase
public function testTouchFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$file = $this->workspace.\DIRECTORY_SEPARATOR.'1'.\DIRECTORY_SEPARATOR.'2';
$this->filesystem->touch($file);
@@ -396,7 +396,7 @@ class FilesystemTest extends FilesystemTestCase
public function testFilesExistsFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Long file names are an issue on Windows');
}
@@ -637,7 +637,7 @@ class FilesystemTest extends FilesystemTestCase
public function testChownSymlinkFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$this->markAsSkippedIfSymlinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -652,7 +652,7 @@ class FilesystemTest extends FilesystemTestCase
public function testChownLinkFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$this->markAsSkippedIfLinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -667,7 +667,7 @@ class FilesystemTest extends FilesystemTestCase
public function testChownFail()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$this->markAsSkippedIfPosixIsMissing();
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -770,7 +770,7 @@ class FilesystemTest extends FilesystemTestCase
public function testChgrpSymlinkFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$this->markAsSkippedIfSymlinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -785,7 +785,7 @@ class FilesystemTest extends FilesystemTestCase
public function testChgrpLinkFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$this->markAsSkippedIfLinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -800,7 +800,7 @@ class FilesystemTest extends FilesystemTestCase
public function testChgrpFail()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$this->markAsSkippedIfPosixIsMissing();
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -823,7 +823,7 @@ class FilesystemTest extends FilesystemTestCase
public function testRenameThrowsExceptionIfTargetAlreadyExists()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
@@ -849,7 +849,7 @@ class FilesystemTest extends FilesystemTestCase
public function testRenameThrowsExceptionOnError()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
@@ -1194,14 +1194,14 @@ class FilesystemTest extends FilesystemTestCase
public function testMakePathRelativeWithRelativeStartPath()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Filesystem\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The start path "var/lib/symfony/src/Symfony/Component" is not absolute.');
$this->assertSame('../../../', $this->filesystem->makePathRelative('/var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component'));
}
public function testMakePathRelativeWithRelativeEndPath()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Filesystem\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The end path "var/lib/symfony/" is not absolute.');
$this->assertSame('../../../', $this->filesystem->makePathRelative('var/lib/symfony/', '/var/lib/symfony/src/Symfony/Component'));
}
@@ -1475,7 +1475,7 @@ class FilesystemTest extends FilesystemTestCase
public function testTempnamWithZlibSchemeFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$scheme = 'compress.zlib://';
$dirname = $scheme.$this->workspace;
@@ -1498,7 +1498,7 @@ class FilesystemTest extends FilesystemTestCase
public function testTempnamWithPharSchemeFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
// Skip test if Phar disabled phar.readonly must be 0 in php.ini
if (!\Phar::canWrite()) {
$this->markTestSkipped('This test cannot run when phar.readonly is 1.');
@@ -1515,7 +1515,7 @@ class FilesystemTest extends FilesystemTestCase
public function testTempnamWithHTTPSchemeFails()
{
- $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectException(IOException::class);
$scheme = 'http://';
$dirname = $scheme.$this->workspace;
diff --git a/src/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php b/src/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php
index 2f56092ed8..8108c3a358 100644
--- a/src/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php
@@ -23,7 +23,7 @@ class ComparatorTest extends TestCase
$comparator->setOperator('foo');
$this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
} catch (\Exception $e) {
- $this->assertInstanceOf('InvalidArgumentException', $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
+ $this->assertInstanceOf(\InvalidArgumentException::class, $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
}
$comparator = new Comparator();
diff --git a/src/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php b/src/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php
index 3aebf52449..f89a1a283d 100644
--- a/src/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php
@@ -22,14 +22,14 @@ class DateComparatorTest extends TestCase
new DateComparator('foobar');
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
} catch (\Exception $e) {
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
+ $this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
}
try {
new DateComparator('');
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
} catch (\Exception $e) {
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
+ $this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
}
}
diff --git a/src/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php b/src/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php
index 5b49b660a7..6458133ebd 100644
--- a/src/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php
@@ -30,7 +30,7 @@ class NumberComparatorTest extends TestCase
new NumberComparator($f);
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
} catch (\Exception $e) {
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
+ $this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
}
}
}
diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php
index 97e8aa4a07..ebcb0bff1f 100644
--- a/src/Symfony/Component/Finder/Tests/FinderTest.php
+++ b/src/Symfony/Component/Finder/Tests/FinderTest.php
@@ -17,7 +17,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
public function testCreate()
{
- $this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
+ $this->assertInstanceOf(Finder::class, Finder::create());
}
public function testDirectories()
@@ -922,14 +922,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testInWithNonExistentDirectory()
{
- $this->expectException('Symfony\Component\Finder\Exception\DirectoryNotFoundException');
+ $this->expectException(\Symfony\Component\Finder\Exception\DirectoryNotFoundException::class);
$finder = new Finder();
$finder->in('foobar');
}
public function testInWithNonExistentDirectoryLegacyException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$finder = new Finder();
$finder->in('foobar');
}
@@ -944,7 +944,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testInWithNonDirectoryGlob()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$finder = new Finder();
$finder->in(__DIR__.'/Fixtures/A/a*');
}
@@ -963,7 +963,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testGetIteratorWithoutIn()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$finder = Finder::create();
$finder->getIterator();
}
@@ -1104,7 +1104,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testAppendReturnsAFinder()
{
- $this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', Finder::create()->append([]));
+ $this->assertInstanceOf(Finder::class, Finder::create()->append([]));
}
public function testAppendDoesNotRequireIn()
@@ -1143,7 +1143,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testCountWithoutIn()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$finder = Finder::create()->files();
\count($finder);
}
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
index 56d958cb60..4d55b112dc 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
@@ -17,7 +17,7 @@ class CustomFilterIteratorTest extends IteratorTestCase
{
public function testWithInvalidFilter()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new CustomFilterIterator(new Iterator(), ['foo']);
}
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php
index 9bfc479de5..71db60b48c 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php
@@ -68,7 +68,7 @@ abstract class IteratorTestCase extends TestCase
{
$values = [];
foreach ($iterator as $file) {
- $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
+ $this->assertInstanceOf(\Symfony\Component\Finder\SplFileInfo::class, $file);
$values[] = $file->getPathname();
}
@@ -85,7 +85,7 @@ abstract class IteratorTestCase extends TestCase
{
$values = [];
foreach ($iterator as $file) {
- $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
+ $this->assertInstanceOf(\Symfony\Component\Finder\SplFileInfo::class, $file);
$values[] = $file->getPathname();
}
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
index add8e7df59..12eacb8661 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
@@ -21,7 +21,7 @@ class SortableIteratorTest extends RealIteratorTestCase
new SortableIterator(new Iterator([]), 'foobar');
$this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid');
} catch (\Exception $e) {
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
+ $this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
}
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
index c127862e53..08658ddfb7 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
@@ -124,7 +124,7 @@ class DateType extends AbstractType
$dateFormat,
$timeFormat,
// see https://bugs.php.net/66323
- class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
+ class_exists(\IntlTimeZone::class, false) ? \IntlTimeZone::createDefault() : null,
$calendar,
$pattern
);
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
index 0afa3d4e43..391a425ddd 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
@@ -114,7 +114,7 @@ class FileType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$dataClass = null;
- if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
+ if (class_exists(\Symfony\Component\HttpFoundation\File\File::class)) {
$dataClass = function (Options $options) {
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
};
diff --git a/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php b/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
index ce3e63416e..6612c51d25 100644
--- a/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
@@ -28,7 +28,7 @@ class AbstractExtensionTest extends TestCase
public function testGetType()
{
$loader = new ConcreteExtension();
- $this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
+ $this->assertInstanceOf(FooType::class, $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
}
}
diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
index 5dc1ad2311..a893861680 100644
--- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
@@ -38,7 +38,7 @@ abstract class AbstractFormTest extends TestCase
protected function setUp(): void
{
$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->createForm();
}
@@ -58,16 +58,16 @@ abstract class AbstractFormTest extends TestCase
protected function getDataMapper(): MockObject
{
- return $this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Form\DataMapperInterface::class)->getMock();
}
protected function getDataTransformer(): MockObject
{
- return $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Form\DataTransformerInterface::class)->getMock();
}
protected function getFormValidator(): MockObject
{
- return $this->getMockBuilder('Symfony\Component\Form\FormValidatorInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Form\FormValidatorInterface::class)->getMock();
}
}
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index 4931ccb6a3..bd7107de01 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -34,7 +34,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
\Locale::setDefault('en');
- $this->csrfTokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
+ $this->csrfTokenManager = $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock();
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
index 49d7f1887b..aadba95802 100644
--- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
@@ -42,7 +42,7 @@ abstract class AbstractRequestHandlerTest extends TestCase
protected function setUp(): void
{
- $this->serverParams = $this->getMockBuilder('Symfony\Component\Form\Util\ServerParams')->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
+ $this->serverParams = $this->getMockBuilder(\Symfony\Component\Form\Util\ServerParams::class)->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
$this->requestHandler = $this->getRequestHandler();
$this->factory = Forms::createFormFactoryBuilder()->getFormFactory();
$this->request = null;
@@ -405,7 +405,7 @@ abstract class AbstractRequestHandlerTest extends TestCase
protected function createBuilder($name, $compound = false, array $options = [])
{
- $builder = new FormBuilder($name, null, new EventDispatcher(), $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(), $options);
+ $builder = new FormBuilder($name, null, new EventDispatcher(), $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock(), $options);
$builder->setCompound($compound);
if ($compound) {
diff --git a/src/Symfony/Component/Form/Tests/ButtonTest.php b/src/Symfony/Component/Form/Tests/ButtonTest.php
index a69cc10687..bd132f4519 100644
--- a/src/Symfony/Component/Form/Tests/ButtonTest.php
+++ b/src/Symfony/Component/Form/Tests/ButtonTest.php
@@ -26,13 +26,13 @@ class ButtonTest extends TestCase
protected function setUp(): void
{
- $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
- $this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
+ $this->dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
+ $this->factory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
}
public function testSetParentOnSubmittedButton()
{
- $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
+ $this->expectException(\Symfony\Component\Form\Exception\AlreadySubmittedException::class);
$button = $this->getButtonBuilder('button')
->getForm()
;
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
index c59b3840a5..8b0564d2d7 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
@@ -252,7 +252,7 @@ class DefaultChoiceListFactoryTest extends TestCase
public function testCreateFromLoader()
{
- $loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
$list = $this->factory->createListFromLoader($loader);
@@ -261,7 +261,7 @@ class DefaultChoiceListFactoryTest extends TestCase
public function testCreateFromLoaderWithValues()
{
- $loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
$value = function () {};
$list = $this->factory->createListFromLoader($loader, $value);
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
index e94261cd57..afbf357263 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
@@ -35,7 +35,7 @@ class PropertyAccessDecoratorTest extends TestCase
protected function setUp(): void
{
- $this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
+ $this->decoratedFactory = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface::class)->getMock();
$this->factory = new PropertyAccessDecorator($this->decoratedFactory);
}
@@ -110,7 +110,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateFromLoaderPropertyPath()
{
- $loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createListFromLoader')
@@ -160,7 +160,7 @@ class PropertyAccessDecoratorTest extends TestCase
// https://github.com/symfony/symfony/issues/5494
public function testCreateFromChoiceLoaderAssumeNullIfValuePropertyPathUnreadable()
{
- $loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createListFromLoader')
@@ -174,7 +174,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateFromLoaderPropertyPathInstance()
{
- $loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createListFromLoader')
@@ -188,7 +188,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewPreferredChoicesAsPropertyPath()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -202,7 +202,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewPreferredChoicesAsPropertyPathInstance()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -217,7 +217,7 @@ class PropertyAccessDecoratorTest extends TestCase
// https://github.com/symfony/symfony/issues/5494
public function testCreateViewAssumeNullIfPreferredChoicesPropertyPathUnreadable()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -231,7 +231,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewLabelsAsPropertyPath()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -245,7 +245,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewLabelsAsPropertyPathInstance()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -259,7 +259,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewIndicesAsPropertyPath()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -273,7 +273,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewIndicesAsPropertyPathInstance()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -287,7 +287,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewGroupsAsPropertyPath()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -301,7 +301,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewGroupsAsPropertyPathInstance()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -316,7 +316,7 @@ class PropertyAccessDecoratorTest extends TestCase
// https://github.com/symfony/symfony/issues/5494
public function testCreateViewAssumeNullIfGroupsPropertyPathUnreadable()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -330,7 +330,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewAttrAsPropertyPath()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
@@ -344,7 +344,7 @@ class PropertyAccessDecoratorTest extends TestCase
public function testCreateViewAttrAsPropertyPathInstance()
{
- $list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
+ $list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
$this->decoratedFactory->expects($this->once())
->method('createView')
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
index 50403931be..7d6ed23e2a 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
@@ -39,8 +39,8 @@ class LazyChoiceListTest extends TestCase
protected function setUp(): void
{
- $this->loadedList = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
- $this->loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
+ $this->loadedList = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
+ $this->loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
$this->value = function () {};
$this->list = new LazyChoiceList($this->loader, $this->value);
}
diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
index 9b3f4644c2..586a488d2d 100644
--- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
@@ -86,7 +86,7 @@ TXT
public function testDebugSingleFormTypeNotFound()
{
- $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
+ $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Could not find type "NonExistentType"');
$tester = $this->createCommandTester();
$tester->execute(['class' => 'NonExistentType'], ['decorated' => false, 'interactive' => false]);
@@ -141,7 +141,7 @@ TXT
public function testDebugInvalidFormType()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->createCommandTester()->execute(['class' => 'test']);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
index 23246c4e3d..105df0514b 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
@@ -70,7 +70,7 @@ class ArrayToPartsTransformerTest extends TestCase
public function testTransformRequiresArray()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->transform('12345');
}
@@ -123,7 +123,7 @@ class ArrayToPartsTransformerTest extends TestCase
public function testReverseTransformPartiallyNull()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$input = [
'first' => [
'a' => '1',
@@ -138,7 +138,7 @@ class ArrayToPartsTransformerTest extends TestCase
public function testReverseTransformRequiresArray()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->reverseTransform('12345');
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
index 5aa87d6004..5aa4a865f4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
@@ -17,15 +17,15 @@ class BaseDateTimeTransformerTest extends TestCase
{
public function testConstructFailsIfInputTimezoneIsInvalid()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('this_timezone_does_not_exist');
- $this->getMockBuilder('Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer')->setConstructorArgs(['this_timezone_does_not_exist'])->getMock();
+ $this->getMockBuilder(\Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer::class)->setConstructorArgs(['this_timezone_does_not_exist'])->getMock();
}
public function testConstructFailsIfOutputTimezoneIsInvalid()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('that_timezone_does_not_exist');
- $this->getMockBuilder('Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer')->setConstructorArgs([null, 'that_timezone_does_not_exist'])->getMock();
+ $this->getMockBuilder(\Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer::class)->setConstructorArgs([null, 'that_timezone_does_not_exist'])->getMock();
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
index e9f9ea6bdc..0252f42259 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
@@ -47,13 +47,13 @@ class BooleanToStringTransformerTest extends TestCase
public function testTransformFailsIfString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->transform('1');
}
public function testReverseTransformFailsIfInteger()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->reverseTransform(1);
}
@@ -75,7 +75,7 @@ class BooleanToStringTransformerTest extends TestCase
public function testTrueValueContainedInFalseValues()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
new BooleanToStringTransformer('0', [null, '0']);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
index 8d812ab371..65089b0fef 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
@@ -91,7 +91,7 @@ class ChoiceToValueTransformerTest extends TestCase
*/
public function testReverseTransformExpectsStringOrNull($value)
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->reverseTransform($value);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
index 40a242ff8e..a330273cad 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
@@ -55,7 +55,7 @@ class ChoicesToValuesTransformerTest extends TestCase
public function testTransformExpectsArray()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->transform('foobar');
}
@@ -81,7 +81,7 @@ class ChoicesToValuesTransformerTest extends TestCase
public function testReverseTransformExpectsArray()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->reverseTransform('foobar');
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php
index 2c685a4197..f8038b0c20 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php
@@ -18,12 +18,12 @@ class DataTransformerChainTest extends TestCase
{
public function testTransform()
{
- $transformer1 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
+ $transformer1 = $this->getMockBuilder(\Symfony\Component\Form\DataTransformerInterface::class)->getMock();
$transformer1->expects($this->once())
->method('transform')
->with($this->identicalTo('foo'))
->willReturn('bar');
- $transformer2 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
+ $transformer2 = $this->getMockBuilder(\Symfony\Component\Form\DataTransformerInterface::class)->getMock();
$transformer2->expects($this->once())
->method('transform')
->with($this->identicalTo('bar'))
@@ -36,12 +36,12 @@ class DataTransformerChainTest extends TestCase
public function testReverseTransform()
{
- $transformer2 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
+ $transformer2 = $this->getMockBuilder(\Symfony\Component\Form\DataTransformerInterface::class)->getMock();
$transformer2->expects($this->once())
->method('reverseTransform')
->with($this->identicalTo('foo'))
->willReturn('bar');
- $transformer1 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
+ $transformer1 = $this->getMockBuilder(\Symfony\Component\Form\DataTransformerInterface::class)->getMock();
$transformer1->expects($this->once())
->method('reverseTransform')
->with($this->identicalTo('bar'))
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php
index c8b6549778..d73c7b99be 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php
@@ -54,7 +54,7 @@ class DateTimeImmutableToDateTimeTransformerTest extends TestCase
public function testTransformFail()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('Expected a \DateTimeImmutable.');
$transformer = new DateTimeImmutableToDateTimeTransformer();
$transformer->transform(new \DateTime());
@@ -82,7 +82,7 @@ class DateTimeImmutableToDateTimeTransformerTest extends TestCase
public function testReverseTransformFail()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('Expected a \DateTime.');
$transformer = new DateTimeImmutableToDateTimeTransformer();
$transformer->reverseTransform(new \DateTimeImmutable());
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
index 92b01dd29b..0a8b17ae9e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
@@ -139,7 +139,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testTransformRequiresDateTime()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform('12345');
}
@@ -211,7 +211,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformPartiallyEmptyYear()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'month' => '2',
@@ -224,7 +224,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformPartiallyEmptyMonth()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -237,7 +237,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformPartiallyEmptyDay()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -250,7 +250,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformPartiallyEmptyHour()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -263,7 +263,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformPartiallyEmptyMinute()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -276,7 +276,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformPartiallyEmptySecond()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -334,14 +334,14 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformRequiresArray()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform('12345');
}
public function testReverseTransformWithNegativeYear()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '-1',
@@ -355,7 +355,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithNegativeMonth()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -369,7 +369,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithNegativeDay()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -383,7 +383,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithNegativeHour()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -397,7 +397,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithNegativeMinute()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -411,7 +411,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithNegativeSecond()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -425,7 +425,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithInvalidMonth()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -439,7 +439,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithInvalidDay()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -453,7 +453,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithStringDay()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -467,7 +467,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithStringMonth()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -481,7 +481,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithStringYear()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => 'bazinga',
@@ -495,7 +495,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithEmptyStringHour()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -509,7 +509,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithEmptyStringMinute()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -523,7 +523,7 @@ class DateTimeToArrayTransformerTest extends TestCase
public function testReverseTransformWithEmptyStringSecond()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
index aef3e68829..97bda01756 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
@@ -73,7 +73,7 @@ class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase
public function testTransformRequiresValidDateTime()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToHtml5LocalDateTimeTransformer();
$transformer->transform('2010-01-01');
}
@@ -94,14 +94,14 @@ class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase
public function testReverseTransformRequiresString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToHtml5LocalDateTimeTransformer();
$transformer->reverseTransform(12345);
}
public function testReverseTransformWithNonExistingDate()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToHtml5LocalDateTimeTransformer('UTC', 'UTC');
$transformer->reverseTransform('2010-04-31T04:05');
@@ -109,7 +109,7 @@ class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase
public function testReverseTransformExpectsValidDateString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToHtml5LocalDateTimeTransformer('UTC', 'UTC');
$transformer->reverseTransform('2010-2010-2010');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
index ae23428a43..68518baf95 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
@@ -180,7 +180,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
public function testTransformRequiresValidDateTime()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->transform('2010-01-01');
}
@@ -193,7 +193,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
// HOW TO REPRODUCE?
- //$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
+ //$this->expectException(\Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException::class);
//$transformer->transform(1.5);
}
@@ -288,21 +288,21 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformRequiresString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform(12345);
}
public function testReverseTransformWrapsIntlErrors()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform('12345');
}
public function testReverseTransformWithNonExistingDate()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::SHORT);
$this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05'));
@@ -310,21 +310,21 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformOutOfTimestampRange()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
$transformer->reverseTransform('1789-07-14');
}
public function testReverseTransformFiveDigitYears()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd');
$transformer->reverseTransform('20107-03-21');
}
public function testReverseTransformFiveDigitYearsWithTimestamp()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd HH:mm:ss');
$transformer->reverseTransform('20107-03-21 12:34:56');
}
@@ -337,7 +337,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
$this->iniSet('intl.error_level', \E_WARNING);
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform('12345');
}
@@ -350,7 +350,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
$this->iniSet('intl.use_exceptions', 1);
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform('12345');
}
@@ -364,7 +364,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
$this->iniSet('intl.use_exceptions', 1);
$this->iniSet('intl.error_level', \E_WARNING);
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform('12345');
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
index e2944a9370..d34e52ab38 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
@@ -86,7 +86,7 @@ class DateTimeToRfc3339TransformerTest extends TestCase
public function testTransformRequiresValidDateTime()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToRfc3339Transformer();
$transformer->transform('2010-01-01');
}
@@ -107,14 +107,14 @@ class DateTimeToRfc3339TransformerTest extends TestCase
public function testReverseTransformRequiresString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToRfc3339Transformer();
$transformer->reverseTransform(12345);
}
public function testReverseTransformWithNonExistingDate()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
$transformer->reverseTransform('2010-04-31T04:05Z');
@@ -125,7 +125,7 @@ class DateTimeToRfc3339TransformerTest extends TestCase
*/
public function testReverseTransformExpectsValidDateString($date)
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
$transformer->reverseTransform($date);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
index 939c61847f..ffd92d31f3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
@@ -111,7 +111,7 @@ class DateTimeToStringTransformerTest extends TestCase
{
$transformer = new DateTimeToStringTransformer();
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer->transform('1234');
}
@@ -150,7 +150,7 @@ class DateTimeToStringTransformerTest extends TestCase
{
$reverseTransformer = new DateTimeToStringTransformer();
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$reverseTransformer->reverseTransform(1234);
}
@@ -159,7 +159,7 @@ class DateTimeToStringTransformerTest extends TestCase
{
$reverseTransformer = new DateTimeToStringTransformer();
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$reverseTransformer->reverseTransform('2010-2010-2010');
}
@@ -168,7 +168,7 @@ class DateTimeToStringTransformerTest extends TestCase
{
$reverseTransformer = new DateTimeToStringTransformer();
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$reverseTransformer->reverseTransform('2010-04-31');
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
index 4462108cf8..0f5ff2fb7a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
@@ -72,7 +72,7 @@ class DateTimeToTimestampTransformerTest extends TestCase
{
$transformer = new DateTimeToTimestampTransformer();
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer->transform('1234');
}
@@ -109,7 +109,7 @@ class DateTimeToTimestampTransformerTest extends TestCase
{
$reverseTransformer = new DateTimeToTimestampTransformer();
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$reverseTransformer->reverseTransform('2010-2010-2010');
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
index 20897c7170..ed1df8717c 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
@@ -40,13 +40,13 @@ class DateTimeZoneToStringTransformerTest extends TestCase
public function testInvalidTimezone()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
(new DateTimeZoneToStringTransformer())->transform(1);
}
public function testUnknownTimezone()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
(new DateTimeZoneToStringTransformer(true))->reverseTransform(['Foo/Bar']);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
index fd3e93a6d7..182161c1e4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
@@ -189,7 +189,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformExpectsString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform(1);
@@ -197,7 +197,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformExpectsValidNumber()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('foo');
@@ -208,7 +208,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
*/
public function testReverseTransformExpectsInteger($number, $locale)
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -228,7 +228,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsNaN()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('NaN');
@@ -236,7 +236,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsNaN2()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('nan');
@@ -244,7 +244,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsInfinity()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('∞');
@@ -252,7 +252,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsNegativeInfinity()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('-∞');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformerTest.php
index 44f6ae02ae..464c266e7b 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformerTest.php
@@ -43,13 +43,13 @@ class IntlTimeZoneToStringTransformerTest extends TestCase
public function testInvalidTimezone()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
(new IntlTimeZoneToStringTransformer())->transform(1);
}
public function testUnknownTimezone()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
(new IntlTimeZoneToStringTransformer(true))->reverseTransform(['Foo/Bar']);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
index cb94ca785d..0fab26b70e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
@@ -45,7 +45,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer->transform('abcd');
}
@@ -73,7 +73,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer->reverseTransform(12345);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
index 41b927d04a..248fc83555 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -399,7 +399,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
@@ -412,7 +412,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
@@ -454,7 +454,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -464,7 +464,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -482,7 +482,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testTransformExpectsNumeric()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->transform('foo');
@@ -490,7 +490,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformExpectsString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform(1);
@@ -498,7 +498,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformExpectsValidNumber()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('foo');
@@ -511,7 +511,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
*/
public function testReverseTransformDisallowsNaN($nan)
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform($nan);
@@ -528,7 +528,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsInfinity()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('∞');
@@ -536,7 +536,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsInfinity2()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('∞,123');
@@ -544,7 +544,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsNegativeInfinity()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('-∞');
@@ -552,7 +552,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsLeadingExtraCharacters()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('foo123');
@@ -560,7 +560,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsCenteredExtraCharacters()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('The number contains unrecognized characters: "foo3"');
$transformer = new NumberToLocalizedStringTransformer();
@@ -569,7 +569,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('The number contains unrecognized characters: "foo8"');
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
@@ -583,7 +583,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('The number contains unrecognized characters: "foo8"');
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
@@ -597,7 +597,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsTrailingExtraCharacters()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('The number contains unrecognized characters: "foo"');
$transformer = new NumberToLocalizedStringTransformer();
@@ -606,7 +606,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->expectExceptionMessage('The number contains unrecognized characters: "foo"');
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php
index 3de0383c07..ee4e4f8a65 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php
@@ -39,14 +39,14 @@ class StringToFloatTransformerTest extends TestCase
public function testFailIfTransformingANonString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new StringToFloatTransformer();
$transformer->transform(1.0);
}
public function testFailIfTransformingANonNumericString()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new StringToFloatTransformer();
$transformer->transform('foobar');
}
@@ -79,7 +79,7 @@ class StringToFloatTransformerTest extends TestCase
public function testFailIfReverseTransformingANonNumeric()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$transformer = new StringToFloatTransformer();
$transformer->reverseTransform('foobar');
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
index ec19ddf92f..b723a857e5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
@@ -107,7 +107,7 @@ class ValueToDuplicatesTransformerTest extends TestCase
public function testReverseTransformPartiallyNull()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$input = [
'a' => 'Foo',
'b' => 'Foo',
@@ -119,7 +119,7 @@ class ValueToDuplicatesTransformerTest extends TestCase
public function testReverseTransformDifferences()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$input = [
'a' => 'Foo',
'b' => 'Bar',
@@ -131,7 +131,7 @@ class ValueToDuplicatesTransformerTest extends TestCase
public function testReverseTransformRequiresArray()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
$this->transformer->reverseTransform('12345');
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
index bf7b5c0070..98a93d196a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
@@ -185,7 +185,7 @@ abstract class MergeCollectionListenerTest extends TestCase
*/
public function testRequireArrayOrTraversable($allowAdd, $allowDelete)
{
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$newData = 'no array or traversable';
$event = new FormEvent($this->form, $newData);
$listener = new MergeCollectionListener($allowAdd, $allowDelete);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
index d5d3a407a1..7f10108587 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
@@ -68,7 +68,7 @@ class ResizeFormListenerTest extends TestCase
public function testPreSetDataRequiresArrayOrTraversable()
{
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$data = 'no array or traversable';
$event = new FormEvent($this->form, $data);
$listener = new ResizeFormListener('text', [], false, false);
@@ -201,7 +201,7 @@ class ResizeFormListenerTest extends TestCase
public function testOnSubmitNormDataRequiresArrayOrTraversable()
{
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$data = 'no array or traversable';
$event = new FormEvent($this->form, $data);
$listener = new ResizeFormListener('text', [], false, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
index 3ca4cf07a7..d682a6b1c2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
@@ -20,7 +20,7 @@ class BirthdayTypeTest extends DateTypeTest
public function testSetInvalidYearsOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'years' => 'bad value',
]);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
index ed1957c7c9..6479333875 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
@@ -20,7 +20,7 @@ class ButtonTypeTest extends BaseTypeTest
public function testCreateButtonInstances()
{
- $this->assertInstanceOf('Symfony\Component\Form\Button', $this->factory->create(static::TESTED_TYPE));
+ $this->assertInstanceOf(\Symfony\Component\Form\Button::class, $this->factory->create(static::TESTED_TYPE));
}
/**
@@ -29,7 +29,7 @@ class ButtonTypeTest extends BaseTypeTest
*/
public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expectedData = null)
{
- $this->expectException('Symfony\Component\Form\Exception\BadMethodCallException');
+ $this->expectException(\Symfony\Component\Form\Exception\BadMethodCallException::class);
$this->expectExceptionMessage('Buttons do not support empty data.');
parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
index 6f872bbd73..c8c03db043 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
@@ -196,7 +196,7 @@ class CheckboxTypeTest extends BaseTypeTest
public function testDontAllowNonArrayFalseValues()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->expectExceptionMessageMatches('/"false_values" with value "invalid" is expected to be of type "array"/');
$this->factory->create(static::TESTED_TYPE, null, [
'false_values' => 'invalid',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
index f6018b19a6..491fc3755d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -88,7 +88,7 @@ class ChoiceTypeTest extends BaseTypeTest
public function testChoicesOptionExpectsArrayOrTraversable()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'choices' => new \stdClass(),
]);
@@ -96,7 +96,7 @@ class ChoiceTypeTest extends BaseTypeTest
public function testChoiceLoaderOptionExpectsChoiceLoaderInterface()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'choice_loader' => new \stdClass(),
]);
@@ -104,7 +104,7 @@ class ChoiceTypeTest extends BaseTypeTest
public function testChoiceListAndChoicesCanBeEmpty()
{
- $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, null, []));
+ $this->assertInstanceOf(\Symfony\Component\Form\FormInterface::class, $this->factory->create(static::TESTED_TYPE, null, []));
}
public function testExpandedChoicesOptionsTurnIntoChildren()
@@ -1820,7 +1820,7 @@ class ChoiceTypeTest extends BaseTypeTest
// https://github.com/symfony/symfony/issues/3298
public function testInitializeWithEmptyChoices()
{
- $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->createNamed('name', static::TESTED_TYPE, null, [
+ $this->assertInstanceOf(\Symfony\Component\Form\FormInterface::class, $this->factory->createNamed('name', static::TESTED_TYPE, null, [
'choices' => [],
]));
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
index 3fb2d75815..61170f4103 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
@@ -38,8 +38,8 @@ class CollectionTypeTest extends BaseTypeTest
]);
$form->setData(['foo@foo.com', 'foo@bar.com']);
- $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
- $this->assertInstanceOf('Symfony\Component\Form\Form', $form[1]);
+ $this->assertInstanceOf(\Symfony\Component\Form\Form::class, $form[0]);
+ $this->assertInstanceOf(\Symfony\Component\Form\Form::class, $form[1]);
$this->assertCount(2, $form);
$this->assertEquals('foo@foo.com', $form[0]->getData());
$this->assertEquals('foo@bar.com', $form[1]->getData());
@@ -49,7 +49,7 @@ class CollectionTypeTest extends BaseTypeTest
$this->assertEquals(20, $formAttrs1['maxlength']);
$form->setData(['foo@baz.com']);
- $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
+ $this->assertInstanceOf(\Symfony\Component\Form\Form::class, $form[0]);
$this->assertArrayNotHasKey(1, $form);
$this->assertCount(1, $form);
$this->assertEquals('foo@baz.com', $form[0]->getData());
@@ -62,7 +62,7 @@ class CollectionTypeTest extends BaseTypeTest
$form = $this->factory->create(static::TESTED_TYPE, null, [
'entry_type' => TextTypeTest::TESTED_TYPE,
]);
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$form->setData(new \stdClass());
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
index a924df59ed..654827d0e8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
@@ -323,7 +323,7 @@ class DateTimeTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
- $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime()));
+ $this->assertInstanceOf(FormInterface::class, $this->factory->create(static::TESTED_TYPE, new \DateTime()));
}
public function testSingleTextWidgetShouldUseTheRightInputType()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
index 38423e0459..58a42fd603 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -38,7 +38,7 @@ class DateTypeTest extends BaseTypeTest
public function testInvalidWidgetOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'widget' => 'fake_widget',
]);
@@ -46,7 +46,7 @@ class DateTypeTest extends BaseTypeTest
public function testInvalidInputOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'input' => 'fake_input',
]);
@@ -373,7 +373,7 @@ class DateTypeTest extends BaseTypeTest
*/
public function testThrowExceptionIfFormatIsNoPattern()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'format' => '0',
'html5' => false,
@@ -384,7 +384,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->expectExceptionMessage('The "format" option should contain the letters "y", "M" and "d". Its current value is "yy".');
$this->factory->create(static::TESTED_TYPE, null, [
'months' => [6, 7],
@@ -394,7 +394,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTextWidget()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->expectExceptionMessage('The "format" option should contain the letters "y", "M" or "d". Its current value is "wrong".');
$this->factory->create(static::TESTED_TYPE, null, [
'widget' => 'single_text',
@@ -405,7 +405,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfFormatIsNoConstant()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'format' => 105,
]);
@@ -413,7 +413,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfFormatIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'format' => [],
]);
@@ -421,7 +421,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfYearsIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'years' => 'bad value',
]);
@@ -429,7 +429,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfMonthsIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'months' => 'bad value',
]);
@@ -437,7 +437,7 @@ class DateTypeTest extends BaseTypeTest
public function testThrowExceptionIfDaysIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'days' => 'bad value',
]);
@@ -733,7 +733,7 @@ class DateTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
- $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime()));
+ $this->assertInstanceOf(FormInterface::class, $this->factory->create(static::TESTED_TYPE, new \DateTime()));
}
public function testSingleTextWidgetShouldUseTheRightInputType()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
index a10d407a66..06b19a725a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -63,7 +63,7 @@ class FormTypeTest extends BaseTypeTest
public function testCreateFormInstances()
{
- $this->assertInstanceOf('Symfony\Component\Form\Form', $this->factory->create(static::TESTED_TYPE));
+ $this->assertInstanceOf(\Symfony\Component\Form\Form::class, $this->factory->create(static::TESTED_TYPE));
}
public function testPassRequiredAsOption()
@@ -149,28 +149,28 @@ class FormTypeTest extends BaseTypeTest
public function testDataClassMayBeNull()
{
- $this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, [
+ $this->assertInstanceOf(\Symfony\Component\Form\FormBuilderInterface::class, $this->factory->createBuilder(static::TESTED_TYPE, null, [
'data_class' => null,
]));
}
public function testDataClassMayBeAbstractClass()
{
- $this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, [
+ $this->assertInstanceOf(\Symfony\Component\Form\FormBuilderInterface::class, $this->factory->createBuilder(static::TESTED_TYPE, null, [
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AbstractAuthor',
]));
}
public function testDataClassMayBeInterface()
{
- $this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, [
+ $this->assertInstanceOf(\Symfony\Component\Form\FormBuilderInterface::class, $this->factory->createBuilder(static::TESTED_TYPE, null, [
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AuthorInterface',
]));
}
public function testDataClassMustBeValidClassOrInterface()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->factory->createBuilder(static::TESTED_TYPE, null, [
'data_class' => 'foobar',
]);
@@ -337,7 +337,7 @@ class FormTypeTest extends BaseTypeTest
public function testAttributesException()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, ['attr' => '']);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
index c8c2a70c10..50d178a510 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
@@ -194,7 +194,7 @@ class NumberTypeTest extends BaseTypeTest
public function testGroupingNotAllowedWithHtml5Widget()
{
- $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'grouping' => true,
'html5' => true,
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
index 04e53697ae..d4233aa58d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
@@ -116,7 +116,7 @@ class RepeatedTypeTest extends BaseTypeTest
public function testSetInvalidOptions()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'type' => TextTypeTest::TESTED_TYPE,
'options' => 'bad value',
@@ -125,7 +125,7 @@ class RepeatedTypeTest extends BaseTypeTest
public function testSetInvalidFirstOptions()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'type' => TextTypeTest::TESTED_TYPE,
'first_options' => 'bad value',
@@ -134,7 +134,7 @@ class RepeatedTypeTest extends BaseTypeTest
public function testSetInvalidSecondOptions()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'type' => TextTypeTest::TESTED_TYPE,
'second_options' => 'bad value',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
index 5b12ced9f2..fdabed0d0d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
@@ -20,7 +20,7 @@ class SubmitTypeTest extends ButtonTypeTest
public function testCreateSubmitButtonInstances()
{
- $this->assertInstanceOf('Symfony\Component\Form\SubmitButton', $this->factory->create(static::TESTED_TYPE));
+ $this->assertInstanceOf(\Symfony\Component\Form\SubmitButton::class, $this->factory->create(static::TESTED_TYPE));
}
public function testNotClickedByDefault()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
index c31f6f8682..7a5a604010 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
@@ -660,7 +660,7 @@ class TimeTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
- $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime()));
+ $this->assertInstanceOf(FormInterface::class, $this->factory->create(static::TESTED_TYPE, new \DateTime()));
}
public function testSingleTextWidgetShouldUseTheRightInputType()
@@ -857,7 +857,7 @@ class TimeTypeTest extends BaseTypeTest
public function testInitializeWithSecondsAndWithoutMinutes()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidConfigurationException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidConfigurationException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'with_minutes' => false,
'with_seconds' => true,
@@ -866,7 +866,7 @@ class TimeTypeTest extends BaseTypeTest
public function testThrowExceptionIfHoursIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'hours' => 'bad value',
]);
@@ -874,7 +874,7 @@ class TimeTypeTest extends BaseTypeTest
public function testThrowExceptionIfMinutesIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'minutes' => 'bad value',
]);
@@ -882,7 +882,7 @@ class TimeTypeTest extends BaseTypeTest
public function testThrowExceptionIfSecondsIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'seconds' => 'bad value',
]);
@@ -890,7 +890,7 @@ class TimeTypeTest extends BaseTypeTest
public function testReferenceDateTimezoneMustMatchModelTimezone()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidConfigurationException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidConfigurationException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'model_timezone' => 'UTC',
'view_timezone' => 'Europe/Berlin',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
index 5a829c95bb..efcda84261 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
@@ -75,7 +75,7 @@ class UrlTypeTest extends TextTypeTest
public function testThrowExceptionIfDefaultProtocolIsInvalid()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
$this->factory->create(static::TESTED_TYPE, null, [
'default_protocol' => [],
]);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
index 313827ef46..c5a5fe1003 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
@@ -29,7 +29,7 @@ class DataCollectorExtensionTest extends TestCase
protected function setUp(): void
{
- $this->dataCollector = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface')->getMock();
+ $this->dataCollector = $this->getMockBuilder(\Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface::class)->getMock();
$this->extension = new DataCollectorExtension($this->dataCollector);
}
@@ -39,6 +39,6 @@ class DataCollectorExtensionTest extends TestCase
$this->assertIsArray($typeExtensions);
$this->assertCount(1, $typeExtensions);
- $this->assertInstanceOf('Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension', array_shift($typeExtensions));
+ $this->assertInstanceOf(\Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension::class, array_shift($typeExtensions));
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
index b32e217377..03072f83d4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
@@ -77,7 +77,7 @@ class FormDataCollectorTest extends TestCase
protected function setUp(): void
{
- $this->dataExtractor = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface')->getMock();
+ $this->dataExtractor = $this->getMockBuilder(\Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface::class)->getMock();
$this->dataCollector = new FormDataCollector($this->dataExtractor);
$this->dispatcher = new EventDispatcher();
$this->factory = new FormFactory(new FormRegistry([new CoreExtension()], new ResolvedFormTypeFactory()));
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
index efef29a7ba..cda0bd24da 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
@@ -49,13 +49,13 @@ class FormDataExtractorTest extends TestCase
protected function setUp(): void
{
$this->dataExtractor = new FormDataExtractor();
- $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
- $this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
+ $this->dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
+ $this->factory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
}
public function testExtractConfiguration()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
$type->expects($this->any())
->method('getInnerType')
->willReturn(new HiddenType());
@@ -76,7 +76,7 @@ class FormDataExtractorTest extends TestCase
public function testExtractConfigurationSortsPassedOptions()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
$type->expects($this->any())
->method('getInnerType')
->willReturn(new HiddenType());
@@ -110,7 +110,7 @@ class FormDataExtractorTest extends TestCase
public function testExtractConfigurationSortsResolvedOptions()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
$type->expects($this->any())
->method('getInnerType')
->willReturn(new HiddenType());
@@ -141,18 +141,18 @@ class FormDataExtractorTest extends TestCase
public function testExtractConfigurationBuildsIdRecursively()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
$type->expects($this->any())
->method('getInnerType')
->willReturn(new HiddenType());
$grandParent = $this->createBuilder('grandParent')
->setCompound(true)
- ->setDataMapper($this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock())
+ ->setDataMapper($this->getMockBuilder(\Symfony\Component\Form\DataMapperInterface::class)->getMock())
->getForm();
$parent = $this->createBuilder('parent')
->setCompound(true)
- ->setDataMapper($this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock())
+ ->setDataMapper($this->getMockBuilder(\Symfony\Component\Form\DataMapperInterface::class)->getMock())
->getForm();
$form = $this->createBuilder('name')
->setType($type)
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
index 53ecc1cb06..fc4e39d0a6 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
@@ -29,7 +29,7 @@ class DataCollectorTypeExtensionTest extends TestCase
protected function setUp(): void
{
- $this->dataCollector = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface')->getMock();
+ $this->dataCollector = $this->getMockBuilder(\Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface::class)->getMock();
$this->extension = new DataCollectorTypeExtension($this->dataCollector);
}
@@ -40,10 +40,10 @@ class DataCollectorTypeExtensionTest extends TestCase
public function testBuildForm()
{
- $builder = $this->getMockBuilder('Symfony\Component\Form\Test\FormBuilderInterface')->getMock();
+ $builder = $this->getMockBuilder(\Symfony\Component\Form\Test\FormBuilderInterface::class)->getMock();
$builder->expects($this->atLeastOnce())
->method('addEventSubscriber')
- ->with($this->isInstanceOf('Symfony\Component\Form\Extension\DataCollector\EventListener\DataCollectorListener'));
+ ->with($this->isInstanceOf(\Symfony\Component\Form\Extension\DataCollector\EventListener\DataCollectorListener::class));
$this->extension->buildForm($builder, []);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
index 26db2d8cea..157ebe3390 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
@@ -43,7 +43,7 @@ class DependencyInjectionExtensionTest extends TestCase
public function testThrowExceptionForInvalidExtendedType()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage(sprintf('The extended type "unmatched" specified for the type extension class "%s" does not match any of the actual extended types (["test"]).', TestTypeExtension::class));
$extensions = [
diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
index 771cdcd6fc..d2bdedaeeb 100644
--- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
@@ -23,13 +23,13 @@ class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest
{
public function testRequestShouldNotBeNull()
{
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$this->requestHandler->handleRequest($this->createForm('name', 'GET'));
}
public function testRequestShouldBeInstanceOfRequest()
{
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$this->requestHandler->handleRequest($this->createForm('name', 'GET'), new \stdClass());
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
index 81baf3dc8f..7062ed53d3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
@@ -78,7 +78,7 @@ abstract class BaseValidatorExtensionTest extends TypeTestCase
'validation_groups' => new GroupSequence(['group1', 'group2']),
]);
- $this->assertInstanceOf('Symfony\Component\Validator\Constraints\GroupSequence', $form->getConfig()->getOption('validation_groups'));
+ $this->assertInstanceOf(GroupSequence::class, $form->getConfig()->getOption('validation_groups'));
}
abstract protected function createForm(array $options = []);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
index 9d2eeaae1c..760f8da14e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
@@ -132,7 +132,7 @@ class ValidatorTypeGuesserTest extends TestCase
$constraint = new Length(['max' => '2']);
$result = $this->guesser->guessMaxLengthForConstraint($constraint);
- $this->assertInstanceOf('Symfony\Component\Form\Guess\ValueGuess', $result);
+ $this->assertInstanceOf(ValueGuess::class, $result);
$this->assertEquals(2, $result->getValue());
$this->assertEquals(Guess::HIGH_CONFIDENCE, $result->getConfidence());
}
@@ -150,7 +150,7 @@ class ValidatorTypeGuesserTest extends TestCase
$mimeTypes = ['image/png', 'image/jpeg'];
$constraint = new File(['mimeTypes' => $mimeTypes]);
$typeGuess = $this->guesser->guessTypeForConstraint($constraint);
- $this->assertInstanceOf('Symfony\Component\Form\Guess\TypeGuess', $typeGuess);
+ $this->assertInstanceOf(TypeGuess::class, $typeGuess);
$this->assertArrayHasKey('attr', $typeGuess->getOptions());
$this->assertArrayHasKey('accept', $typeGuess->getOptions()['attr']);
$this->assertEquals(implode(',', $mimeTypes), $typeGuess->getOptions()['attr']['accept']);
@@ -160,7 +160,7 @@ class ValidatorTypeGuesserTest extends TestCase
{
$constraint = new File();
$typeGuess = $this->guesser->guessTypeForConstraint($constraint);
- $this->assertInstanceOf('Symfony\Component\Form\Guess\TypeGuess', $typeGuess);
+ $this->assertInstanceOf(TypeGuess::class, $typeGuess);
$this->assertArrayNotHasKey('attr', $typeGuess->getOptions());
}
@@ -168,7 +168,7 @@ class ValidatorTypeGuesserTest extends TestCase
{
$constraint = new File(['mimeTypes' => 'image/*']);
$typeGuess = $this->guesser->guessTypeForConstraint($constraint);
- $this->assertInstanceOf('Symfony\Component\Form\Guess\TypeGuess', $typeGuess);
+ $this->assertInstanceOf(TypeGuess::class, $typeGuess);
$this->assertArrayHasKey('attr', $typeGuess->getOptions());
$this->assertArrayHasKey('accept', $typeGuess->getOptions()['attr']);
$this->assertEquals('image/*', $typeGuess->getOptions()['attr']['accept']);
@@ -178,7 +178,7 @@ class ValidatorTypeGuesserTest extends TestCase
{
$constraint = new File(['mimeTypes' => '']);
$typeGuess = $this->guesser->guessTypeForConstraint($constraint);
- $this->assertInstanceOf('Symfony\Component\Form\Guess\TypeGuess', $typeGuess);
+ $this->assertInstanceOf(TypeGuess::class, $typeGuess);
$this->assertArrayNotHasKey('attr', $typeGuess->getOptions());
}
@@ -200,7 +200,7 @@ class ValidatorTypeGuesserTest extends TestCase
$constraint = new Type($type);
$result = $this->guesser->guessMaxLengthForConstraint($constraint);
- $this->assertInstanceOf('Symfony\Component\Form\Guess\ValueGuess', $result);
+ $this->assertInstanceOf(ValueGuess::class, $result);
$this->assertNull($result->getValue());
$this->assertEquals(Guess::MEDIUM_CONFIDENCE, $result->getConfidence());
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
index 02e7523c29..7b9dec34c2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
@@ -142,7 +142,7 @@ class ViolationPathTest extends TestCase
public function testGetElementDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->getElement(3);
@@ -150,7 +150,7 @@ class ViolationPathTest extends TestCase
public function testGetElementDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->getElement(-1);
@@ -166,7 +166,7 @@ class ViolationPathTest extends TestCase
public function testIsPropertyDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->isProperty(3);
@@ -174,7 +174,7 @@ class ViolationPathTest extends TestCase
public function testIsPropertyDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->isProperty(-1);
@@ -190,7 +190,7 @@ class ViolationPathTest extends TestCase
public function testIsIndexDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->isIndex(3);
@@ -198,7 +198,7 @@ class ViolationPathTest extends TestCase
public function testIsIndexDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->isIndex(-1);
@@ -215,7 +215,7 @@ class ViolationPathTest extends TestCase
public function testMapsFormDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->mapsForm(3);
@@ -223,7 +223,7 @@ class ViolationPathTest extends TestCase
public function testMapsFormDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$path = new ViolationPath('children[address].data[street].name');
$path->mapsForm(-1);
diff --git a/src/Symfony/Component/Form/Tests/FormConfigTest.php b/src/Symfony/Component/Form/Tests/FormConfigTest.php
index a8755cae5f..cc943fcda2 100644
--- a/src/Symfony/Component/Form/Tests/FormConfigTest.php
+++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php
@@ -65,7 +65,7 @@ class FormConfigTest extends TestCase
*/
public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $expectedException = null)
{
- $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
+ $dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
if (null !== $expectedException) {
$this->expectException($expectedException);
@@ -80,7 +80,7 @@ class FormConfigTest extends TestCase
{
$config = $this->getConfigBuilder()->getFormConfig();
- $this->assertInstanceOf('Symfony\Component\Form\NativeRequestHandler', $config->getRequestHandler());
+ $this->assertInstanceOf(\Symfony\Component\Form\NativeRequestHandler::class, $config->getRequestHandler());
}
public function testGetRequestHandlerReusesNativeRequestHandlerInstance()
@@ -133,7 +133,7 @@ class FormConfigTest extends TestCase
private function getConfigBuilder($name = 'name')
{
- $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
+ $dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
return new FormConfigBuilder($name, null, $dispatcher);
}
diff --git a/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php b/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php
index 4ed30414f3..1d21b074f5 100644
--- a/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php
+++ b/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php
@@ -33,7 +33,7 @@ class FormErrorIteratorTest extends TestCase
'form',
null,
new EventDispatcher(),
- $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(),
+ $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock(),
[]
);
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
index 9a236cc009..22f6c49f2f 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
@@ -23,11 +23,11 @@ class FormFactoryBuilderTest extends TestCase
protected function setUp(): void
{
- $factory = new \ReflectionClass('Symfony\Component\Form\FormFactory');
+ $factory = new \ReflectionClass(\Symfony\Component\Form\FormFactory::class);
$this->registry = $factory->getProperty('registry');
$this->registry->setAccessible(true);
- $this->guesser = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
+ $this->guesser = $this->getMockBuilder(\Symfony\Component\Form\FormTypeGuesserInterface::class)->getMock();
$this->type = new FooType();
}
diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
index 56bb9ffd35..3b1518f549 100644
--- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -65,9 +65,9 @@ class FormRegistryTest extends TestCase
protected function setUp(): void
{
- $this->resolvedTypeFactory = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeFactory')->getMock();
- $this->guesser1 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
- $this->guesser2 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
+ $this->resolvedTypeFactory = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeFactory::class)->getMock();
+ $this->guesser1 = $this->getMockBuilder(\Symfony\Component\Form\FormTypeGuesserInterface::class)->getMock();
+ $this->guesser2 = $this->getMockBuilder(\Symfony\Component\Form\FormTypeGuesserInterface::class)->getMock();
$this->extension1 = new TestExtension($this->guesser1);
$this->extension2 = new TestExtension($this->guesser2);
$this->registry = new FormRegistry([
@@ -106,13 +106,13 @@ class FormRegistryTest extends TestCase
public function testFailIfUnregisteredTypeNoClass()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->registry->getType('Symfony\Blubb');
}
public function testFailIfUnregisteredTypeNoFormType()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->registry->getType('stdClass');
}
@@ -158,7 +158,7 @@ class FormRegistryTest extends TestCase
public function testFormCannotHaveItselfAsAParent()
{
- $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
$this->expectExceptionMessage('Circular reference detected for form type "Symfony\Component\Form\Tests\Fixtures\FormWithSameParentType" (Symfony\Component\Form\Tests\Fixtures\FormWithSameParentType > Symfony\Component\Form\Tests\Fixtures\FormWithSameParentType).');
$type = new FormWithSameParentType();
@@ -169,7 +169,7 @@ class FormRegistryTest extends TestCase
public function testRecursiveFormDependencies()
{
- $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
$this->expectExceptionMessage('Circular reference detected for form type "Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeFoo" (Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeFoo > Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeBar > Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeBaz > Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeFoo).');
$foo = new RecursiveFormTypeFoo();
$bar = new RecursiveFormTypeBar();
@@ -184,7 +184,7 @@ class FormRegistryTest extends TestCase
public function testGetTypeThrowsExceptionIfTypeNotFound()
{
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Form\Exception\InvalidArgumentException::class);
$this->registry->getType('bar');
}
@@ -230,7 +230,7 @@ class FormRegistryTest extends TestCase
$this->assertEquals($expectedGuesser, $this->registry->getTypeGuesser());
$registry = new FormRegistry(
- [$this->getMockBuilder('Symfony\Component\Form\FormExtensionInterface')->getMock()],
+ [$this->getMockBuilder(\Symfony\Component\Form\FormExtensionInterface::class)->getMock()],
$this->resolvedTypeFactory
);
diff --git a/src/Symfony/Component/Form/Tests/FormRendererTest.php b/src/Symfony/Component/Form/Tests/FormRendererTest.php
index 8c85fd84ff..f3f27ffef5 100644
--- a/src/Symfony/Component/Form/Tests/FormRendererTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRendererTest.php
@@ -19,7 +19,7 @@ class FormRendererTest extends TestCase
{
public function testHumanize()
{
- $renderer = $this->getMockBuilder('Symfony\Component\Form\FormRenderer')
+ $renderer = $this->getMockBuilder(\Symfony\Component\Form\FormRenderer::class)
->setMethods(null)
->disableOriginalConstructor()
->getMock()
diff --git a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
index ad1ea18e4a..d9e055b86b 100644
--- a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
@@ -50,7 +50,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest
public function testRequestShouldBeNull()
{
- $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Form\Exception\UnexpectedTypeException::class);
$this->requestHandler->handleRequest($this->createForm('name', 'GET'), 'request');
}
diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
index 744198f95f..f9fc9746f3 100644
--- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php
+++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
@@ -97,7 +97,7 @@ class SimpleFormTest extends AbstractFormTest
public function testDataTransformationFailure()
{
- $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException(TransformationFailedException::class);
$this->expectExceptionMessage('Unable to transform data for property path "name": No mapping for value "arg"');
$model = new FixedDataTransformer([
'default' => 'foo',
@@ -174,7 +174,7 @@ class SimpleFormTest extends AbstractFormTest
public function testSubmitThrowsExceptionIfAlreadySubmitted()
{
- $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
+ $this->expectException(\Symfony\Component\Form\Exception\AlreadySubmittedException::class);
$this->form->submit([]);
$this->form->submit([]);
}
@@ -366,7 +366,7 @@ class SimpleFormTest extends AbstractFormTest
public function testSetParentThrowsExceptionIfAlreadySubmitted()
{
- $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
+ $this->expectException(\Symfony\Component\Form\Exception\AlreadySubmittedException::class);
$this->form->submit([]);
$this->form->setParent($this->getBuilder('parent')->getForm());
}
@@ -386,7 +386,7 @@ class SimpleFormTest extends AbstractFormTest
public function testSetDataThrowsExceptionIfAlreadySubmitted()
{
- $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
+ $this->expectException(\Symfony\Component\Form\Exception\AlreadySubmittedException::class);
$this->form->submit([]);
$this->form->setData(null);
}
@@ -695,7 +695,7 @@ class SimpleFormTest extends AbstractFormTest
->setEmptyData(function ($form) {
// the form instance is passed to the closure to allow use
// of form data when creating the empty value
- $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
+ $this->assertInstanceOf(FormInterface::class, $form);
return 'foo';
})
@@ -721,8 +721,8 @@ class SimpleFormTest extends AbstractFormTest
public function testCreateView()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
- $view = $this->getMockBuilder('Symfony\Component\Form\FormView')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
+ $view = $this->getMockBuilder(\Symfony\Component\Form\FormView::class)->getMock();
$form = $this->getBuilder()->setType($type)->getForm();
$type->expects($this->once())
@@ -735,11 +735,11 @@ class SimpleFormTest extends AbstractFormTest
public function testCreateViewWithParent()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
- $view = $this->getMockBuilder('Symfony\Component\Form\FormView')->getMock();
- $parentType = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
+ $view = $this->getMockBuilder(\Symfony\Component\Form\FormView::class)->getMock();
+ $parentType = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
$parentForm = $this->getBuilder()->setType($parentType)->getForm();
- $parentView = $this->getMockBuilder('Symfony\Component\Form\FormView')->getMock();
+ $parentView = $this->getMockBuilder(\Symfony\Component\Form\FormView::class)->getMock();
$form = $this->getBuilder()->setType($type)->getForm();
$form->setParent($parentForm);
@@ -757,9 +757,9 @@ class SimpleFormTest extends AbstractFormTest
public function testCreateViewWithExplicitParent()
{
- $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
- $view = $this->getMockBuilder('Symfony\Component\Form\FormView')->getMock();
- $parentView = $this->getMockBuilder('Symfony\Component\Form\FormView')->getMock();
+ $type = $this->getMockBuilder(\Symfony\Component\Form\ResolvedFormTypeInterface::class)->getMock();
+ $view = $this->getMockBuilder(\Symfony\Component\Form\FormView::class)->getMock();
+ $parentView = $this->getMockBuilder(\Symfony\Component\Form\FormView::class)->getMock();
$form = $this->getBuilder()->setType($type)->getForm();
$type->expects($this->once())
@@ -787,7 +787,7 @@ class SimpleFormTest extends AbstractFormTest
public function testFormCannotHaveEmptyNameNotInRootLevel()
{
- $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
$this->expectExceptionMessage('A form with an empty name cannot have a parent form.');
$this->getBuilder()
->setCompound(true)
@@ -897,7 +897,7 @@ class SimpleFormTest extends AbstractFormTest
public function testViewDataMustBeObjectIfDataClassIsSet()
{
- $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
$config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
$config->addViewTransformer(new FixedDataTransformer([
'' => '',
@@ -910,7 +910,7 @@ class SimpleFormTest extends AbstractFormTest
public function testSetDataCannotInvokeItself()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$this->expectExceptionMessage('A cycle was detected. Listeners to the PRE_SET_DATA event must not call setData(). You should call setData() on the FormEvent object instead.');
// Cycle detection to prevent endless loops
$config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
@@ -944,7 +944,7 @@ class SimpleFormTest extends AbstractFormTest
public function testHandleRequestForwardsToRequestHandler()
{
- $handler = $this->getMockBuilder('Symfony\Component\Form\RequestHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\Symfony\Component\Form\RequestHandlerInterface::class)->getMock();
$form = $this->getBuilder()
->setRequestHandler($handler)
@@ -982,7 +982,7 @@ class SimpleFormTest extends AbstractFormTest
public function testInheritDataDisallowsSetData()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -992,7 +992,7 @@ class SimpleFormTest extends AbstractFormTest
public function testGetDataRequiresParentToBeSetIfInheritData()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1002,7 +1002,7 @@ class SimpleFormTest extends AbstractFormTest
public function testGetNormDataRequiresParentToBeSetIfInheritData()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1012,7 +1012,7 @@ class SimpleFormTest extends AbstractFormTest
public function testGetViewDataRequiresParentToBeSetIfInheritData()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1050,7 +1050,7 @@ class SimpleFormTest extends AbstractFormTest
public function testInitializeSetsDefaultData()
{
$config = $this->getBuilder()->setData('DEFAULT')->getFormConfig();
- $form = $this->getMockBuilder('Symfony\Component\Form\Form')->setMethods(['setData'])->setConstructorArgs([$config])->getMock();
+ $form = $this->getMockBuilder(Form::class)->setMethods(['setData'])->setConstructorArgs([$config])->getMock();
$form->expects($this->once())
->method('setData')
@@ -1062,7 +1062,7 @@ class SimpleFormTest extends AbstractFormTest
public function testInitializeFailsIfParent()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$parent = $this->getBuilder()->setRequired(false)->getForm();
$child = $this->getBuilder()->setRequired(true)->getForm();
@@ -1073,7 +1073,7 @@ class SimpleFormTest extends AbstractFormTest
public function testCannotCallGetDataInPreSetDataListenerIfDataHasNotAlreadyBeenSet()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$this->expectExceptionMessage('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getData() if the form data has not already been set. You should call getData() on the FormEvent object instead.');
$config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
$config->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
@@ -1086,7 +1086,7 @@ class SimpleFormTest extends AbstractFormTest
public function testCannotCallGetNormDataInPreSetDataListener()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$this->expectExceptionMessage('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getNormData() if the form data has not already been set.');
$config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
$config->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
@@ -1099,7 +1099,7 @@ class SimpleFormTest extends AbstractFormTest
public function testCannotCallGetViewDataInPreSetDataListener()
{
- $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Form\Exception\RuntimeException::class);
$this->expectExceptionMessage('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getViewData() if the form data has not already been set.');
$config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
$config->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
index 9d6f7ddf06..894da681d5 100644
--- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
+++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
@@ -29,7 +29,7 @@ class OrderedHashMapTest extends TestCase
public function testGetNonExistingFails()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$map = new OrderedHashMap();
$map['first'];
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 74be4c101d..f5891d3c53 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -2000,7 +2000,7 @@ class Request
// setting the default locale, the intl module is not installed, and
// the call can be ignored:
try {
- if (class_exists('Locale', false)) {
+ if (class_exists(\Locale::class, false)) {
\Locale::setDefault($locale);
}
} catch (\Exception $e) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
index 31d6bc2c00..ccd3827c06 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
@@ -71,7 +71,7 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testSetContent()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$response = new BinaryFileResponse(__FILE__);
$response->setContent('foo');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
index 64136b53fc..749cc1f8bd 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
@@ -43,7 +43,7 @@ class CookieTest extends TestCase
*/
public function testInstantiationThrowsExceptionIfRawCookieNameContainsSpecialCharacters($name)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
Cookie::create($name, null, 0, null, null, null, false, true);
}
@@ -66,13 +66,13 @@ class CookieTest extends TestCase
public function testInstantiationThrowsExceptionIfCookieNameIsEmpty()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
Cookie::create('');
}
public function testInvalidExpiration()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
Cookie::create('MyCookie', 'foo', 'bar');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php b/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
index 8a389329e4..aab5f739cc 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
@@ -20,7 +20,7 @@ class ExpressionRequestMatcherTest extends TestCase
{
public function testWhenNoExpressionIsSet()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$expressionRequestMatcher = new ExpressionRequestMatcher();
$expressionRequestMatcher->matches(new Request());
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
index 208189c2f6..10f62a1fc2 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
@@ -41,7 +41,7 @@ class FileTest extends TestCase
public function testConstructWhenFileNotExists()
{
- $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException(\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException::class);
new File(__DIR__.'/Fixtures/not_here');
}
@@ -57,7 +57,7 @@ class FileTest extends TestCase
$file = new File($path);
$movedFile = $file->move($targetDir);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
+ $this->assertInstanceOf(File::class, $movedFile);
$this->assertFileExists($targetPath);
$this->assertFileDoesNotExist($path);
@@ -118,7 +118,7 @@ class FileTest extends TestCase
$file = new File($path);
$movedFile = $file->move($targetDir, $filename);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
+ $this->assertInstanceOf(File::class, $movedFile);
$this->assertFileExists($targetPath);
$this->assertFileDoesNotExist($path);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
index 50374aa081..e558870a92 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
@@ -33,7 +33,7 @@ class UploadedFileTest extends TestCase
public function testConstructWhenFileNotExists()
{
- $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException(\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException::class);
new UploadedFile(
__DIR__.'/Fixtures/not_here',
@@ -144,7 +144,7 @@ class UploadedFileTest extends TestCase
public function testMoveLocalFileIsNotAllowed()
{
- $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileException');
+ $this->expectException(FileException::class);
$file = new UploadedFile(
__DIR__.'/Fixtures/test.gif',
'original.gif',
diff --git a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
index 69983ede49..7b33df471d 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
@@ -25,7 +25,7 @@ class FileBagTest extends TestCase
{
public function testFileMustBeAnArrayOrUploadedFile()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new FileBag(['file' => 'foo']);
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
index 89fdf82ac2..50546311a9 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
@@ -45,7 +45,7 @@ class HeaderBagTest extends TestCase
{
$bag = new HeaderBag(['foo' => 'Tue, 4 Sep 2012 20:00:00 +0200']);
$headerDate = $bag->getDate('foo');
- $this->assertInstanceOf('DateTime', $headerDate);
+ $this->assertInstanceOf(\DateTime::class, $headerDate);
}
public function testGetDateNull()
@@ -57,7 +57,7 @@ class HeaderBagTest extends TestCase
public function testGetDateException()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$bag = new HeaderBag(['foo' => 'Tue']);
$bag->getDate('foo');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php
index 8d425d4df8..2b585a95d4 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php
@@ -99,7 +99,7 @@ class HeaderUtilsTest extends TestCase
public function testMakeDispositionInvalidDisposition()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
HeaderUtils::makeDisposition('invalid', 'foo.html');
}
@@ -128,7 +128,7 @@ class HeaderUtilsTest extends TestCase
*/
public function testMakeDispositionFail($disposition, $filename)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
HeaderUtils::makeDisposition($disposition, $filename);
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
index 13b5743794..2510b830a1 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
@@ -77,7 +77,7 @@ class IpUtilsTest extends TestCase
*/
public function testAnIpv6WithOptionDisabledIpv6()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
if (\defined('AF_INET6')) {
$this->markTestSkipped('Only works when PHP is compiled with the option "disable-ipv6".');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index a1cff9d2fd..ee6f87e7f9 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -917,7 +917,7 @@ class RequestTest extends TestCase
public function testGetHostWithFakeHttpHostValue()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$request = new Request();
$request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.host.com?query=string']);
$request->getHost();
@@ -1086,7 +1086,7 @@ class RequestTest extends TestCase
*/
public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXForwardedFor)
{
- $this->expectException('Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException');
+ $this->expectException(\Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException::class);
$request = new Request();
$server = [
@@ -1848,7 +1848,7 @@ class RequestTest extends TestCase
private function disableHttpMethodParameterOverride()
{
- $class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request');
+ $class = new \ReflectionClass(Request::class);
$property = $class->getProperty('httpMethodParameterOverride');
$property->setAccessible(true);
$property->setValue(false);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
index 8b54822ddb..81f8ba2894 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
@@ -250,7 +250,7 @@ class ResponseHeaderBagTest extends TestCase
public function testGetCookiesWithInvalidArgument()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$bag = new ResponseHeaderBag();
$bag->getCookies('invalid_argument');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
index 32bf02fe59..3bb01d2063 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
@@ -212,7 +212,7 @@ class SessionTest extends TestCase
public function testGetFlashBag()
{
- $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface', $this->session->getFlashBag());
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface::class, $this->session->getFlashBag());
}
public function testGetIterator()
@@ -241,7 +241,7 @@ class SessionTest extends TestCase
public function testGetMeta()
{
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\MetadataBag', $this->session->getMetadataBag());
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\Session\Storage\MetadataBag::class, $this->session->getMetadataBag());
}
public function testIsEmpty()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
index 0f8d8989b7..c605607cb1 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
@@ -38,7 +38,7 @@ class MemcachedSessionHandlerTest extends TestCase
$this->markTestSkipped('Tests can only be run with memcached extension 2.1.0 or lower, or 3.0.0b1 or higher');
}
- $this->memcached = $this->getMockBuilder('Memcached')->getMock();
+ $this->memcached = $this->getMockBuilder(\Memcached::class)->getMock();
$this->storage = new MemcachedSessionHandler(
$this->memcached,
['prefix' => self::PREFIX, 'expiretime' => self::TTL]
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
index f0e2d4f504..01b92dfa22 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -55,7 +55,7 @@ class MongoDbSessionHandlerTest extends TestCase
public function testConstructorShouldThrowExceptionForMissingOptions()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new MongoDbSessionHandler($this->mongo, []);
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
index 368af6a3e3..89e628754c 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
@@ -60,7 +60,7 @@ class NativeFileSessionHandlerTest extends TestCase
public function testConstructException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new NativeFileSessionHandler('something;invalid;with;too-many-args');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
index f84c824e6d..b5fb7067bd 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -50,7 +50,7 @@ class PdoSessionHandlerTest extends TestCase
public function testWrongPdoErrMode()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$pdo = $this->getMemorySqlitePdo();
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
@@ -59,7 +59,7 @@ class PdoSessionHandlerTest extends TestCase
public function testInexistentTable()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$storage = new PdoSessionHandler($this->getMemorySqlitePdo(), ['db_table' => 'inexistent_table']);
$storage->open('', 'sid');
$storage->read('id');
@@ -69,7 +69,7 @@ class PdoSessionHandlerTest extends TestCase
public function testCreateTableTwice()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$storage = new PdoSessionHandler($this->getMemorySqlitePdo());
$storage->createTable();
}
@@ -131,7 +131,7 @@ class PdoSessionHandlerTest extends TestCase
public function testReadConvertsStreamToString()
{
$pdo = new MockPdo('pgsql');
- $pdo->prepareResult = $this->getMockBuilder('PDOStatement')->getMock();
+ $pdo->prepareResult = $this->getMockBuilder(\PDOStatement::class)->getMock();
$content = 'foobar';
$stream = $this->createStream($content);
@@ -152,8 +152,8 @@ class PdoSessionHandlerTest extends TestCase
}
$pdo = new MockPdo('pgsql');
- $selectStmt = $this->getMockBuilder('PDOStatement')->getMock();
- $insertStmt = $this->getMockBuilder('PDOStatement')->getMock();
+ $selectStmt = $this->getMockBuilder(\PDOStatement::class)->getMock();
+ $insertStmt = $this->getMockBuilder(\PDOStatement::class)->getMock();
$pdo->prepareResult = function ($statement) use ($selectStmt, $insertStmt) {
return 0 === strpos($statement, 'INSERT') ? $insertStmt : $selectStmt;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php
index c5b4395031..e9471a5414 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php
@@ -18,7 +18,7 @@ class RedisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
{
public static function setUpBeforeClass(): void
{
- if (!class_exists('RedisCluster')) {
+ if (!class_exists(\RedisCluster::class)) {
self::markTestSkipped('The RedisCluster class is required.');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
index 6a0d16876e..1a632b248f 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
@@ -19,19 +19,19 @@ class StrictSessionHandlerTest extends TestCase
{
public function testOpen()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('open')
->with('path', 'name')->willReturn(true);
$proxy = new StrictSessionHandler($handler);
- $this->assertInstanceOf('SessionUpdateTimestampHandlerInterface', $proxy);
+ $this->assertInstanceOf(\SessionUpdateTimestampHandlerInterface::class, $proxy);
$this->assertInstanceOf(AbstractSessionHandler::class, $proxy);
$this->assertTrue($proxy->open('path', 'name'));
}
public function testCloseSession()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('close')
->willReturn(true);
$proxy = new StrictSessionHandler($handler);
@@ -41,7 +41,7 @@ class StrictSessionHandlerTest extends TestCase
public function testValidateIdOK()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('data');
$proxy = new StrictSessionHandler($handler);
@@ -51,7 +51,7 @@ class StrictSessionHandlerTest extends TestCase
public function testValidateIdKO()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('');
$proxy = new StrictSessionHandler($handler);
@@ -61,7 +61,7 @@ class StrictSessionHandlerTest extends TestCase
public function testRead()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('data');
$proxy = new StrictSessionHandler($handler);
@@ -71,7 +71,7 @@ class StrictSessionHandlerTest extends TestCase
public function testReadWithValidateIdOK()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('data');
$proxy = new StrictSessionHandler($handler);
@@ -82,7 +82,7 @@ class StrictSessionHandlerTest extends TestCase
public function testReadWithValidateIdMismatch()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->exactly(2))->method('read')
->withConsecutive(['id1'], ['id2'])
->will($this->onConsecutiveCalls('data1', 'data2'));
@@ -94,7 +94,7 @@ class StrictSessionHandlerTest extends TestCase
public function testUpdateTimestamp()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('write')
->with('id', 'data')->willReturn(true);
$proxy = new StrictSessionHandler($handler);
@@ -104,7 +104,7 @@ class StrictSessionHandlerTest extends TestCase
public function testWrite()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('write')
->with('id', 'data')->willReturn(true);
$proxy = new StrictSessionHandler($handler);
@@ -114,7 +114,7 @@ class StrictSessionHandlerTest extends TestCase
public function testWriteEmptyNewSession()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('');
$handler->expects($this->never())->method('write');
@@ -128,7 +128,7 @@ class StrictSessionHandlerTest extends TestCase
public function testWriteEmptyExistingSession()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('data');
$handler->expects($this->never())->method('write');
@@ -141,7 +141,7 @@ class StrictSessionHandlerTest extends TestCase
public function testDestroy()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('destroy')
->with('id')->willReturn(true);
$proxy = new StrictSessionHandler($handler);
@@ -151,7 +151,7 @@ class StrictSessionHandlerTest extends TestCase
public function testDestroyNewSession()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('');
$handler->expects($this->once())->method('destroy')->willReturn(true);
@@ -163,7 +163,7 @@ class StrictSessionHandlerTest extends TestCase
public function testDestroyNonEmptyNewSession()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('');
$handler->expects($this->once())->method('write')
@@ -179,7 +179,7 @@ class StrictSessionHandlerTest extends TestCase
public function testGc()
{
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $handler = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$handler->expects($this->once())->method('gc')
->with(123)->willReturn(true);
$proxy = new StrictSessionHandler($handler);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
index b99e71985b..2428e9fc24 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
@@ -123,7 +123,7 @@ class MockArraySessionStorageTest extends TestCase
public function testUnstartedSave()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->storage->save();
}
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
index 2ca81fed8f..3f994cb2a7 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
@@ -109,7 +109,7 @@ class MockFileSessionStorageTest extends TestCase
public function testSaveWithoutStart()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$storage1 = $this->getStorage();
$storage1->save();
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
index 4820a6593b..c500829811 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
@@ -83,7 +83,7 @@ class AbstractProxyTest extends TestCase
*/
public function testNameException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
session_start();
$this->proxy->setName('foo');
}
@@ -106,7 +106,7 @@ class AbstractProxyTest extends TestCase
*/
public function testIdException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
session_start();
$this->proxy->setId('foo');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
index 81c90433d7..96792fd128 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -36,7 +36,7 @@ class SessionHandlerProxyTest extends TestCase
protected function setUp(): void
{
- $this->mock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
+ $this->mock = $this->getMockBuilder(\SessionHandlerInterface::class)->getMock();
$this->proxy = new SessionHandlerProxy($this->mock);
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
index 6f04271856..4a58bca442 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
@@ -83,14 +83,14 @@ class StreamedResponseTest extends TestCase
public function testSendContentWithNonCallable()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$response = new StreamedResponse(null);
$response->sendContent();
}
public function testSetContent()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$response = new StreamedResponse(function () { echo 'foo'; });
$response->setContent('foo');
}
@@ -108,19 +108,19 @@ class StreamedResponseTest extends TestCase
{
$response = StreamedResponse::create(function () {}, 204);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response);
+ $this->assertInstanceOf(StreamedResponse::class, $response);
$this->assertEquals(204, $response->getStatusCode());
}
public function testReturnThis()
{
$response = new StreamedResponse(function () {});
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent());
+ $this->assertInstanceOf(StreamedResponse::class, $response->sendContent());
+ $this->assertInstanceOf(StreamedResponse::class, $response->sendContent());
$response = new StreamedResponse(function () {});
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
+ $this->assertInstanceOf(StreamedResponse::class, $response->sendHeaders());
+ $this->assertInstanceOf(StreamedResponse::class, $response->sendHeaders());
}
public function testSetNotModified()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php b/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php
index 9a750bd8a3..758b9c16a8 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php
@@ -59,7 +59,7 @@ class UrlHelperTest 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.');
}
@@ -74,7 +74,7 @@ class UrlHelperTest 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.');
}
@@ -117,7 +117,7 @@ class UrlHelperTest 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.');
}
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
index c3ca8ee520..bc334e1d81 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
@@ -50,7 +50,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
'php_version' => \PHP_VERSION,
'php_architecture' => \PHP_INT_SIZE * 8,
- 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
+ 'php_intl_locale' => class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
'php_timezone' => date_default_timezone_get(),
'xdebug_enabled' => \extension_loaded('xdebug'),
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 0eaa2c197c..c4fa66ee8d 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -696,7 +696,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
if ($this instanceof CompilerPassInterface) {
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
}
- if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
+ if (class_exists(\ProxyManager\Configuration::class) && class_exists(RuntimeInstantiator::class)) {
$container->setProxyInstantiator(new RuntimeInstantiator());
}
@@ -714,7 +714,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
// cache the container
$dumper = new PhpDumper($container);
- if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
+ if (class_exists(\ProxyManager\Configuration::class) && class_exists(ProxyDumper::class)) {
$dumper->setProxyDumper(new ProxyDumper());
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
index be03734dc4..0937eebcc4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
@@ -30,7 +30,7 @@ class BundleTest extends TestCase
public function testGetContainerExtensionWithInvalidClass()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$this->expectExceptionMessage('must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface');
$bundle = new ExtensionNotValidBundle();
$bundle->getContainerExtension();
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
index b97559e321..a0b4bd8c41 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
@@ -41,6 +41,6 @@ class ChainCacheClearerTest extends TestCase
protected function getMockClearer()
{
- return $this->getMockBuilder('Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface::class)->getMock();
}
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
index 6e0a47e930..c7c683428e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
@@ -39,7 +39,7 @@ class Psr6CacheClearerTest extends TestCase
public function testClearPoolThrowsExceptionOnUnreferencedPool()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cache pool not found: "unknown"');
(new Psr6CacheClearer())->clearPool('unknown');
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
index 4266c0a182..cf9493a295 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
@@ -70,7 +70,7 @@ class CacheWarmerAggregateTest extends TestCase
protected function getCacheWarmerMock()
{
- $warmer = $this->getMockBuilder('Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface')
+ $warmer = $this->getMockBuilder(\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface::class)
->disableOriginalConstructor()
->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
index eeb39e4dca..28b7bdee06 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
@@ -38,7 +38,7 @@ class CacheWarmerTest extends TestCase
public function testWriteNonWritableCacheFileThrowsARuntimeException()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$nonWritableFile = '/this/file/is/very/probably/not/writable';
$warmer = new TestCacheWarmer($nonWritableFile);
$warmer->warmUp(\dirname($nonWritableFile));
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php
index 4f85b0f351..efb7322efa 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php
@@ -55,7 +55,7 @@ class NotTaggedControllerValueResolverTest extends TestCase
public function testController()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
@@ -66,7 +66,7 @@ class NotTaggedControllerValueResolverTest extends TestCase
public function testControllerWithATrailingBackSlash()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
@@ -77,7 +77,7 @@ class NotTaggedControllerValueResolverTest extends TestCase
public function testControllerWithMethodNameStartUppercase()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
@@ -88,7 +88,7 @@ class NotTaggedControllerValueResolverTest extends TestCase
public function testControllerNameIsAnArray()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php
index 4036727bce..743eefa3e5 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php
@@ -107,7 +107,7 @@ class ServiceValueResolverTest extends TestCase
public function testErrorIsTruncated()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Cannot autowire argument $dummy of "Symfony\Component\HttpKernel\Tests\Controller\ArgumentResolver\DummyController::index()": it references class "Symfony\Component\HttpKernel\Tests\Controller\ArgumentResolver\DummyService" but no such service exists.');
$container = new ContainerBuilder();
$container->addCompilerPass(new RegisterControllerArgumentLocatorsPass());
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
index 2b635556e5..61d28c3cee 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
@@ -164,7 +164,7 @@ class ArgumentResolverTest extends TestCase
public function testGetVariadicArgumentsWithoutArrayInRequest()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$request = Request::create('/');
$request->attributes->set('foo', 'foo');
$request->attributes->set('bar', 'foo');
@@ -175,7 +175,7 @@ class ArgumentResolverTest extends TestCase
public function testGetArgumentWithoutArray()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$factory = new ArgumentMetadataFactory();
$valueResolver = $this->getMockBuilder(ArgumentValueResolverInterface::class)->getMock();
$resolver = new ArgumentResolver($factory, [$valueResolver]);
@@ -192,7 +192,7 @@ class ArgumentResolverTest extends TestCase
public function testIfExceptionIsThrownWhenMissingAnArgument()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$request = Request::create('/');
$controller = [$this, 'controllerWithFoo'];
@@ -251,7 +251,7 @@ class ArgumentResolverTest extends TestCase
public function testGetSessionMissMatchWithInterface()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$session = $this->getMockBuilder(SessionInterface::class)->getMock();
$request = Request::create('/');
$request->setSession($session);
@@ -262,7 +262,7 @@ class ArgumentResolverTest extends TestCase
public function testGetSessionMissMatchWithImplementation()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$session = new Session(new MockArraySessionStorage());
$request = Request::create('/');
$request->setSession($session);
@@ -273,7 +273,7 @@ class ArgumentResolverTest extends TestCase
public function testGetSessionMissMatchOnNull()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$request = Request::create('/');
$controller = [$this, 'controllerWithExtendingSession'];
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
index d394c3bce4..d822299ac7 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
@@ -158,7 +158,7 @@ class ContainerControllerResolverTest extends ControllerResolverTest
public function testExceptionWhenUsingRemovedControllerServiceWithClassNameAsName()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Controller "Symfony\Component\HttpKernel\Tests\Controller\ControllerTestService" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?');
$container = $this->getMockBuilder(Container::class)->getMock();
$container->expects($this->once())
@@ -182,7 +182,7 @@ class ContainerControllerResolverTest extends ControllerResolverTest
public function testExceptionWhenUsingRemovedControllerService()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Controller "app.my_controller" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?');
$container = $this->getMockBuilder(Container::class)->getMock();
$container->expects($this->once())
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
index de6dfc2546..834f925c43 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
@@ -20,7 +20,7 @@ class ControllerResolverTest extends TestCase
{
public function testGetControllerWithoutControllerParameter()
{
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$logger->expects($this->once())->method('warning')->with('Unable to look for the controller as the "_controller" parameter is missing.');
$resolver = $this->createControllerResolver($logger);
@@ -94,7 +94,7 @@ class ControllerResolverTest extends TestCase
public function testGetControllerOnObjectWithoutInvokeMethod()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$resolver = $this->createControllerResolver();
$request = Request::create('/');
diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
index 5ce4b1f76b..fef6cd0002 100644
--- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
@@ -34,7 +34,7 @@ class ArgumentMetadataTest extends TestCase
public function testDefaultValueUnavailable()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$argument = new ArgumentMetadata('foo', 'string', false, false, null, false);
$this->assertFalse($argument->isNullable());
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php
index 308a20127a..d6753cb31b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php
@@ -33,7 +33,7 @@ class ConfigDataCollectorTest extends TestCase
$this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', \PHP_VERSION);
$this->assertMatchesRegularExpression('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', \PHP_VERSION);
$this->assertSame(\PHP_INT_SIZE * 8, $c->getPhpArchitecture());
- $this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale());
+ $this->assertSame(class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale());
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
$this->assertSame(4 === Kernel::MINOR_VERSION, $c->isSymfonyLts());
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php
index de9364bb47..4204b8ef03 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php
@@ -24,7 +24,7 @@ class LoggerDataCollectorTest extends TestCase
public function testCollectWithUnexpectedFormat()
{
$logger = $this
- ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
+ ->getMockBuilder(DebugLoggerInterface::class)
->setMethods(['countErrors', 'getLogs', 'clear'])
->getMock();
$logger->expects($this->once())->method('countErrors')->willReturn(123);
@@ -91,7 +91,7 @@ class LoggerDataCollectorTest extends TestCase
public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount, $expectedScreamCount, $expectedPriorities = null)
{
$logger = $this
- ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
+ ->getMockBuilder(DebugLoggerInterface::class)
->setMethods(['countErrors', 'getLogs', 'clear'])
->getMock();
$logger->expects($this->once())->method('countErrors')->willReturn($nb);
@@ -123,7 +123,7 @@ class LoggerDataCollectorTest extends TestCase
public function testReset()
{
$logger = $this
- ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
+ ->getMockBuilder(DebugLoggerInterface::class)
->setMethods(['countErrors', 'getLogs', 'clear'])
->getMock();
$logger->expects($this->once())->method('clear');
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
index deda5c868d..9347073be2 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
@@ -42,12 +42,12 @@ class RequestDataCollectorTest extends TestCase
$attributes = $c->getRequestAttributes();
$this->assertSame('request', $c->getName());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestHeaders());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestServer());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestCookies());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $attributes);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestRequest());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestQuery());
+ $this->assertInstanceOf(ParameterBag::class, $c->getRequestHeaders());
+ $this->assertInstanceOf(ParameterBag::class, $c->getRequestServer());
+ $this->assertInstanceOf(ParameterBag::class, $c->getRequestCookies());
+ $this->assertInstanceOf(ParameterBag::class, $attributes);
+ $this->assertInstanceOf(ParameterBag::class, $c->getRequestRequest());
+ $this->assertInstanceOf(ParameterBag::class, $c->getRequestQuery());
$this->assertInstanceOf(ParameterBag::class, $c->getResponseCookies());
$this->assertSame('html', $c->getFormat());
$this->assertEquals('foobar', $c->getRoute());
@@ -57,7 +57,7 @@ class RequestDataCollectorTest extends TestCase
$this->assertContainsEquals(__FILE__, $attributes->get('resource'));
$this->assertSame('stdClass', $attributes->get('object')->getType());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getResponseHeaders());
+ $this->assertInstanceOf(ParameterBag::class, $c->getResponseHeaders());
$this->assertSame('OK', $c->getStatusText());
$this->assertSame(200, $c->getStatusCode());
$this->assertSame('application/json', $c->getContentType());
@@ -371,7 +371,7 @@ class RequestDataCollectorTest extends TestCase
*/
protected function injectController($collector, $controller, $request)
{
- $resolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface')->getMock();
+ $resolver = $this->getMockBuilder(\Symfony\Component\HttpKernel\Controller\ControllerResolverInterface::class)->getMock();
$httpKernel = new HttpKernel(new EventDispatcher(), $resolver, null, $this->getMockBuilder(ArgumentResolverInterface::class)->getMock());
$event = new ControllerEvent($httpKernel, $controller, $request, HttpKernelInterface::MASTER_REQUEST);
$collector->onKernelController($event);
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
index 9de9eb599a..ab231ac4c5 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
@@ -43,7 +43,7 @@ class TimeDataCollectorTest extends TestCase
$c->collect($request, new Response());
$this->assertEquals(0, $c->getStartTime());
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$kernel->expects($this->once())->method('getStartTime')->willReturn(123456.0);
$c = new TimeDataCollector($kernel);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
index 0fa6fcde51..da6fbeb435 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
@@ -45,7 +45,7 @@ class TraceableEventDispatcherTest extends TestCase
public function testStopwatchCheckControllerOnRequestEvent()
{
- $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')
+ $stopwatch = $this->getMockBuilder(Stopwatch::class)
->setMethods(['isStarted'])
->getMock();
$stopwatch->expects($this->once())
@@ -61,7 +61,7 @@ class TraceableEventDispatcherTest extends TestCase
public function testStopwatchStopControllerOnRequestEvent()
{
- $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')
+ $stopwatch = $this->getMockBuilder(Stopwatch::class)
->setMethods(['isStarted', 'stop'])
->getMock();
$stopwatch->expects($this->once())
@@ -110,9 +110,9 @@ class TraceableEventDispatcherTest extends TestCase
protected function getHttpKernel($dispatcher, $controller)
{
- $controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock();
+ $controllerResolver = $this->getMockBuilder(\Symfony\Component\HttpKernel\Controller\ControllerResolverInterface::class)->getMock();
$controllerResolver->expects($this->once())->method('getController')->willReturn($controller);
- $argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock();
+ $argumentResolver = $this->getMockBuilder(\Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface::class)->getMock();
$argumentResolver->expects($this->once())->method('getArguments')->willReturn([]);
return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver);
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
index 49567d40be..ab0efe32f5 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
@@ -29,7 +29,7 @@ class FragmentRendererPassTest extends TestCase
*/
public function testContentRendererWithoutInterface()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$builder = new ContainerBuilder();
$fragmentHandlerDefinition = $builder->register('fragment.handler');
$builder->register('my_content_renderer', 'Symfony\Component\DependencyInjection\Definition')
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php
index 39a1cb73b1..493178d470 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php
@@ -20,14 +20,14 @@ class LazyLoadingFragmentHandlerTest extends TestCase
{
public function testRender()
{
- $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock();
+ $renderer = $this->getMockBuilder(\Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface::class)->getMock();
$renderer->expects($this->once())->method('getName')->willReturn('foo');
$renderer->expects($this->any())->method('render')->willReturn(new Response());
- $requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
+ $requestStack = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestStack::class)->getMock();
$requestStack->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/'));
- $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
+ $container = $this->getMockBuilder(\Psr\Container\ContainerInterface::class)->getMock();
$container->expects($this->once())->method('has')->with('foo')->willReturn(true);
$container->expects($this->once())->method('get')->willReturn($renderer);
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
index 9dbc2b08a4..b28f90d362 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
@@ -57,7 +57,7 @@ class ResettableServicePassTest extends TestCase
public function testMissingMethod()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Tag "kernel.reset" requires the "method" attribute to be set.');
$container = new ContainerBuilder();
$container->register(ResettableService::class)
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
index da8dc6fb0b..6c4459fc2a 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
@@ -41,7 +41,7 @@ class AddRequestFormatsListenerTest extends TestCase
public function testIsAnEventSubscriber()
{
- $this->assertInstanceOf('Symfony\Component\EventDispatcher\EventSubscriberInterface', $this->listener);
+ $this->assertInstanceOf(\Symfony\Component\EventDispatcher\EventSubscriberInterface::class, $this->listener);
}
public function testRegisteredEvent()
@@ -66,7 +66,7 @@ class AddRequestFormatsListenerTest extends TestCase
protected function getRequestMock()
{
- return $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ return $this->getMockBuilder(Request::class)->getMock();
}
protected function getRequestEventMock(Request $request)
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php
index 12df187571..7663fb2946 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php
@@ -36,7 +36,7 @@ class DebugHandlersListenerTest extends TestCase
{
public function testConfigure()
{
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$userHandler = function () {};
$listener = new DebugHandlersListener($userHandler, $logger);
$eHandler = new ErrorHandler();
@@ -68,7 +68,7 @@ class DebugHandlersListenerTest extends TestCase
$listener = new DebugHandlersListener(null);
$eHandler = new ErrorHandler();
$event = new KernelEvent(
- $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(),
+ $this->getMockBuilder(HttpKernelInterface::class)->getMock(),
Request::create('/'),
HttpKernelInterface::MASTER_REQUEST
);
@@ -92,7 +92,7 @@ class DebugHandlersListenerTest extends TestCase
{
$dispatcher = new EventDispatcher();
$listener = new DebugHandlersListener(null);
- $app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock();
+ $app = $this->getMockBuilder(Application::class)->getMock();
$app->expects($this->once())->method('getHelperSet')->willReturn(new HelperSet());
$command = new Command(__FUNCTION__);
$command->setApplication($app);
@@ -122,7 +122,7 @@ class DebugHandlersListenerTest extends TestCase
}
$xHandler = $eHandler->setExceptionHandler('var_dump');
- $this->assertInstanceOf('Closure', $xHandler);
+ $this->assertInstanceOf(\Closure::class, $xHandler);
$app->expects($this->once())
->method(method_exists(Application::class, 'renderThrowable') ? 'renderThrowable' : 'renderException');
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php
index 408b580630..a11361419c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php
@@ -99,7 +99,7 @@ class ErrorListenerTest extends TestCase
public function provider()
{
- if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
+ if (!class_exists(Request::class)) {
return [[null, null]];
}
@@ -115,9 +115,9 @@ class ErrorListenerTest extends TestCase
public function testSubRequestFormat()
{
- $listener = new ErrorListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock());
+ $listener = new ErrorListener('foo', $this->getMockBuilder(LoggerInterface::class)->getMock());
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
return new Response($request->getRequestFormat());
});
@@ -135,12 +135,12 @@ class ErrorListenerTest extends TestCase
public function testCSPHeaderIsRemoved()
{
$dispatcher = new EventDispatcher();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
return new Response($request->getRequestFormat());
});
- $listener = new ErrorListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true);
+ $listener = new ErrorListener('foo', $this->getMockBuilder(LoggerInterface::class)->getMock(), true);
$dispatcher->addSubscriber($listener);
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
index 5b045a8fc4..e0b857debd 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
@@ -52,7 +52,7 @@ class FragmentListenerTest extends TestCase
public function testAccessDeniedWithNonSafeMethods()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException::class);
$request = Request::create('http://example.com/_fragment', 'POST');
$listener = new FragmentListener(new UriSigner('foo'));
@@ -63,7 +63,7 @@ class FragmentListenerTest extends TestCase
public function testAccessDeniedWithWrongSignature()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException::class);
$request = Request::create('http://example.com/_fragment', 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']);
$listener = new FragmentListener(new UriSigner('foo'));
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php
index 0064429048..0d14e5a987 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php
@@ -110,7 +110,7 @@ class LocaleAwareListenerTest extends TestCase
private function createHttpKernel()
{
- return $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ return $this->getMockBuilder(HttpKernelInterface::class)->getMock();
}
private function createRequest($locale)
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
index cb502a89ee..705600d70e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
@@ -26,7 +26,7 @@ class LocaleListenerTest extends TestCase
protected function setUp(): void
{
- $this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock();
+ $this->requestStack = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestStack::class)->disableOriginalConstructor()->getMock();
}
public function testIsAnEventSubscriber()
@@ -70,10 +70,10 @@ class LocaleListenerTest extends TestCase
public function testLocaleSetForRoutingContext()
{
// the request context is updated
- $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock();
+ $context = $this->getMockBuilder(\Symfony\Component\Routing\RequestContext::class)->getMock();
$context->expects($this->once())->method('setParameter')->with('_locale', 'es');
- $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
+ $router = $this->getMockBuilder(\Symfony\Component\Routing\Router::class)->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
$router->expects($this->once())->method('getContext')->willReturn($context);
$request = Request::create('/');
@@ -86,10 +86,10 @@ class LocaleListenerTest extends TestCase
public function testRouterResetWithParentRequestOnKernelFinishRequest()
{
// the request context is updated
- $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock();
+ $context = $this->getMockBuilder(\Symfony\Component\Routing\RequestContext::class)->getMock();
$context->expects($this->once())->method('setParameter')->with('_locale', 'es');
- $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
+ $router = $this->getMockBuilder(\Symfony\Component\Routing\Router::class)->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
$router->expects($this->once())->method('getContext')->willReturn($context);
$parentRequest = Request::create('/');
@@ -116,6 +116,6 @@ class LocaleListenerTest extends TestCase
private function getEvent(Request $request): RequestEvent
{
- return new RequestEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST);
+ return new RequestEvent($this->getMockBuilder(HttpKernelInterface::class)->getMock(), $request, HttpKernelInterface::MASTER_REQUEST);
}
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php
index 3aaff12316..4b076ef17d 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php
@@ -30,7 +30,7 @@ class ProfilerListenerTest extends TestCase
{
$profile = new Profile('token');
- $profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler')
+ $profiler = $this->getMockBuilder(\Symfony\Component\HttpKernel\Profiler\Profiler::class)
->disableOriginalConstructor()
->getMock();
@@ -38,17 +38,17 @@ class ProfilerListenerTest extends TestCase
->method('collect')
->willReturn($profile);
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernelInterface::class)->getMock();
- $masterRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')
+ $masterRequest = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)
->disableOriginalConstructor()
->getMock();
- $subRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')
+ $subRequest = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)
->disableOriginalConstructor()
->getMock();
- $response = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response')
+ $response = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Response::class)
->disableOriginalConstructor()
->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
index 1aaa64bc89..31cfa38477 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
@@ -32,7 +32,7 @@ class ResponseListenerTest extends TestCase
$listener = new ResponseListener('UTF-8');
$this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']);
- $this->kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $this->kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
}
protected function tearDown(): void
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
index 2c1e7721b4..59e63deea8 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
@@ -33,7 +33,7 @@ class RouterListenerTest extends TestCase
protected function setUp(): void
{
- $this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock();
+ $this->requestStack = $this->getMockBuilder(RequestStack::class)->disableOriginalConstructor()->getMock();
}
/**
@@ -41,7 +41,7 @@ class RouterListenerTest extends TestCase
*/
public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHttpPort, $expectedHttpsPort)
{
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\UrlMatcherInterface::class)
->disableOriginalConstructor()
->getMock();
$context = new RequestContext();
@@ -81,7 +81,7 @@ class RouterListenerTest extends TestCase
public function testInvalidMatcher()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new RouterListener(new \stdClass(), $this->requestStack);
}
@@ -91,10 +91,10 @@ class RouterListenerTest extends TestCase
$request = Request::create('http://localhost/');
$event = new RequestEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
- $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$requestMatcher->expects($this->once())
->method('matchRequest')
- ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request'))
+ ->with($this->isInstanceOf(Request::class))
->willReturn([]);
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
@@ -107,10 +107,10 @@ class RouterListenerTest extends TestCase
$request = Request::create('http://localhost/', 'post');
$event = new RequestEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
- $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$requestMatcher->expects($this->any())
->method('matchRequest')
- ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request'))
+ ->with($this->isInstanceOf(Request::class))
->willReturn([]);
$context = new RequestContext();
@@ -133,12 +133,12 @@ class RouterListenerTest extends TestCase
*/
public function testLoggingParameter($parameter, $log, $parameters)
{
- $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$requestMatcher->expects($this->once())
->method('matchRequest')
->willReturn($parameter);
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger->expects($this->once())
->method('info')
->with($this->equalTo($log), $this->equalTo($parameters));
@@ -162,7 +162,7 @@ class RouterListenerTest extends TestCase
{
$requestStack = new RequestStack();
- $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$requestMatcher->expects($this->never())->method('matchRequest');
$dispatcher = new EventDispatcher();
@@ -184,7 +184,7 @@ class RouterListenerTest extends TestCase
{
$requestStack = new RequestStack();
- $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$requestMatcher
->expects($this->once())
->method('matchRequest')
@@ -204,12 +204,12 @@ class RouterListenerTest extends TestCase
public function testRequestWithBadHost()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$request = Request::create('http://bad host %22/');
$event = new RequestEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
- $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
$listener->onKernelRequest($event);
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/SurrogateListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/SurrogateListenerTest.php
index fc51de252e..e4b8b2d558 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/SurrogateListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/SurrogateListenerTest.php
@@ -26,7 +26,7 @@ class SurrogateListenerTest extends TestCase
public function testFilterDoesNothingForSubRequests()
{
$dispatcher = new EventDispatcher();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$response = new Response('foo
');
$listener = new SurrogateListener(new Esi());
@@ -40,7 +40,7 @@ class SurrogateListenerTest extends TestCase
public function testFilterWhenThereIsSomeEsiIncludes()
{
$dispatcher = new EventDispatcher();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$response = new Response('foo
');
$listener = new SurrogateListener(new Esi());
@@ -54,7 +54,7 @@ class SurrogateListenerTest extends TestCase
public function testFilterWhenThereIsNoEsiIncludes()
{
$dispatcher = new EventDispatcher();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$response = new Response('foo');
$listener = new SurrogateListener(new Esi());
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
index 1d9ea37977..e0a5cc69da 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
@@ -42,7 +42,7 @@ class TestSessionListenerTest extends TestCase
protected function setUp(): void
{
- $this->listener = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener');
+ $this->listener = $this->getMockForAbstractClass(\Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener::class);
$this->session = $this->getSession();
$this->listener->expects($this->any())
->method('getSession')
@@ -209,7 +209,7 @@ class TestSessionListenerTest extends TestCase
private function getSession()
{
- $mock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')
+ $mock = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\Session::class)
->disableOriginalConstructor()
->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
index 7cec68143b..96b686d91b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
@@ -28,9 +28,9 @@ class ValidateRequestListenerTest extends TestCase
public function testListenerThrowsWhenMasterRequestHasInconsistentClientIps()
{
- $this->expectException('Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException');
+ $this->expectException(\Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException::class);
$dispatcher = new EventDispatcher();
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$request = new Request();
$request->setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
index df74ade154..c9af77149c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
@@ -67,7 +67,7 @@ class EsiFragmentRendererTest extends TestCase
public function testRenderControllerReferenceWithoutSignerThrowsException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy());
$request = Request::create('/');
@@ -79,7 +79,7 @@ class EsiFragmentRendererTest extends TestCase
public function testRenderAltControllerReferenceWithoutSignerThrowsException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy());
$request = Request::create('/');
@@ -91,7 +91,7 @@ class EsiFragmentRendererTest extends TestCase
private function getInlineStrategy($called = false)
{
- $inline = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer')->disableOriginalConstructor()->getMock();
+ $inline = $this->getMockBuilder(\Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer::class)->disableOriginalConstructor()->getMock();
if ($called) {
$inline->expects($this->once())->method('render');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
index a064a76c7d..c25297dbe4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
@@ -71,7 +71,7 @@ class InlineFragmentRendererTest extends TestCase
public function testRenderExceptionNoIgnoreErrors()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
$dispatcher->expects($this->never())->method('dispatch');
@@ -106,7 +106,7 @@ class InlineFragmentRendererTest extends TestCase
private function getKernel($returnValue)
{
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernelInterface::class)->getMock();
$kernel
->expects($this->any())
->method('handle')
@@ -118,7 +118,7 @@ class InlineFragmentRendererTest extends TestCase
public function testExceptionInSubRequestsDoesNotMangleOutputBuffers()
{
- $controllerResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface')->getMock();
+ $controllerResolver = $this->getMockBuilder(\Symfony\Component\HttpKernel\Controller\ControllerResolverInterface::class)->getMock();
$controllerResolver
->expects($this->once())
->method('getController')
@@ -129,7 +129,7 @@ class InlineFragmentRendererTest extends TestCase
})
;
- $argumentResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface')->getMock();
+ $argumentResolver = $this->getMockBuilder(\Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface::class)->getMock();
$argumentResolver
->expects($this->once())
->method('getArguments')
@@ -258,7 +258,7 @@ class InlineFragmentRendererTest extends TestCase
*/
private function getKernelExpectingRequest(Request $request, $strict = false)
{
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernelInterface::class)->getMock();
$kernel
->expects($this->once())
->method('handle')
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
index 151adb0e97..5980284afe 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
@@ -60,7 +60,7 @@ class RoutableFragmentRendererTest extends TestCase
*/
public function testGenerateFragmentUriWithNonScalar($controller)
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$this->callGenerateFragmentUriMethod($controller, Request::create('/'));
}
@@ -74,7 +74,7 @@ class RoutableFragmentRendererTest extends TestCase
private function callGenerateFragmentUriMethod(ControllerReference $reference, Request $request, $absolute = false)
{
- $renderer = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\Fragment\RoutableFragmentRenderer');
+ $renderer = $this->getMockForAbstractClass(\Symfony\Component\HttpKernel\Fragment\RoutableFragmentRenderer::class);
$r = new \ReflectionObject($renderer);
$m = $r->getMethod('generateFragmentUri');
$m->setAccessible(true);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
index df30e67727..db203f91de 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
@@ -58,7 +58,7 @@ class SsiFragmentRendererTest extends TestCase
public function testRenderControllerReferenceWithoutSignerThrowsException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy());
$request = Request::create('/');
@@ -70,7 +70,7 @@ class SsiFragmentRendererTest extends TestCase
public function testRenderAltControllerReferenceWithoutSignerThrowsException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy());
$request = Request::create('/');
@@ -82,7 +82,7 @@ class SsiFragmentRendererTest extends TestCase
private function getInlineStrategy($called = false)
{
- $inline = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer')->disableOriginalConstructor()->getMock();
+ $inline = $this->getMockBuilder(\Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer::class)->disableOriginalConstructor()->getMock();
if ($called) {
$inline->expects($this->once())->method('render');
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
index cdf729e331..5246721a64 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
@@ -155,7 +155,7 @@ class EsiTest extends TestCase
public function testProcessWhenNoSrcInAnEsi()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$esi = new Esi();
$request = Request::create('/');
@@ -193,7 +193,7 @@ class EsiTest extends TestCase
public function testHandleWhenResponseIsNot200()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$esi = new Esi();
$response = new Response('foo');
$response->setStatusCode(404);
@@ -222,7 +222,7 @@ class EsiTest extends TestCase
protected function getCache($request, $response)
{
- $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();
+ $cache = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpCache\HttpCache::class)->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();
$cache->expects($this->any())
->method('getRequest')
->willReturn($request)
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
index 0f0a25ef1c..3193b954be 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
@@ -25,7 +25,7 @@ class HttpCacheTest extends HttpCacheTestCase
{
public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
{
- $storeMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface')
+ $storeMock = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpCache\StoreInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -37,7 +37,7 @@ class HttpCacheTest extends HttpCacheTestCase
$this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');
// implements TerminableInterface
- $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel')
+ $kernelMock = $this->getMockBuilder(\Symfony\Component\HttpKernel\Kernel::class)
->disableOriginalConstructor()
->setMethods(['terminate', 'registerBundles', 'registerContainerConfiguration'])
->getMock();
@@ -1488,8 +1488,8 @@ class HttpCacheTest extends HttpCacheTestCase
public function testUsesOriginalRequestForSurrogate()
{
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
- $store = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\StoreInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
+ $store = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpCache\StoreInterface::class)->getMock();
$kernel
->expects($this->exactly(2))
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
index 3d68052cdc..23c7410a28 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
@@ -122,7 +122,7 @@ class SsiTest extends TestCase
public function testProcessWhenNoSrcInAnSsi()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$ssi = new Ssi();
$request = Request::create('/');
@@ -160,7 +160,7 @@ class SsiTest extends TestCase
public function testHandleWhenResponseIsNot200()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$ssi = new Ssi();
$response = new Response('foo');
$response->setStatusCode(404);
@@ -189,7 +189,7 @@ class SsiTest extends TestCase
protected function getCache($request, $response)
{
- $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();
+ $cache = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpCache\HttpCache::class)->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();
$cache->expects($this->any())
->method('getRequest')
->willReturn($request)
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
index fc1ef64663..da1f649127 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
@@ -157,7 +157,7 @@ class StoreTest extends TestCase
$response = $this->store->lookup($this->request);
$this->assertNotNull($response);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
+ $this->assertInstanceOf(Response::class, $response);
}
public function testDoesNotFindAnEntryWithLookupWhenNoneExists()
@@ -206,7 +206,7 @@ class StoreTest extends TestCase
$this->storeSimpleEntry();
$this->store->invalidate($this->request);
$response = $this->store->lookup($this->request);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
+ $this->assertInstanceOf(Response::class, $response);
$this->assertFalse($response->isFresh());
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php
index b64924745b..f8fa84dbba 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php
@@ -30,10 +30,10 @@ class HttpKernelBrowserTest extends TestCase
$client->request('GET', '/');
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
- $this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Request', $client->getRequest());
- $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getInternalResponse());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $client->getResponse());
+ $this->assertInstanceOf(\Symfony\Component\BrowserKit\Request::class, $client->getInternalRequest());
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\Request::class, $client->getRequest());
+ $this->assertInstanceOf(\Symfony\Component\BrowserKit\Response::class, $client->getInternalResponse());
+ $this->assertInstanceOf(Response::class, $client->getResponse());
$client->request('GET', 'http://www.example.com/');
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
@@ -148,7 +148,7 @@ class HttpKernelBrowserTest extends TestCase
$client = new HttpKernelBrowser($kernel);
$file = $this
- ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
+ ->getMockBuilder(UploadedFile::class)
->setConstructorArgs([$source, 'original', 'mime/original', \UPLOAD_ERR_OK, true])
->setMethods(['getSize', 'getClientSize'])
->getMock()
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
index b1d225b84e..50b14e9dd4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
@@ -32,7 +32,7 @@ class HttpKernelTest extends TestCase
{
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); });
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
@@ -40,7 +40,7 @@ class HttpKernelTest extends TestCase
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); });
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false);
@@ -157,7 +157,7 @@ class HttpKernelTest extends TestCase
public function testHandleWhenNoControllerIsFound()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\NotFoundHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
$dispatcher = new EventDispatcher();
$kernel = $this->getHttpKernel($dispatcher, false);
@@ -304,7 +304,7 @@ class HttpKernelTest extends TestCase
{
$request = new Request();
- $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(['push', 'pop'])->getMock();
+ $stack = $this->getMockBuilder(RequestStack::class)->setMethods(['push', 'pop'])->getMock();
$stack->expects($this->once())->method('push')->with($this->equalTo($request));
$stack->expects($this->once())->method('pop');
@@ -316,7 +316,7 @@ class HttpKernelTest extends TestCase
public function testInconsistentClientIpsOnMasterRequests()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$request = new Request();
$request->setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED);
$request->server->set('REMOTE_ADDR', '1.1.1.1');
diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
index 038f73230e..37b990f360 100644
--- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
@@ -66,7 +66,7 @@ class KernelTest extends TestCase
public function testClassNameValidityGetter()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The environment "test.env" contains invalid characters, it can only contain characters allowed in PHP class names.');
// We check the classname that will be generated by using a $env that
// contains invalid characters.
@@ -112,7 +112,7 @@ class KernelTest extends TestCase
public function testBootSetsTheContainerToTheBundles()
{
- $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
+ $bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\Bundle::class)->getMock();
$bundle->expects($this->once())
->method('setContainer');
@@ -154,7 +154,7 @@ class KernelTest extends TestCase
public function testShutdownCallsShutdownOnAllBundles()
{
- $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
+ $bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\Bundle::class)->getMock();
$bundle->expects($this->once())
->method('shutdown');
@@ -166,7 +166,7 @@ class KernelTest extends TestCase
public function testShutdownGivesNullContainerToAllBundles()
{
- $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
+ $bundle = $this->getMockBuilder(\Symfony\Component\HttpKernel\Bundle\Bundle::class)->getMock();
$bundle->expects($this->exactly(2))
->method('setContainer')
->withConsecutive(
@@ -189,7 +189,7 @@ class KernelTest extends TestCase
$catch = true;
$request = new Request();
- $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
+ $httpKernelMock = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernel::class)
->disableOriginalConstructor()
->getMock();
$httpKernelMock
@@ -211,7 +211,7 @@ class KernelTest extends TestCase
$catch = true;
$request = new Request();
- $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
+ $httpKernelMock = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernel::class)
->disableOriginalConstructor()
->getMock();
@@ -338,25 +338,25 @@ EOF
public function testLocateResourceThrowsExceptionWhenNameIsNotValid()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->getKernel()->locateResource('Foo');
}
public function testLocateResourceThrowsExceptionWhenNameIsUnsafe()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->getKernel()->locateResource('@FooBundle/../bar');
}
public function testLocateResourceThrowsExceptionWhenBundleDoesNotExist()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->getKernel()->locateResource('@FooBundle/config/routing.xml');
}
public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$kernel = $this->getKernel(['getBundle']);
$kernel
->expects($this->once())
@@ -400,7 +400,7 @@ EOF
public function testInitializeBundleThrowsExceptionWhenRegisteringTwoBundlesWithTheSameName()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$this->expectExceptionMessage('Trying to register two bundles with the same name "DuplicateName"');
$fooBundle = $this->getBundle(__DIR__.'/Fixtures/FooBundle', null, 'FooBundle', 'DuplicateName');
$barBundle = $this->getBundle(__DIR__.'/Fixtures/BarBundle', null, 'BarBundle', 'DuplicateName');
@@ -434,7 +434,7 @@ EOF
$this->assertFalse($httpKernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');
// implements TerminableInterface
- $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
+ $httpKernelMock = $this->getMockBuilder(\Symfony\Component\HttpKernel\HttpKernel::class)
->disableOriginalConstructor()
->setMethods(['terminate'])
->getMock();
@@ -613,7 +613,7 @@ EOF
protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null): BundleInterface
{
$bundle = $this
- ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')
+ ->getMockBuilder(BundleInterface::class)
->setMethods(['getPath', 'getName'])
->disableOriginalConstructor()
;
diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
index 607ab31cb8..fb2b43cc82 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
@@ -109,19 +109,19 @@ class LoggerTest extends TestCase
public function testThrowsOnInvalidLevel()
{
- $this->expectException('Psr\Log\InvalidArgumentException');
+ $this->expectException(\Psr\Log\InvalidArgumentException::class);
$this->logger->log('invalid level', 'Foo');
}
public function testThrowsOnInvalidMinLevel()
{
- $this->expectException('Psr\Log\InvalidArgumentException');
+ $this->expectException(\Psr\Log\InvalidArgumentException::class);
new Logger('invalid');
}
public function testInvalidOutput()
{
- $this->expectException('Psr\Log\InvalidArgumentException');
+ $this->expectException(\Psr\Log\InvalidArgumentException::class);
new Logger(LogLevel::DEBUG, '/');
}
diff --git a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
index 29067f558b..ccf410c447 100644
--- a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
+++ b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
@@ -22,20 +22,20 @@ class CollatorTest extends AbstractCollatorTest
{
public function testConstructorWithUnsupportedLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$this->getCollator('pt_BR');
}
public function testCompare()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(MethodNotImplementedException::class);
$collator = $this->getCollator('en');
$collator->compare('a', 'b');
}
public function testGetAttribute()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(MethodNotImplementedException::class);
$collator = $this->getCollator('en');
$collator->getAttribute(Collator::NUMERIC_COLLATION);
}
@@ -80,14 +80,14 @@ class CollatorTest extends AbstractCollatorTest
public function testSetAttribute()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(MethodNotImplementedException::class);
$collator = $this->getCollator('en');
$collator->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON);
}
public function testSetStrength()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(MethodNotImplementedException::class);
$collator = $this->getCollator('en');
$collator->setStrength(Collator::PRIMARY);
}
diff --git a/src/Symfony/Component/Intl/Tests/CountriesTest.php b/src/Symfony/Component/Intl/Tests/CountriesTest.php
index a6d38c7c8a..995072b0a4 100644
--- a/src/Symfony/Component/Intl/Tests/CountriesTest.php
+++ b/src/Symfony/Component/Intl/Tests/CountriesTest.php
@@ -592,7 +592,7 @@ class CountriesTest extends ResourceBundleTestCase
public function testGetNameWithInvalidCountryCode()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Countries::getName('foo');
}
diff --git a/src/Symfony/Component/Intl/Tests/CurrenciesTest.php b/src/Symfony/Component/Intl/Tests/CurrenciesTest.php
index 3d1f7ea7f4..3edd7daa6b 100644
--- a/src/Symfony/Component/Intl/Tests/CurrenciesTest.php
+++ b/src/Symfony/Component/Intl/Tests/CurrenciesTest.php
@@ -725,7 +725,7 @@ class CurrenciesTest extends ResourceBundleTestCase
*/
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
Currencies::getNumericCode($currency);
}
@@ -770,13 +770,13 @@ class CurrenciesTest extends ResourceBundleTestCase
*/
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
Currencies::forNumericCode($currency);
}
public function testGetNameWithInvalidCurrencyCode()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
Currencies::getName('foo');
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
index 3624295353..ec159fb786 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
@@ -64,7 +64,7 @@ class BundleEntryReaderTest extends TestCase
protected function setUp(): void
{
- $this->readerImpl = $this->getMockBuilder('Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface')->getMock();
+ $this->readerImpl = $this->getMockBuilder(\Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface::class)->getMock();
$this->reader = new BundleEntryReader($this->readerImpl);
}
@@ -103,7 +103,7 @@ class BundleEntryReaderTest extends TestCase
public function testReadNonExistingEntry()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
$this->readerImpl->expects($this->once())
->method('read')
->with(self::RES_DIR, 'root')
@@ -127,7 +127,7 @@ class BundleEntryReaderTest extends TestCase
public function testDontFallbackIfEntryDoesNotExistAndFallbackDisabled()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
$this->readerImpl->expects($this->once())
->method('read')
->with(self::RES_DIR, 'en_GB')
@@ -154,7 +154,7 @@ class BundleEntryReaderTest extends TestCase
public function testDontFallbackIfLocaleDoesNotExistAndFallbackDisabled()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
$this->readerImpl->expects($this->once())
->method('read')
->with(self::RES_DIR, 'en_GB')
@@ -279,7 +279,7 @@ class BundleEntryReaderTest extends TestCase
public function testFailIfEntryFoundNeitherInParentNorChild()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
$this->readerImpl
->method('read')
->withConsecutive(
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
index 24ac5ee1af..2f04e68024 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
@@ -75,19 +75,19 @@ class IntlBundleReaderTest extends TestCase
public function testReadFailsIfNonExistingLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
+ $this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
$this->reader->read(__DIR__.'/Fixtures/res', 'foo');
}
public function testReadFailsIfNonExistingFallbackLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
+ $this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
$this->reader->read(__DIR__.'/Fixtures/res', 'ro_AT');
}
public function testReadFailsIfNonExistingDirectory()
{
- $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
$this->reader->read(__DIR__.'/foo', 'ro');
}
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
index faf129cd4d..3fdef2b664 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -40,31 +40,31 @@ class JsonBundleReaderTest extends TestCase
public function testReadFailsIfNonExistingLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
+ $this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
$this->reader->read(__DIR__.'/Fixtures/json', 'foo');
}
public function testReadFailsIfNonExistingDirectory()
{
- $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
$this->reader->read(__DIR__.'/foo', 'en');
}
public function testReadFailsIfNotAFile()
{
- $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
}
public function testReadFailsIfInvalidJson()
{
- $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
$this->reader->read(__DIR__.'/Fixtures/json', 'en_Invalid');
}
public function testReaderDoesNotBreakOutOfGivenPath()
{
- $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
+ $this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
$this->reader->read(__DIR__.'/Fixtures/json', '../invalid_directory/en');
}
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
index 0cc1001651..f4e020f075 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -40,25 +40,25 @@ class PhpBundleReaderTest extends TestCase
public function testReadFailsIfNonExistingLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
+ $this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
$this->reader->read(__DIR__.'/Fixtures/php', 'foo');
}
public function testReadFailsIfNonExistingDirectory()
{
- $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
$this->reader->read(__DIR__.'/foo', 'en');
}
public function testReadFailsIfNotAFile()
{
- $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
}
public function testReaderDoesNotBreakOutOfGivenPath()
{
- $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
+ $this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
$this->reader->read(__DIR__.'/Fixtures/php', '../invalid_directory/en');
}
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
index f653503dbf..3709ce17cd 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
@@ -54,7 +54,7 @@ class RingBufferTest extends TestCase
public function testReadNonExistingFails()
{
- $this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
+ $this->expectException(\Symfony\Component\Intl\Exception\OutOfBoundsException::class);
$this->buffer['foo'];
}
@@ -72,7 +72,7 @@ class RingBufferTest extends TestCase
public function testReadOverwrittenFails()
{
- $this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
+ $this->expectException(\Symfony\Component\Intl\Exception\OutOfBoundsException::class);
$this->buffer[0] = 'foo';
$this->buffer['bar'] = 'baz';
$this->buffer[2] = 'bam';
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
index 34414b1f74..2a83a88ac2 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
@@ -39,7 +39,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
public function testConstructorWithUnsupportedLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$this->getDateFormatter('pt_BR', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
}
@@ -69,7 +69,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
try {
$formatter->format($localtime);
} catch (\Exception $e) {
- $this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e);
+ $this->assertInstanceOf(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class, $e);
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
}
@@ -77,7 +77,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
public function testFormatWithUnimplementedChars()
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
$pattern = 'Y';
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, $pattern);
$formatter->format(0);
@@ -85,7 +85,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
public function testFormatWithNonIntegerTimestamp()
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
$formatter = $this->getDefaultDateFormatter();
$formatter->format([]);
}
@@ -110,14 +110,14 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
public function testLocaltime()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getDefaultDateFormatter();
$formatter->localtime('Wednesday, December 31, 1969 4:00:00 PM PT');
}
public function testParseWithNotNullPositionValue()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException::class);
$position = 0;
$formatter = $this->getDefaultDateFormatter('y');
$this->assertSame(0, $formatter->parse('1970', $position));
@@ -125,27 +125,27 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
public function testSetCalendar()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getDefaultDateFormatter();
$formatter->setCalendar(IntlDateFormatter::GREGORIAN);
}
public function testSetLenient()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$formatter = $this->getDefaultDateFormatter();
$formatter->setLenient(true);
}
public function testFormatWithGmtTimeZoneAndMinutesOffset()
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
parent::testFormatWithGmtTimeZoneAndMinutesOffset();
}
public function testFormatWithNonStandardTimezone()
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
parent::testFormatWithNonStandardTimezone();
}
diff --git a/src/Symfony/Component/Intl/Tests/LanguagesTest.php b/src/Symfony/Component/Intl/Tests/LanguagesTest.php
index 1a44190691..9dfaf72609 100644
--- a/src/Symfony/Component/Intl/Tests/LanguagesTest.php
+++ b/src/Symfony/Component/Intl/Tests/LanguagesTest.php
@@ -1690,13 +1690,13 @@ class LanguagesTest extends ResourceBundleTestCase
*/
public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($language)
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Languages::getAlpha3Code($language);
}
public function testGetNameWithInvalidLanguageCode()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Languages::getName('foo');
}
@@ -1740,7 +1740,7 @@ class LanguagesTest extends ResourceBundleTestCase
*/
public function testGetAlpha2CodeFailsIfNoAlpha2Equivalent($language)
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Languages::getAlpha2Code($language);
}
diff --git a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
index a2c3346a8d..cb21146953 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
@@ -17,7 +17,7 @@ class LocaleTest extends AbstractLocaleTest
{
public function testAcceptFromHttp()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('acceptFromHttp', 'pt-br,en-us;q=0.7,en;q=0.5');
}
@@ -34,7 +34,7 @@ class LocaleTest extends AbstractLocaleTest
public function testComposeLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$subtags = [
'language' => 'pt',
'script' => 'Latn',
@@ -45,73 +45,73 @@ class LocaleTest extends AbstractLocaleTest
public function testFilterMatches()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('filterMatches', 'pt-BR', 'pt-BR');
}
public function testGetAllVariants()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getAllVariants', 'pt_BR_Latn');
}
public function testGetDisplayLanguage()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getDisplayLanguage', 'pt-Latn-BR', 'en');
}
public function testGetDisplayName()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getDisplayName', 'pt-Latn-BR', 'en');
}
public function testGetDisplayRegion()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getDisplayRegion', 'pt-Latn-BR', 'en');
}
public function testGetDisplayScript()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getDisplayScript', 'pt-Latn-BR', 'en');
}
public function testGetDisplayVariant()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getDisplayVariant', 'pt-Latn-BR', 'en');
}
public function testGetKeywords()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getKeywords', 'pt-BR@currency=BRL');
}
public function testGetPrimaryLanguage()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getPrimaryLanguage', 'pt-Latn-BR');
}
public function testGetRegion()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getRegion', 'pt-Latn-BR');
}
public function testGetScript()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('getScript', 'pt-Latn-BR');
}
public function testLookup()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$langtag = [
'pt-Latn-BR',
'pt-BR',
@@ -121,13 +121,13 @@ class LocaleTest extends AbstractLocaleTest
public function testParseLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('parseLocale', 'pt-Latn-BR');
}
public function testSetDefault()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$this->call('setDefault', 'pt_BR');
}
diff --git a/src/Symfony/Component/Intl/Tests/LocalesTest.php b/src/Symfony/Component/Intl/Tests/LocalesTest.php
index ff53e72b52..c351e7ac82 100644
--- a/src/Symfony/Component/Intl/Tests/LocalesTest.php
+++ b/src/Symfony/Component/Intl/Tests/LocalesTest.php
@@ -86,7 +86,7 @@ class LocalesTest extends ResourceBundleTestCase
public function testGetNameWithInvalidLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
Locales::getName('foo');
}
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index 99c095977d..b9deeef3df 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -606,7 +606,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
$decimalFormatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$currencyFormatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
- $r = new \ReflectionProperty('Symfony\Component\Intl\NumberFormatter\NumberFormatter', 'enSymbols');
+ $r = new \ReflectionProperty(NumberFormatter::class, 'enSymbols');
$r->setAccessible(true);
$expected = $r->getValue();
@@ -623,7 +623,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
$decimalFormatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$currencyFormatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
- $r = new \ReflectionProperty('Symfony\Component\Intl\NumberFormatter\NumberFormatter', 'enTextAttributes');
+ $r = new \ReflectionProperty(NumberFormatter::class, 'enTextAttributes');
$r->setAccessible(true);
$expected = $r->getValue();
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
index eef55abc9f..a6cf8a6c74 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
@@ -24,32 +24,32 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
{
public function testConstructorWithUnsupportedLocale()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$this->getNumberFormatter('pt_BR');
}
public function testConstructorWithUnsupportedStyle()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$this->getNumberFormatter('en', NumberFormatter::PATTERN_DECIMAL);
}
public function testConstructorWithPatternDifferentThanNull()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException::class);
$this->getNumberFormatter('en', NumberFormatter::DECIMAL, '');
}
public function testSetAttributeWithUnsupportedAttribute()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setAttribute(NumberFormatter::LENIENT_PARSE, 100);
}
public function testSetAttributeInvalidRoundingMode()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setAttribute(NumberFormatter::ROUNDING_MODE, -1);
}
@@ -67,7 +67,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
public function testFormatWithCurrencyStyle()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
parent::testFormatWithCurrencyStyle();
}
@@ -76,7 +76,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
*/
public function testFormatTypeInt32($formatter, $value, $expected, $message = '')
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
parent::testFormatTypeInt32($formatter, $value, $expected, $message);
}
@@ -85,7 +85,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
*/
public function testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message = '')
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
parent::testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message);
}
@@ -94,7 +94,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
*/
public function testFormatTypeInt64($formatter, $value, $expected)
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
parent::testFormatTypeInt64($formatter, $value, $expected);
}
@@ -103,7 +103,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
*/
public function testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected)
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
parent::testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected);
}
@@ -112,7 +112,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
*/
public function testFormatTypeDouble($formatter, $value, $expected)
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
parent::testFormatTypeDouble($formatter, $value, $expected);
}
@@ -121,13 +121,13 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
*/
public function testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected)
{
- $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
parent::testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected);
}
public function testGetPattern()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->getPattern();
}
@@ -140,7 +140,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
public function testParseCurrency()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$currency = 'USD';
$formatter->parseCurrency(3, $currency);
@@ -148,21 +148,21 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
public function testSetPattern()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setPattern('#0');
}
public function testSetSymbol()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '*');
}
public function testSetTextAttribute()
{
- $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setTextAttribute(NumberFormatter::NEGATIVE_PREFIX, '-');
}
diff --git a/src/Symfony/Component/Intl/Tests/ScriptsTest.php b/src/Symfony/Component/Intl/Tests/ScriptsTest.php
index b9c2bf7e62..62981299ad 100644
--- a/src/Symfony/Component/Intl/Tests/ScriptsTest.php
+++ b/src/Symfony/Component/Intl/Tests/ScriptsTest.php
@@ -280,7 +280,7 @@ class ScriptsTest extends ResourceBundleTestCase
public function testGetNameWithInvalidScriptCode()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
Scripts::getName('foo');
}
diff --git a/src/Symfony/Component/Intl/Tests/TimezonesTest.php b/src/Symfony/Component/Intl/Tests/TimezonesTest.php
index c438d32eaa..f02fabe8e6 100644
--- a/src/Symfony/Component/Intl/Tests/TimezonesTest.php
+++ b/src/Symfony/Component/Intl/Tests/TimezonesTest.php
@@ -529,13 +529,13 @@ class TimezonesTest extends ResourceBundleTestCase
public function testGetNameWithInvalidTimezone()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Timezones::getName('foo');
}
public function testGetNameWithAliasTimezone()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Timezones::getName('US/Pacific'); // alias in icu (not compiled), name unavailable in php
}
@@ -559,7 +559,7 @@ class TimezonesTest extends ResourceBundleTestCase
public function testGetRawOffsetWithUnknownTimezone()
{
- $this->expectException('Exception');
+ $this->expectException(\Exception::class);
$this->expectExceptionMessage('Unknown or bad timezone (foobar)');
Timezones::getRawOffset('foobar');
}
@@ -591,20 +591,20 @@ class TimezonesTest extends ResourceBundleTestCase
public function testForCountryCodeWithUnknownCountry()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Timezones::forCountryCode('foobar');
}
public function testForCountryCodeWithWrongCountryCode()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
$this->expectExceptionMessage('Country codes must be in uppercase, but "nl" was passed. Try with "NL" country code instead.');
Timezones::forCountryCode('nl');
}
public function testGetCountryCodeWithUnknownTimezone()
{
- $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
+ $this->expectException(MissingResourceException::class);
Timezones::getCountryCode('foobar');
}
diff --git a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
index 5868174332..21493ae4f0 100644
--- a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
+++ b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
@@ -56,7 +56,7 @@ class GitRepositoryTest extends TestCase
$this->assertSame(self::REPO_URL, $git->getUrl());
$this->assertMatchesRegularExpression('#^[0-9a-z]{40}$#', $git->getLastCommitHash());
$this->assertNotEmpty($git->getLastAuthor());
- $this->assertInstanceOf('DateTime', $git->getLastAuthoredDate());
+ $this->assertInstanceOf(\DateTime::class, $git->getLastAuthoredDate());
$this->assertStringMatchesFormat('v%s', $git->getLastTag());
$this->assertStringMatchesFormat('v3%s', $git->getLastTag(function ($tag) { return 0 === strpos($tag, 'v3'); }));
}
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
index d571c10ce0..ffd938295d 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
@@ -19,7 +19,7 @@ class EntryManagerTest extends TestCase
{
public function testMove()
{
- $this->expectException('Symfony\Component\Ldap\Exception\LdapException');
+ $this->expectException(\Symfony\Component\Ldap\Exception\LdapException::class);
$this->expectExceptionMessage('Entry "$$$$$$" malformed, could not parse RDN.');
$connection = $this->createMock(Connection::class);
$connection
@@ -33,7 +33,7 @@ class EntryManagerTest extends TestCase
public function testGetResources()
{
- $this->expectException('Symfony\Component\Ldap\Exception\NotBoundException');
+ $this->expectException(\Symfony\Component\Ldap\Exception\NotBoundException::class);
$this->expectExceptionMessage('Query execution is not possible without binding the connection first.');
$connection = $this->getMockBuilder(Connection::class)->getMock();
$connection
diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php
index f969fead7c..b312fe1234 100644
--- a/src/Symfony/Component/Lock/Tests/LockTest.php
+++ b/src/Symfony/Component/Lock/Tests/LockTest.php
@@ -298,7 +298,7 @@ class LockTest extends TestCase
public function testReleaseThrowsExceptionWhenDeletionFail()
{
- $this->expectException('Symfony\Component\Lock\Exception\LockReleasingException');
+ $this->expectException(\Symfony\Component\Lock\Exception\LockReleasingException::class);
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);
@@ -319,7 +319,7 @@ class LockTest extends TestCase
public function testReleaseThrowsExceptionIfNotWellDeleted()
{
- $this->expectException('Symfony\Component\Lock\Exception\LockReleasingException');
+ $this->expectException(\Symfony\Component\Lock\Exception\LockReleasingException::class);
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);
@@ -340,7 +340,7 @@ class LockTest extends TestCase
public function testReleaseThrowsAndLog()
{
- $this->expectException('Symfony\Component\Lock\Exception\LockReleasingException');
+ $this->expectException(\Symfony\Component\Lock\Exception\LockReleasingException::class);
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock();
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
index 1dbede1920..9431c2dcd7 100644
--- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
@@ -73,7 +73,7 @@ class CombinedStoreTest extends AbstractStoreTest
public function testSaveThrowsExceptionOnFailure()
{
- $this->expectException('Symfony\Component\Lock\Exception\LockConflictedException');
+ $this->expectException(LockConflictedException::class);
$key = new Key(uniqid(__METHOD__, true));
$this->store1
@@ -168,7 +168,7 @@ class CombinedStoreTest extends AbstractStoreTest
public function testputOffExpirationThrowsExceptionOnFailure()
{
- $this->expectException('Symfony\Component\Lock\Exception\LockConflictedException');
+ $this->expectException(LockConflictedException::class);
$key = new Key(uniqid(__METHOD__, true));
$ttl = random_int(1, 10);
diff --git a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
index 56b488af33..caf62353cd 100644
--- a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
@@ -63,7 +63,7 @@ class MemcachedStoreTest extends AbstractStoreTest
public function testInvalidTtl()
{
- $this->expectException('Symfony\Component\Lock\Exception\InvalidTtlException');
+ $this->expectException(\Symfony\Component\Lock\Exception\InvalidTtlException::class);
$store = $this->getStore();
$store->putOffExpiration(new Key('toto'), 0.1);
}
diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php
index 800397d153..02cc3461cb 100644
--- a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php
@@ -62,14 +62,14 @@ class PdoStoreTest extends AbstractStoreTest
public function testInvalidTtl()
{
- $this->expectException('Symfony\Component\Lock\Exception\InvalidTtlException');
+ $this->expectException(\Symfony\Component\Lock\Exception\InvalidTtlException::class);
$store = $this->getStore();
$store->putOffExpiration(new Key('toto'), 0.1);
}
public function testInvalidTtlConstruct()
{
- $this->expectException('Symfony\Component\Lock\Exception\InvalidTtlException');
+ $this->expectException(\Symfony\Component\Lock\Exception\InvalidTtlException::class);
return new PdoStore('sqlite:'.self::$dbFile, [], 0.1, 0.1);
}
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
index 4c1b2d8259..fb87944a00 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
@@ -21,7 +21,7 @@ class RedisArrayStoreTest extends AbstractRedisStoreTest
{
public static function setUpBeforeClass(): void
{
- if (!class_exists('RedisArray')) {
+ if (!class_exists(\RedisArray::class)) {
self::markTestSkipped('The RedisArray class is required.');
}
try {
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
index d1bfab528f..454493f1ef 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
@@ -21,7 +21,7 @@ class RedisClusterStoreTest extends AbstractRedisStoreTest
{
public static function setUpBeforeClass(): void
{
- if (!class_exists('RedisCluster')) {
+ if (!class_exists(\RedisCluster::class)) {
self::markTestSkipped('The RedisCluster class is required.');
}
if (!getenv('REDIS_CLUSTER_HOSTS')) {
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
index ed696af03c..3da46f4a56 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
@@ -45,7 +45,7 @@ class RedisStoreTest extends AbstractRedisStoreTest
public function testInvalidTtl()
{
- $this->expectException('Symfony\Component\Lock\Exception\InvalidTtlException');
+ $this->expectException(\Symfony\Component\Lock\Exception\InvalidTtlException::class);
new RedisStore($this->getRedisConnection(), -1);
}
}
diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php
index a67a1629d0..33e939d9b6 100644
--- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php
+++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php
@@ -18,7 +18,7 @@ class SocketStreamTest extends TestCase
{
public function testSocketErrorNoConnection()
{
- $this->expectException('Symfony\Component\Mailer\Exception\TransportException');
+ $this->expectException(\Symfony\Component\Mailer\Exception\TransportException::class);
$this->expectExceptionMessageMatches('/Connection refused|unable to connect/');
$s = new SocketStream();
$s->setTimeout(0.1);
@@ -28,7 +28,7 @@ class SocketStreamTest extends TestCase
public function testSocketErrorBeforeConnectError()
{
- $this->expectException('Symfony\Component\Mailer\Exception\TransportException');
+ $this->expectException(\Symfony\Component\Mailer\Exception\TransportException::class);
$this->expectExceptionMessageMatches('/no valid certs found cafile stream|Unable to find the socket transport "ssl"/');
$s = new SocketStream();
$s->setStreamOptions([
diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpReceiverTest.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpReceiverTest.php
index 9116a3682e..ded34544f9 100644
--- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpReceiverTest.php
+++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpReceiverTest.php
@@ -47,7 +47,7 @@ class AmqpReceiverTest extends TestCase
public function testItThrowsATransportExceptionIfItCannotAcknowledgeMessage()
{
- $this->expectException('Symfony\Component\Messenger\Exception\TransportException');
+ $this->expectException(\Symfony\Component\Messenger\Exception\TransportException::class);
$serializer = $this->createMock(SerializerInterface::class);
$amqpEnvelope = $this->createAMQPEnvelope();
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
@@ -61,7 +61,7 @@ class AmqpReceiverTest extends TestCase
public function testItThrowsATransportExceptionIfItCannotRejectMessage()
{
- $this->expectException('Symfony\Component\Messenger\Exception\TransportException');
+ $this->expectException(\Symfony\Component\Messenger\Exception\TransportException::class);
$serializer = $this->createMock(SerializerInterface::class);
$amqpEnvelope = $this->createAMQPEnvelope();
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpSenderTest.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpSenderTest.php
index 47f47eeb7b..4a9637f78d 100644
--- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpSenderTest.php
+++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/AmqpSenderTest.php
@@ -104,7 +104,7 @@ class AmqpSenderTest extends TestCase
public function testItThrowsATransportExceptionIfItCannotSendTheMessage()
{
- $this->expectException('Symfony\Component\Messenger\Exception\TransportException');
+ $this->expectException(\Symfony\Component\Messenger\Exception\TransportException::class);
$envelope = new Envelope(new DummyMessage('Oy'));
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php
index 6c7273977e..543494acfb 100644
--- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php
+++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php
@@ -32,7 +32,7 @@ class ConnectionTest extends TestCase
public function testItCannotBeConstructedWithAWrongDsn()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The given AMQP DSN "amqp://:" is invalid.');
Connection::fromDsn('amqp://:');
}
@@ -567,7 +567,7 @@ class ConnectionTest extends TestCase
public function testObfuscatePasswordInDsn()
{
- $this->expectException('AMQPException');
+ $this->expectException(\AMQPException::class);
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN. ({"host":"localhost","port":5672,"vhost":"/","login":"user","password":"********"})');
$factory = new TestAmqpFactory(
$amqpConnection = $this->createMock(\AMQPConnection::class),
diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineReceiverTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineReceiverTest.php
index 6e774ec719..43a0772371 100644
--- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineReceiverTest.php
+++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineReceiverTest.php
@@ -60,7 +60,7 @@ class DoctrineReceiverTest extends TestCase
public function testItRejectTheMessageIfThereIsAMessageDecodingFailedException()
{
- $this->expectException('Symfony\Component\Messenger\Exception\MessageDecodingFailedException');
+ $this->expectException(MessageDecodingFailedException::class);
$serializer = $this->createMock(PhpSerializer::class);
$serializer->method('decode')->willThrowException(new MessageDecodingFailedException());
diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineTransportFactoryTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineTransportFactoryTest.php
index b423c21e27..b74b826392 100644
--- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineTransportFactoryTest.php
+++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineTransportFactoryTest.php
@@ -57,7 +57,7 @@ class DoctrineTransportFactoryTest extends TestCase
public function testCreateTransportMustThrowAnExceptionIfManagerIsNotFound()
{
- $this->expectException('Symfony\Component\Messenger\Exception\TransportException');
+ $this->expectException(\Symfony\Component\Messenger\Exception\TransportException::class);
$this->expectExceptionMessage('Could not find Doctrine connection from Messenger DSN "doctrine://default".');
$registry = $this->createMock(ConnectionRegistry::class);
$registry->expects($this->once())
diff --git a/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php
index 92d6b855d5..27ded7f46d 100644
--- a/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php
@@ -155,7 +155,7 @@ TXT
public function testExceptionOnUnknownBusArgument()
{
- $this->expectException('Symfony\Component\Console\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are "command_bus", "query_bus".');
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);
diff --git a/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php
index edc28f5ea8..2e4d9368b9 100644
--- a/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php
+++ b/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php
@@ -71,7 +71,7 @@ class SetupTransportsCommandTest extends TestCase
public function testReceiverNameArgumentNotFound()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('The "not_found" transport does not exist.');
// mock a service locator
/** @var MockObject|ServiceLocator $serviceLocator */
diff --git a/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php b/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php
index 09e19ae0e6..1b1ccb5f02 100644
--- a/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php
+++ b/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php
@@ -156,7 +156,7 @@ class MessengerPassTest extends TestCase
public function testProcessTagWithUnknownBus()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\Fixtures\DummyCommandHandler": bus "unknown_bus" specified on the tag "messenger.message_handler" does not exist (known ones are: "command_bus").');
$container = $this->getContainerBuilder($commandBusId = 'command_bus');
@@ -256,7 +256,7 @@ class MessengerPassTest extends TestCase
public function testThrowsExceptionIfTheHandlerClassDoesNotExist()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid service "NonExistentHandlerClass": class "NonExistentHandlerClass" does not exist.');
$container = $this->getContainerBuilder();
$container->register('message_bus', MessageBusInterface::class)->addTag('messenger.bus');
@@ -270,7 +270,7 @@ class MessengerPassTest extends TestCase
public function testThrowsExceptionIfTheHandlerMethodDoesNotExist()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\HandlerMappingWithNonExistentMethod": method "Symfony\Component\Messenger\Tests\DependencyInjection\HandlerMappingWithNonExistentMethod::dummyMethod()" does not exist.');
$container = $this->getContainerBuilder();
$container->register('message_bus', MessageBusInterface::class)->addTag('messenger.bus');
@@ -400,7 +400,7 @@ class MessengerPassTest extends TestCase
public function testItThrowsAnExceptionOnUnknownBus()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid configuration returned by method "Symfony\Component\Messenger\Tests\DependencyInjection\HandlerOnUndefinedBus::getHandledMessages()" for message "Symfony\Component\Messenger\Tests\Fixtures\DummyMessage": bus "some_undefined_bus" does not exist.');
$container = $this->getContainerBuilder();
$container
@@ -413,7 +413,7 @@ class MessengerPassTest extends TestCase
public function testUndefinedMessageClassForHandler()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessageHandler": class or interface "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessage" used as argument type in method "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessageHandler::__invoke()" not found.');
$container = $this->getContainerBuilder();
$container
@@ -426,7 +426,7 @@ class MessengerPassTest extends TestCase
public function testUndefinedMessageClassForHandlerImplementingMessageHandlerInterface()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessageHandlerViaHandlerInterface": class or interface "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessage" used as argument type in method "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessageHandlerViaHandlerInterface::__invoke()" not found.');
$container = $this->getContainerBuilder();
$container
@@ -439,7 +439,7 @@ class MessengerPassTest extends TestCase
public function testUndefinedMessageClassForHandlerImplementingMessageSubscriberInterface()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessageHandlerViaSubscriberInterface": class or interface "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessage" returned by method "Symfony\Component\Messenger\Tests\DependencyInjection\UndefinedMessageHandlerViaSubscriberInterface::getHandledMessages()" not found.');
$container = $this->getContainerBuilder();
$container
@@ -452,7 +452,7 @@ class MessengerPassTest extends TestCase
public function testNotInvokableHandler()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\NotInvokableHandler": class "Symfony\Component\Messenger\Tests\DependencyInjection\NotInvokableHandler" must have an "__invoke()" method.');
$container = $this->getContainerBuilder();
$container
@@ -465,7 +465,7 @@ class MessengerPassTest extends TestCase
public function testMissingArgumentHandler()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\MissingArgumentHandler": method "Symfony\Component\Messenger\Tests\DependencyInjection\MissingArgumentHandler::__invoke()" requires at least one argument, first one being the message it handles.');
$container = $this->getContainerBuilder();
$container
@@ -478,7 +478,7 @@ class MessengerPassTest extends TestCase
public function testMissingArgumentTypeHandler()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\MissingArgumentTypeHandler": argument "$message" of method "Symfony\Component\Messenger\Tests\DependencyInjection\MissingArgumentTypeHandler::__invoke()" must have a type-hint corresponding to the message class it handles.');
$container = $this->getContainerBuilder();
$container
@@ -491,7 +491,7 @@ class MessengerPassTest extends TestCase
public function testBuiltinArgumentTypeHandler()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\BuiltinArgumentTypeHandler": type-hint of argument "$message" in method "Symfony\Component\Messenger\Tests\DependencyInjection\BuiltinArgumentTypeHandler::__invoke()" must be a class , "string" given.');
$container = $this->getContainerBuilder();
$container
@@ -504,7 +504,7 @@ class MessengerPassTest extends TestCase
public function testNeedsToHandleAtLeastOneMessage()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\DependencyInjection\HandleNoMessageHandler": method "Symfony\Component\Messenger\Tests\DependencyInjection\HandleNoMessageHandler::getHandledMessages()" must return one or more messages.');
$container = $this->getContainerBuilder();
$container
@@ -583,7 +583,7 @@ class MessengerPassTest extends TestCase
public function testCannotRegistersAnUndefinedMiddleware()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid middleware: service "not_defined_middleware" not found.');
$container = $this->getContainerBuilder($fooBusId = 'messenger.bus.foo');
$container->setParameter($middlewareParameter = $fooBusId.'.middleware', [
@@ -595,7 +595,7 @@ class MessengerPassTest extends TestCase
public function testMiddlewareFactoryDefinitionMustBeAbstract()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('Invalid middleware factory "not_an_abstract_definition": a middleware factory must be an abstract definition.');
$container = $this->getContainerBuilder($fooBusId = 'messenger.bus.foo');
$container->register('not_an_abstract_definition', UselessMiddleware::class);
diff --git a/src/Symfony/Component/Messenger/Tests/MessageBusTest.php b/src/Symfony/Component/Messenger/Tests/MessageBusTest.php
index 531643bd56..47624777b2 100644
--- a/src/Symfony/Component/Messenger/Tests/MessageBusTest.php
+++ b/src/Symfony/Component/Messenger/Tests/MessageBusTest.php
@@ -34,7 +34,7 @@ class MessageBusTest extends TestCase
public function testItDispatchInvalidMessageType()
{
- $this->expectException('TypeError');
+ $this->expectException(\TypeError::class);
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got "string".');
(new MessageBus())->dispatch('wrong');
}
diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php
index 400060bc86..3808843de2 100644
--- a/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php
+++ b/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php
@@ -115,7 +115,7 @@ class HandleMessageMiddlewareTest extends MiddlewareTestCase
public function testThrowsNoHandlerException()
{
- $this->expectException('Symfony\Component\Messenger\Exception\NoHandlerForMessageException');
+ $this->expectException(\Symfony\Component\Messenger\Exception\NoHandlerForMessageException::class);
$this->expectExceptionMessage('No handler for message "Symfony\Component\Messenger\Tests\Fixtures\DummyMessage"');
$middleware = new HandleMessageMiddleware(new HandlersLocator([]));
diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php
index 0370d86726..08e4fd5b69 100644
--- a/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php
+++ b/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php
@@ -66,7 +66,7 @@ class TraceableMiddlewareTest extends MiddlewareTestCase
public function testHandleWithException()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Thrown from next middleware.');
$busId = 'command_bus';
diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/ValidationMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/ValidationMiddlewareTest.php
index dc279118ec..d4d999fb04 100644
--- a/src/Symfony/Component/Messenger/Tests/Middleware/ValidationMiddlewareTest.php
+++ b/src/Symfony/Component/Messenger/Tests/Middleware/ValidationMiddlewareTest.php
@@ -54,7 +54,7 @@ class ValidationMiddlewareTest extends MiddlewareTestCase
public function testValidationFailedException()
{
- $this->expectException('Symfony\Component\Messenger\Exception\ValidationFailedException');
+ $this->expectException(\Symfony\Component\Messenger\Exception\ValidationFailedException::class);
$this->expectExceptionMessage('Message of type "Symfony\Component\Messenger\Tests\Fixtures\DummyMessage" failed validation.');
$message = new DummyMessage('Hey');
$envelope = new Envelope($message);
diff --git a/src/Symfony/Component/Mime/Tests/Header/DateHeaderTest.php b/src/Symfony/Component/Mime/Tests/Header/DateHeaderTest.php
index 4fc92b96ae..7ea43b7156 100644
--- a/src/Symfony/Component/Mime/Tests/Header/DateHeaderTest.php
+++ b/src/Symfony/Component/Mime/Tests/Header/DateHeaderTest.php
@@ -37,7 +37,7 @@ class DateHeaderTest extends TestCase
{
$dateTime = new \DateTime();
$header = new DateHeader('Date', $dateTime);
- $this->assertInstanceOf('DateTimeImmutable', $header->getDateTime());
+ $this->assertInstanceOf(\DateTimeImmutable::class, $header->getDateTime());
$this->assertEquals($dateTime->getTimestamp(), $header->getDateTime()->getTimestamp());
$this->assertEquals($dateTime->getTimezone(), $header->getDateTime()->getTimezone());
}
diff --git a/src/Symfony/Component/Mime/Tests/Header/IdentificationHeaderTest.php b/src/Symfony/Component/Mime/Tests/Header/IdentificationHeaderTest.php
index 7d274ab162..788853497e 100644
--- a/src/Symfony/Component/Mime/Tests/Header/IdentificationHeaderTest.php
+++ b/src/Symfony/Component/Mime/Tests/Header/IdentificationHeaderTest.php
@@ -101,7 +101,7 @@ class IdentificationHeaderTest extends TestCase
public function testInvalidIdLeftThrowsException()
{
- $this->expectException('Exception');
+ $this->expectException(\Exception::class);
$this->expectExceptionMessage('Email "a b c@d" does not comply with addr-spec of RFC 2822.');
new IdentificationHeader('References', 'a b c@d');
}
@@ -137,14 +137,14 @@ class IdentificationHeaderTest extends TestCase
public function testInvalidIdRightThrowsException()
{
- $this->expectException('Exception');
+ $this->expectException(\Exception::class);
$this->expectExceptionMessage('Email "a@b c d" does not comply with addr-spec of RFC 2822.');
new IdentificationHeader('References', 'a@b c d');
}
public function testMissingAtSignThrowsException()
{
- $this->expectException('Exception');
+ $this->expectException(\Exception::class);
$this->expectExceptionMessage('Email "abc" does not comply with addr-spec of RFC 2822.');
/* -- RFC 2822, 3.6.4.
msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS]
diff --git a/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php b/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
index 9b46ece52f..5f97a97122 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
@@ -38,7 +38,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetDefaultThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No default value was set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -49,7 +49,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetDefaultThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
@@ -69,7 +69,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetLazyClosuresThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No lazy closures were set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -80,7 +80,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetLazyClosuresThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
@@ -100,7 +100,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetAllowedTypesThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No allowed types were set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -111,7 +111,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetAllowedTypesThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
@@ -131,7 +131,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetAllowedValuesThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No allowed values were set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -142,7 +142,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetAllowedValuesThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
@@ -162,7 +162,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetNormalizerThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No normalizer was set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -173,7 +173,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetNormalizerThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
@@ -194,7 +194,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetNormalizersThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No normalizer was set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined('foo');
@@ -205,7 +205,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetNormalizersThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
@@ -269,7 +269,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetDeprecationMessageThrowsOnNoConfiguredValue()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
$this->expectExceptionMessage('No deprecation was set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined('foo');
@@ -280,7 +280,7 @@ class OptionsResolverIntrospectorTest extends TestCase
public function testGetDeprecationMessageThrowsOnNotDefinedOption()
{
- $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
$this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
index f82043009b..4a0812c795 100644
--- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
@@ -24,7 +24,7 @@ class ProcessFailedExceptionTest extends TestCase
*/
public function testProcessFailedExceptionThrowsException()
{
- $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful'])->setConstructorArgs([['php']])->getMock();
+ $process = $this->getMockBuilder(\Symfony\Component\Process\Process::class)->setMethods(['isSuccessful'])->setConstructorArgs([['php']])->getMock();
$process->expects($this->once())
->method('isSuccessful')
->willReturn(true);
@@ -48,7 +48,7 @@ class ProcessFailedExceptionTest extends TestCase
$errorOutput = 'FATAL: Unexpected error';
$workingDirectory = getcwd();
- $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'])->setConstructorArgs([[$cmd]])->getMock();
+ $process = $this->getMockBuilder(\Symfony\Component\Process\Process::class)->setMethods(['isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'])->setConstructorArgs([[$cmd]])->getMock();
$process->expects($this->once())
->method('isSuccessful')
->willReturn(false);
@@ -96,7 +96,7 @@ class ProcessFailedExceptionTest extends TestCase
$exitText = 'General error';
$workingDirectory = getcwd();
- $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'])->setConstructorArgs([[$cmd]])->getMock();
+ $process = $this->getMockBuilder(\Symfony\Component\Process\Process::class)->setMethods(['isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'])->setConstructorArgs([[$cmd]])->getMock();
$process->expects($this->once())
->method('isSuccessful')
->willReturn(false);
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 62bffec88f..4fd0df2018 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -49,7 +49,7 @@ class ProcessTest extends TestCase
public function testInvalidCwd()
{
- $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectException(RuntimeException::class);
$this->expectExceptionMessageMatches('/The provided cwd ".*" does not exist\./');
try {
// Check that it works fine if the CWD exists
@@ -78,13 +78,13 @@ class ProcessTest extends TestCase
public function testNegativeTimeoutFromConstructor()
{
- $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Process\Exception\InvalidArgumentException::class);
$this->getProcess('', null, null, null, -1);
}
public function testNegativeTimeoutFromSetter()
{
- $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Process\Exception\InvalidArgumentException::class);
$p = $this->getProcess('');
$p->setTimeout(-1);
}
@@ -272,7 +272,7 @@ class ProcessTest extends TestCase
public function testSetInputWhileRunningThrowsAnException()
{
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage('Input can not be set while the process is running.');
$process = $this->getProcessForCode('sleep(30);');
$process->start();
@@ -292,7 +292,7 @@ class ProcessTest extends TestCase
*/
public function testInvalidInput($value)
{
- $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Process\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('"Symfony\Component\Process\Process::setInput" only accepts strings, Traversable objects or stream resources.');
$process = $this->getProcess('foo');
$process->setInput($value);
@@ -508,7 +508,7 @@ class ProcessTest extends TestCase
public function testTTYInWindowsEnvironment()
{
- $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectException(RuntimeException::class);
$this->expectExceptionMessage('TTY mode is not supported on Windows platform.');
if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test is for Windows platform only');
@@ -555,7 +555,7 @@ class ProcessTest extends TestCase
public function testMustRunThrowsException()
{
- $this->expectException('Symfony\Component\Process\Exception\ProcessFailedException');
+ $this->expectException(\Symfony\Component\Process\Exception\ProcessFailedException::class);
$process = $this->getProcess('exit 1');
$process->mustRun();
}
@@ -707,7 +707,7 @@ class ProcessTest extends TestCase
public function testProcessThrowsExceptionWhenExternallySignaled()
{
- $this->expectException('Symfony\Component\Process\Exception\ProcessSignaledException');
+ $this->expectException(\Symfony\Component\Process\Exception\ProcessSignaledException::class);
$this->expectExceptionMessage('The process has been signaled with signal "9".');
if (!\function_exists('posix_kill')) {
$this->markTestSkipped('Function posix_kill is required.');
@@ -744,7 +744,7 @@ class ProcessTest extends TestCase
public function testRunProcessWithTimeout()
{
- $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectException(ProcessTimedOutException::class);
$this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(30);');
$process->setTimeout(0.1);
@@ -762,7 +762,7 @@ class ProcessTest extends TestCase
public function testIterateOverProcessWithTimeout()
{
- $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectException(ProcessTimedOutException::class);
$this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(30);');
$process->setTimeout(0.1);
@@ -794,7 +794,7 @@ class ProcessTest extends TestCase
public function testCheckTimeoutOnStartedProcess()
{
- $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectException(ProcessTimedOutException::class);
$this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(33);');
$process->setTimeout(0.1);
@@ -857,7 +857,7 @@ class ProcessTest extends TestCase
public function testStartAfterATimeout()
{
- $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectException(ProcessTimedOutException::class);
$this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(35);');
$process->setTimeout(0.1);
@@ -934,7 +934,7 @@ class ProcessTest extends TestCase
public function testSignalProcessNotRunning()
{
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage('Can not send signal on a non running process.');
$process = $this->getProcess('foo');
$process->signal(1); // SIGHUP
@@ -947,7 +947,7 @@ class ProcessTest extends TestCase
{
$process = $this->getProcess('foo');
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage(sprintf('Process must be started before calling "%s()".', $method));
$process->{$method}();
@@ -969,7 +969,7 @@ class ProcessTest extends TestCase
*/
public function testMethodsThatNeedATerminatedProcess($method)
{
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage('Process must be terminated before calling');
$process = $this->getProcessForCode('sleep(37);');
$process->start();
@@ -1024,7 +1024,7 @@ class ProcessTest extends TestCase
public function testDisableOutputWhileRunningThrowsException()
{
- $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Disabling output while the process is running is not possible.');
$p = $this->getProcessForCode('sleep(39);');
$p->start();
@@ -1033,7 +1033,7 @@ class ProcessTest extends TestCase
public function testEnableOutputWhileRunningThrowsException()
{
- $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Enabling output while the process is running is not possible.');
$p = $this->getProcessForCode('sleep(40);');
$p->disableOutput();
@@ -1053,7 +1053,7 @@ class ProcessTest extends TestCase
public function testDisableOutputWhileIdleTimeoutIsSet()
{
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage('Output can not be disabled while an idle timeout is set.');
$process = $this->getProcess('foo');
$process->setIdleTimeout(1);
@@ -1062,7 +1062,7 @@ class ProcessTest extends TestCase
public function testSetIdleTimeoutWhileOutputIsDisabled()
{
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage('timeout can not be set while the output is disabled.');
$process = $this->getProcess('foo');
$process->disableOutput();
@@ -1081,7 +1081,7 @@ class ProcessTest extends TestCase
*/
public function testGetOutputWhileDisabled($fetchMethod)
{
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectException(LogicException::class);
$this->expectExceptionMessage('Output has been disabled.');
$p = $this->getProcessForCode('sleep(41);');
$p->disableOutput();
@@ -1485,7 +1485,7 @@ class ProcessTest extends TestCase
public function testPreparedCommandWithMissingValue()
{
- $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Process\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Command line is missing a value for parameter "abc": echo "${:abc}"');
$p = Process::fromShellCommandline('echo "${:abc}"');
$p->run(null, ['bcd' => 'BCD']);
@@ -1493,7 +1493,7 @@ class ProcessTest extends TestCase
public function testPreparedCommandWithNoValues()
{
- $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Process\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Command line is missing a value for parameter "abc": echo "${:abc}"');
$p = Process::fromShellCommandline('echo "${:abc}"');
$p->run(null, []);
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
index dc576dfcb6..4a31588e3e 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
@@ -47,7 +47,7 @@ abstract class PropertyAccessorArrayAccessTest extends TestCase
public function testGetValueFailsIfNoSuchIndex()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchIndexException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\NoSuchIndexException::class);
$this->propertyAccessor = PropertyAccess::createPropertyAccessorBuilder()
->enableExceptionOnInvalidIndex()
->getPropertyAccessor();
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
index b121a48087..e26ed62e7e 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
@@ -118,13 +118,13 @@ class PropertyPathBuilderTest extends TestCase
public function testReplaceByIndexDoesNotAllowInvalidOffsets()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->replaceByIndex(6, 'new1');
}
public function testReplaceByIndexDoesNotAllowNegativeOffsets()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->replaceByIndex(-1, 'new1');
}
@@ -148,13 +148,13 @@ class PropertyPathBuilderTest extends TestCase
public function testReplaceByPropertyDoesNotAllowInvalidOffsets()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->replaceByProperty(6, 'new1');
}
public function testReplaceByPropertyDoesNotAllowNegativeOffsets()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->replaceByProperty(-1, 'new1');
}
@@ -190,7 +190,7 @@ class PropertyPathBuilderTest extends TestCase
*/
public function testReplaceDoesNotAllowInvalidOffsets($offset)
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->replace($offset, 1, new PropertyPath('new1[new2].new3'));
}
@@ -264,13 +264,13 @@ class PropertyPathBuilderTest extends TestCase
public function testRemoveDoesNotAllowInvalidOffsets()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->remove(6);
}
public function testRemoveDoesNotAllowNegativeOffsets()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$this->builder->remove(-1);
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
index 4fe450e3f2..6b08d2b65d 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
@@ -25,13 +25,13 @@ class PropertyPathTest extends TestCase
public function testDotIsRequiredBeforeProperty()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException::class);
new PropertyPath('[index]property');
}
public function testDotCannotBePresentAtTheBeginning()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException::class);
new PropertyPath('.property');
}
@@ -53,25 +53,25 @@ class PropertyPathTest extends TestCase
*/
public function testUnexpectedCharacters($path)
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException::class);
new PropertyPath($path);
}
public function testPathCannotBeEmpty()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException::class);
new PropertyPath('');
}
public function testPathCannotBeNull()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\InvalidArgumentException::class);
new PropertyPath(null);
}
public function testPathCannotBeFalse()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\PropertyAccess\Exception\InvalidArgumentException::class);
new PropertyPath(false);
}
@@ -120,7 +120,7 @@ class PropertyPathTest extends TestCase
public function testGetElementDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->getElement(3);
@@ -128,7 +128,7 @@ class PropertyPathTest extends TestCase
public function testGetElementDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->getElement(-1);
@@ -144,7 +144,7 @@ class PropertyPathTest extends TestCase
public function testIsPropertyDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isProperty(3);
@@ -152,7 +152,7 @@ class PropertyPathTest extends TestCase
public function testIsPropertyDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isProperty(-1);
@@ -168,7 +168,7 @@ class PropertyPathTest extends TestCase
public function testIsIndexDoesNotAcceptInvalidIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isIndex(3);
@@ -176,7 +176,7 @@ class PropertyPathTest extends TestCase
public function testIsIndexDoesNotAcceptNegativeIndices()
{
- $this->expectException('OutOfBoundsException');
+ $this->expectException(\OutOfBoundsException::class);
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isIndex(-1);
diff --git a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
index c8bd5b9b86..66041a309c 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
@@ -36,10 +36,10 @@ class AbstractPropertyInfoExtractorTest extends TestCase
public function testInstanceOf()
{
- $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface', $this->propertyInfo);
- $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface', $this->propertyInfo);
- $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface', $this->propertyInfo);
- $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface', $this->propertyInfo);
+ $this->assertInstanceOf(\Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface::class, $this->propertyInfo);
+ $this->assertInstanceOf(\Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface::class, $this->propertyInfo);
+ $this->assertInstanceOf(\Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface::class, $this->propertyInfo);
+ $this->assertInstanceOf(\Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface::class, $this->propertyInfo);
$this->assertInstanceOf(PropertyInitializableExtractorInterface::class, $this->propertyInfo);
}
diff --git a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
index 4d1c516b49..822a7a4b89 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
@@ -38,11 +38,11 @@ class TypeTest extends TestCase
$this->assertTrue($type->isCollection());
$collectionKeyType = $type->getCollectionKeyType();
- $this->assertInstanceOf('Symfony\Component\PropertyInfo\Type', $collectionKeyType);
+ $this->assertInstanceOf(Type::class, $collectionKeyType);
$this->assertEquals(Type::BUILTIN_TYPE_INT, $collectionKeyType->getBuiltinType());
$collectionValueType = $type->getCollectionValueType();
- $this->assertInstanceOf('Symfony\Component\PropertyInfo\Type', $collectionValueType);
+ $this->assertInstanceOf(Type::class, $collectionValueType);
$this->assertEquals(Type::BUILTIN_TYPE_STRING, $collectionValueType->getBuiltinType());
}
@@ -74,7 +74,7 @@ class TypeTest extends TestCase
public function testInvalidType()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('"foo" is not a valid PHP type.');
new Type('foo');
}
diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
index 402ac51351..50b9666abf 100644
--- a/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
+++ b/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
@@ -446,7 +446,7 @@ EOF;
private function getExpressionLanguage(): ExpressionLanguage
{
if (null === $this->expressionLanguage) {
- if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
+ if (!class_exists(ExpressionLanguage::class)) {
throw new \LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
}
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
index cbc4c097f3..65afd4f3f4 100644
--- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
+++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
@@ -253,7 +253,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
protected function getExpressionLanguage()
{
if (null === $this->expressionLanguage) {
- if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
+ if (!class_exists(ExpressionLanguage::class)) {
throw new \LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
}
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
@@ -267,7 +267,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
*/
protected function createRequest(string $pathinfo): ?Request
{
- if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
+ if (!class_exists(Request::class)) {
return null;
}
diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
index 2c193a8a09..a482378bde 100644
--- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
@@ -18,13 +18,13 @@ class RouteTest extends TestCase
{
public function testInvalidRouteParameter()
{
- $this->expectException('BadMethodCallException');
+ $this->expectException(\BadMethodCallException::class);
new Route(['foo' => 'bar']);
}
public function testTryingToSetLocalesDirectly()
{
- $this->expectException('BadMethodCallException');
+ $this->expectException(\BadMethodCallException::class);
new Route(['locales' => ['nl' => 'bar']]);
}
diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php
index 299e6bd5c6..ee71ce98a1 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php
@@ -118,7 +118,7 @@ class CompiledUrlGeneratorDumperTest extends TestCase
public function testDumpWithRouteNotFoundLocalizedRoutes()
{
- $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
+ $this->expectException(\Symfony\Component\Routing\Exception\RouteNotFoundException::class);
$this->expectExceptionMessage('Unable to generate a URL for the named route "test" as such route does not exist.');
$this->routeCollection->add('test.en', (new Route('/testing/is/fun'))->setDefault('_locale', 'en')->setDefault('_canonical_route', 'test')->setRequirement('_locale', 'en'));
@@ -178,7 +178,7 @@ class CompiledUrlGeneratorDumperTest extends TestCase
public function testDumpWithoutRoutes()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump());
$projectUrlGenerator = new CompiledUrlGenerator(require $this->testTmpFilepath, new RequestContext('/app.php'));
@@ -188,7 +188,7 @@ class CompiledUrlGeneratorDumperTest extends TestCase
public function testGenerateNonExistingRoute()
{
- $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
+ $this->expectException(\Symfony\Component\Routing\Exception\RouteNotFoundException::class);
$this->routeCollection->add('Test', new Route('/test'));
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump());
diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
index cc5d894cfa..6246b90e6a 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
@@ -78,7 +78,7 @@ class UrlGeneratorTest extends TestCase
public function testRelativeUrlWithNullParameterButNotOptional()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/testing/{foo}/bar', ['foo' => null]));
// This must raise an exception because the default requirement for "foo" is "[^/]+" which is not met with these params.
// Generating path "/testing//bar" would be wrong as matching this route would fail.
@@ -264,14 +264,14 @@ class UrlGeneratorTest extends TestCase
public function testGenerateWithoutRoutes()
{
- $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
+ $this->expectException(\Symfony\Component\Routing\Exception\RouteNotFoundException::class);
$routes = $this->getRoutes('foo', new Route('/testing/{foo}'));
$this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL);
}
public function testGenerateWithInvalidLocale()
{
- $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
+ $this->expectException(\Symfony\Component\Routing\Exception\RouteNotFoundException::class);
$routes = new RouteCollection();
$route = new Route('');
@@ -293,21 +293,21 @@ class UrlGeneratorTest extends TestCase
public function testGenerateForRouteWithoutMandatoryParameter()
{
- $this->expectException('Symfony\Component\Routing\Exception\MissingMandatoryParametersException');
+ $this->expectException(\Symfony\Component\Routing\Exception\MissingMandatoryParametersException::class);
$routes = $this->getRoutes('test', new Route('/testing/{foo}'));
$this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL);
}
public function testGenerateForRouteWithInvalidOptionalParameter()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+']));
$this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL);
}
public function testGenerateForRouteWithInvalidParameter()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => '1|2']));
$this->getGenerator($routes)->generate('test', ['foo' => '0'], UrlGeneratorInterface::ABSOLUTE_URL);
}
@@ -323,7 +323,7 @@ class UrlGeneratorTest extends TestCase
public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger()
{
$routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+']));
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger->expects($this->once())
->method('error');
$generator = $this->getGenerator($routes, [], $logger);
@@ -341,21 +341,21 @@ class UrlGeneratorTest extends TestCase
public function testGenerateForRouteWithInvalidMandatoryParameter()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => 'd+']));
$this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL);
}
public function testGenerateForRouteWithInvalidUtf8Parameter()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => '\pL+'], ['utf8' => true]));
$this->getGenerator($routes)->generate('test', ['foo' => 'abc123'], UrlGeneratorInterface::ABSOLUTE_URL);
}
public function testRequiredParamAndEmptyPassed()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/{slug}', [], ['slug' => '.+']));
$this->getGenerator($routes)->generate('test', ['slug' => '']);
}
@@ -476,7 +476,7 @@ class UrlGeneratorTest extends TestCase
// The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything
// and following optional variables like _format could never match.
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$generator->generate('test', ['x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml']);
}
@@ -517,7 +517,7 @@ class UrlGeneratorTest extends TestCase
public function testImportantVariableWithNoDefault()
{
- $this->expectException('Symfony\Component\Routing\Exception\MissingMandatoryParametersException');
+ $this->expectException(\Symfony\Component\Routing\Exception\MissingMandatoryParametersException::class);
$routes = $this->getRoutes('test', new Route('/{page}.{!_format}'));
$generator = $this->getGenerator($routes);
@@ -526,14 +526,14 @@ class UrlGeneratorTest extends TestCase
public function testDefaultRequirementOfVariableDisallowsSlash()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/{page}.{_format}'));
$this->getGenerator($routes)->generate('test', ['page' => 'index', '_format' => 'sl/ash']);
}
public function testDefaultRequirementOfVariableDisallowsNextSeparator()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/{page}.{_format}'));
$this->getGenerator($routes)->generate('test', ['page' => 'do.t', '_format' => 'html']);
}
@@ -561,21 +561,21 @@ class UrlGeneratorTest extends TestCase
public function testUrlWithInvalidParameterInHost()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/', [], ['foo' => 'bar'], [], '{foo}.example.com'));
$this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH);
}
public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/', ['foo' => 'bar'], ['foo' => 'bar'], [], '{foo}.example.com'));
$this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH);
}
public function testUrlWithInvalidParameterEqualsDefaultValueInHost()
{
- $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException(\Symfony\Component\Routing\Exception\InvalidParameterException::class);
$routes = $this->getRoutes('test', new Route('/', ['foo' => 'baz'], ['foo' => 'bar'], [], '{foo}.example.com'));
$this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH);
}
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php
index 0ce4a47ec1..8b26c209d3 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php
@@ -17,7 +17,7 @@ abstract class AbstractAnnotationLoaderTest extends TestCase
{
public function getReader()
{
- return $this->getMockBuilder('Doctrine\Common\Annotations\Reader')
+ return $this->getMockBuilder(\Doctrine\Common\Annotations\Reader::class)
->disableOriginalConstructor()
->getMock()
;
@@ -25,7 +25,7 @@ abstract class AbstractAnnotationLoaderTest extends TestCase
public function getClassLoader($reader)
{
- return $this->getMockBuilder('Symfony\Component\Routing\Loader\AnnotationClassLoader')
+ return $this->getMockBuilder(\Symfony\Component\Routing\Loader\AnnotationClassLoader::class)
->setConstructorArgs([$reader])
->getMockForAbstractClass()
;
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
index 47f7921737..ff2dd53909 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
@@ -44,7 +44,7 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
public function testLoadFileWithoutStartTag()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Did you forgot to add the "loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/NoStartTagClass.php');
}
diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php
index 912c1f8b0c..50e75b5fd4 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php
@@ -45,7 +45,7 @@ class ObjectLoaderTest extends TestCase
*/
public function testExceptionWithoutSyntax(string $resourceString)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$loader = new TestObjectLoader();
$loader->load($resourceString);
}
@@ -72,7 +72,7 @@ class ObjectLoaderTest extends TestCase
public function testExceptionOnBadMethod()
{
- $this->expectException('BadMethodCallException');
+ $this->expectException(\BadMethodCallException::class);
$loader = new TestObjectLoader();
$loader->loaderMap = ['my_service' => new \stdClass()];
$loader->load('my_service::method');
@@ -80,8 +80,8 @@ class ObjectLoaderTest extends TestCase
public function testExceptionOnMethodNotReturningCollection()
{
- $this->expectException('LogicException');
- $service = $this->getMockBuilder('stdClass')
+ $this->expectException(\LogicException::class);
+ $service = $this->getMockBuilder(\stdClass::class)
->setMethods(['loadRoutes'])
->getMock();
$service->expects($this->once())
diff --git a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
index f1d03b0c82..c434b254be 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
@@ -22,7 +22,7 @@ class PhpFileLoaderTest extends TestCase
{
public function testSupports()
{
- $loader = new PhpFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
+ $loader = new PhpFileLoader($this->getMockBuilder(FileLocator::class)->getMock());
$this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
index 2f628c4f94..02a77af2e9 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
@@ -23,7 +23,7 @@ class XmlFileLoaderTest extends TestCase
{
public function testSupports()
{
- $loader = new XmlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
+ $loader = new XmlFileLoader($this->getMockBuilder(FileLocator::class)->getMock());
$this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable');
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
@@ -38,7 +38,7 @@ class XmlFileLoaderTest extends TestCase
$routeCollection = $loader->load('validpattern.xml');
$route = $routeCollection->get('blog_show');
- $this->assertInstanceOf('Symfony\Component\Routing\Route', $route);
+ $this->assertInstanceOf(Route::class, $route);
$this->assertSame('/blog/{slug}', $route->getPath());
$this->assertSame('{locale}.example.com', $route->getHost());
$this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
@@ -215,7 +215,7 @@ class XmlFileLoaderTest extends TestCase
*/
public function testLoadThrowsExceptionWithInvalidFile($filePath)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load($filePath);
}
@@ -225,7 +225,7 @@ class XmlFileLoaderTest extends TestCase
*/
public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation($filePath)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$loader = new CustomXmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load($filePath);
}
@@ -237,7 +237,7 @@ class XmlFileLoaderTest extends TestCase
public function testDocTypeIsNotAllowed()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Document types are not allowed.');
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load('withdoctype.xml');
@@ -445,7 +445,7 @@ class XmlFileLoaderTest extends TestCase
public function testOverrideControllerInDefaults()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessageMatches('/The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for "app_blog"/');
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller']));
$loader->load('override_defaults.xml');
@@ -477,7 +477,7 @@ class XmlFileLoaderTest extends TestCase
public function testImportWithOverriddenController()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessageMatches('/The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for the "import" tag/');
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller']));
$loader->load('import_override_defaults.xml');
diff --git a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
index 10ca522d7e..f7c3299c5a 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
@@ -22,7 +22,7 @@ class YamlFileLoaderTest extends TestCase
{
public function testSupports()
{
- $loader = new YamlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
+ $loader = new YamlFileLoader($this->getMockBuilder(FileLocator::class)->getMock());
$this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable');
$this->assertTrue($loader->supports('foo.yaml'), '->supports() returns true if the resource is loadable');
@@ -47,7 +47,7 @@ class YamlFileLoaderTest extends TestCase
*/
public function testLoadThrowsExceptionWithInvalidFile($filePath)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load($filePath);
}
@@ -71,7 +71,7 @@ class YamlFileLoaderTest extends TestCase
$routeCollection = $loader->load('special_route_name.yml');
$route = $routeCollection->get('#$péß^a|');
- $this->assertInstanceOf('Symfony\Component\Routing\Route', $route);
+ $this->assertInstanceOf(Route::class, $route);
$this->assertSame('/true', $route->getPath());
}
@@ -81,7 +81,7 @@ class YamlFileLoaderTest extends TestCase
$routeCollection = $loader->load('validpattern.yml');
$route = $routeCollection->get('blog_show');
- $this->assertInstanceOf('Symfony\Component\Routing\Route', $route);
+ $this->assertInstanceOf(Route::class, $route);
$this->assertSame('/blog/{slug}', $route->getPath());
$this->assertSame('{locale}.example.com', $route->getHost());
$this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
@@ -144,7 +144,7 @@ class YamlFileLoaderTest extends TestCase
public function testOverrideControllerInDefaults()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessageMatches('/The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "app_blog"/');
$loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller']));
$loader->load('override_defaults.yml');
@@ -176,7 +176,7 @@ class YamlFileLoaderTest extends TestCase
public function testImportWithOverriddenController()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessageMatches('/The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "_static"/');
$loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller']));
$loader->load('import_override_defaults.yml');
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php
index 72d26933ef..4886d71768 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php
@@ -492,7 +492,7 @@ class CompiledUrlMatcherDumperTest extends TestCase
public function testGenerateDumperMatcherWithObject()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Symfony\Component\Routing\Route cannot contain objects');
$routeCollection = new RouteCollection();
$routeCollection->add('_', new Route('/', [new \stdClass()]));
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index 1461b4b911..83dfe2d62d 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -39,7 +39,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
public function testRedirectWhenNoSlashForNonSafeMethod()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(\Symfony\Component\Routing\Exception\ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/'));
@@ -209,6 +209,6 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
{
- return $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', [$routes, $context ?: new RequestContext()]);
+ return $this->getMockForAbstractClass(\Symfony\Component\Routing\Matcher\RedirectableUrlMatcher::class, [$routes, $context ?: new RequestContext()]);
}
}
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
index c6846ae8b5..3adb4a9d58 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -198,7 +198,7 @@ class UrlMatcherTest extends TestCase
public function testShortPathDoesNotMatchImportantVariable()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$collection = new RouteCollection();
$collection->add('index', new Route('/index.{!_format}', ['_format' => 'xml']));
@@ -208,7 +208,7 @@ class UrlMatcherTest extends TestCase
public function testTrailingEncodedNewlineIsNotOverlooked()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo'));
@@ -249,7 +249,7 @@ class UrlMatcherTest extends TestCase
$matcher = $this->getUrlMatcher($collection);
$this->assertEquals(['_route' => 'foo'], $matcher->match('/foo1'));
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$this->assertEquals([], $matcher->match('/foo'));
}
@@ -318,7 +318,7 @@ class UrlMatcherTest extends TestCase
// z and _format are optional.
$this->assertEquals(['w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'], $matcher->match('/wwwwwxy'));
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$matcher->match('/wxy.html');
}
@@ -333,7 +333,7 @@ class UrlMatcherTest extends TestCase
// Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match.
// But here the 't' in 'get' is not a separating character, so it makes no sense to match without it.
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$matcher->match('/ge');
}
@@ -357,7 +357,7 @@ class UrlMatcherTest extends TestCase
public function testDefaultRequirementOfVariableDisallowsSlash()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}'));
$matcher = $this->getUrlMatcher($coll);
@@ -367,7 +367,7 @@ class UrlMatcherTest extends TestCase
public function testDefaultRequirementOfVariableDisallowsNextSeparator()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}', [], ['_format' => 'html|xml']));
$matcher = $this->getUrlMatcher($coll);
@@ -377,7 +377,7 @@ class UrlMatcherTest extends TestCase
public function testMissingTrailingSlash()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/'));
@@ -387,7 +387,7 @@ class UrlMatcherTest extends TestCase
public function testExtraTrailingSlash()
{
- $this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo'));
@@ -397,7 +397,7 @@ class UrlMatcherTest extends TestCase
public function testMissingTrailingSlashForNonSafeMethod()
{
- $this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/'));
@@ -409,7 +409,7 @@ class UrlMatcherTest extends TestCase
public function testExtraTrailingSlashForNonSafeMethod()
{
- $this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo'));
@@ -421,7 +421,7 @@ class UrlMatcherTest extends TestCase
public function testSchemeRequirement()
{
- $this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
$matcher = $this->getUrlMatcher($coll);
@@ -430,7 +430,7 @@ class UrlMatcherTest extends TestCase
public function testSchemeRequirementForNonSafeMethod()
{
- $this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
@@ -451,7 +451,7 @@ class UrlMatcherTest extends TestCase
public function testCondition()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$route = new Route('/foo');
$route->setCondition('context.getMethod() == "POST"');
@@ -658,7 +658,7 @@ class UrlMatcherTest extends TestCase
public function testWithOutHostHostDoesNotMatch()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{foo}', [], [], [], '{locale}.example.com'));
@@ -668,7 +668,7 @@ class UrlMatcherTest extends TestCase
public function testPathIsCaseSensitive()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$coll = new RouteCollection();
$coll->add('foo', new Route('/locale', [], ['locale' => 'EN|FR|DE']));
@@ -687,7 +687,7 @@ class UrlMatcherTest extends TestCase
public function testNoConfiguration()
{
- $this->expectException('Symfony\Component\Routing\Exception\NoConfigurationException');
+ $this->expectException(\Symfony\Component\Routing\Exception\NoConfigurationException::class);
$coll = new RouteCollection();
$matcher = $this->getUrlMatcher($coll);
@@ -720,7 +720,7 @@ class UrlMatcherTest extends TestCase
public function testSchemeAndMethodMismatch()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException(ResourceNotFoundException::class);
$this->expectExceptionMessage('No routes found for "/".');
$coll = new RouteCollection();
$coll->add('foo', new Route('/', [], [], [], null, ['https'], ['POST']));
diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
index 8d4729e135..97cd237850 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
@@ -26,8 +26,8 @@ class RouteCollectionBuilderTest extends TestCase
{
public function testImport()
{
- $resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
- $resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
+ $resolvedLoader = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderInterface::class)->getMock();
+ $resolver = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderResolverInterface::class)->getMock();
$resolver->expects($this->once())
->method('resolve')
->with('admin_routing.yml', 'yaml')
@@ -44,7 +44,7 @@ class RouteCollectionBuilderTest extends TestCase
->with('admin_routing.yml', 'yaml')
->willReturn($expectedCollection);
- $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderInterface::class)->getMock();
$loader->expects($this->any())
->method('getResolver')
->willReturn($resolver);
@@ -54,7 +54,7 @@ class RouteCollectionBuilderTest extends TestCase
$importedRoutes = $routes->import('admin_routing.yml', '/', 'yaml');
// we should get back a RouteCollectionBuilder
- $this->assertInstanceOf('Symfony\Component\Routing\RouteCollectionBuilder', $importedRoutes);
+ $this->assertInstanceOf(RouteCollectionBuilder::class, $importedRoutes);
// get the collection back so we can look at it
$addedCollection = $importedRoutes->build();
@@ -80,7 +80,7 @@ class RouteCollectionBuilderTest extends TestCase
public function testImportWithoutLoaderThrowsException()
{
- $this->expectException('BadMethodCallException');
+ $this->expectException(\BadMethodCallException::class);
$collectionBuilder = new RouteCollectionBuilder();
$collectionBuilder->import('routing.yml');
}
@@ -91,7 +91,7 @@ class RouteCollectionBuilderTest extends TestCase
$addedRoute = $collectionBuilder->add('/checkout', 'AppBundle:Order:checkout');
$addedRoute2 = $collectionBuilder->add('/blogs', 'AppBundle:Blog:list', 'blog_list');
- $this->assertInstanceOf('Symfony\Component\Routing\Route', $addedRoute);
+ $this->assertInstanceOf(Route::class, $addedRoute);
$this->assertEquals('AppBundle:Order:checkout', $addedRoute->getDefault('_controller'));
$finalCollection = $collectionBuilder->build();
@@ -104,7 +104,7 @@ class RouteCollectionBuilderTest extends TestCase
$importedCollection->add('imported_route1', new Route('/imported/foo1'));
$importedCollection->add('imported_route2', new Route('/imported/foo2'));
- $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderInterface::class)->getMock();
// make this loader able to do the import - keeps mocking simple
$loader->expects($this->any())
->method('supports')
@@ -267,7 +267,7 @@ class RouteCollectionBuilderTest extends TestCase
public function testFlushSetsPrefixedWithMultipleLevels()
{
- $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderInterface::class)->getMock();
$routes = new RouteCollectionBuilder($loader);
$routes->add('homepage', 'MainController::homepageAction', 'homepage');
@@ -345,7 +345,7 @@ class RouteCollectionBuilderTest extends TestCase
$secondCollection = new RouteCollection();
$secondCollection->add('b', new Route('/b'));
- $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderInterface::class)->getMock();
$loader->expects($this->any())
->method('supports')
->willReturn(true);
diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
index 07fa2bb62b..6f5b91f572 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
@@ -22,7 +22,7 @@ class RouteCompilerTest extends TestCase
*/
public function testCompile($name, $arguments, $prefix, $regex, $variables, $tokens)
{
- $r = new \ReflectionClass('Symfony\\Component\\Routing\\Route');
+ $r = new \ReflectionClass(Route::class);
$route = $r->newInstanceArgs($arguments);
$compiled = $route->compile();
@@ -188,8 +188,8 @@ class RouteCompilerTest extends TestCase
*/
public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, $variables, $tokens, $deprecationType)
{
- $this->expectException('LogicException');
- $r = new \ReflectionClass('Symfony\\Component\\Routing\\Route');
+ $this->expectException(\LogicException::class);
+ $r = new \ReflectionClass(Route::class);
$route = $r->newInstanceArgs($arguments);
$compiled = $route->compile();
@@ -244,7 +244,7 @@ class RouteCompilerTest extends TestCase
public function testRouteWithSameVariableTwice()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$route = new Route('/{name}/{name}');
$route->compile();
@@ -252,7 +252,7 @@ class RouteCompilerTest extends TestCase
public function testRouteCharsetMismatch()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$route = new Route("/\xE9/{bar}", [], ['bar' => '.'], ['utf8' => true]);
$route->compile();
@@ -260,7 +260,7 @@ class RouteCompilerTest extends TestCase
public function testRequirementCharsetMismatch()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$route = new Route('/foo/{bar}', [], ['bar' => "\xE9"], ['utf8' => true]);
$route->compile();
@@ -268,7 +268,7 @@ class RouteCompilerTest extends TestCase
public function testRouteWithFragmentAsPathParameter()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$route = new Route('/{_fragment}');
$route->compile();
@@ -279,7 +279,7 @@ class RouteCompilerTest extends TestCase
*/
public function testRouteWithVariableNameStartingWithADigit($name)
{
- $this->expectException('DomainException');
+ $this->expectException(\DomainException::class);
$route = new Route('/{'.$name.'}');
$route->compile();
}
@@ -298,7 +298,7 @@ class RouteCompilerTest extends TestCase
*/
public function testCompileWithHost($name, $arguments, $prefix, $regex, $variables, $pathVariables, $tokens, $hostRegex, $hostVariables, $hostTokens)
{
- $r = new \ReflectionClass('Symfony\\Component\\Routing\\Route');
+ $r = new \ReflectionClass(Route::class);
$route = $r->newInstanceArgs($arguments);
$compiled = $route->compile();
@@ -366,7 +366,7 @@ class RouteCompilerTest extends TestCase
public function testRouteWithTooLongVariableName()
{
- $this->expectException('DomainException');
+ $this->expectException(\DomainException::class);
$route = new Route(sprintf('/{%s}', str_repeat('a', RouteCompiler::VARIABLE_MAXIMUM_LENGTH + 1)));
$route->compile();
}
diff --git a/src/Symfony/Component/Routing/Tests/RouteTest.php b/src/Symfony/Component/Routing/Tests/RouteTest.php
index c07cb3324a..812094dbb8 100644
--- a/src/Symfony/Component/Routing/Tests/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteTest.php
@@ -137,7 +137,7 @@ class RouteTest extends TestCase
*/
public function testSetInvalidRequirement($req)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$route = new Route('/{foo}');
$route->setRequirement('foo', $req);
}
@@ -198,7 +198,7 @@ class RouteTest extends TestCase
public function testCompile()
{
$route = new Route('/{foo}');
- $this->assertInstanceOf('Symfony\Component\Routing\CompiledRoute', $compiled = $route->compile(), '->compile() returns a compiled route');
+ $this->assertInstanceOf(\Symfony\Component\Routing\CompiledRoute::class, $compiled = $route->compile(), '->compile() returns a compiled route');
$this->assertSame($compiled, $route->compile(), '->compile() only compiled the route once if unchanged');
$route->setRequirement('foo', '.*');
$this->assertNotSame($compiled, $route->compile(), '->compile() recompiles if the route was modified');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
index e454852ddf..e7f13b8e6d 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
@@ -26,13 +26,13 @@ class AuthenticationProviderManagerTest extends TestCase
{
public function testAuthenticateWithoutProviders()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new AuthenticationProviderManager([]);
}
public function testAuthenticateWithProvidersWithIncorrectInterface()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
(new AuthenticationProviderManager([
new \stdClass(),
]))->authenticate($this->getMockBuilder(TokenInterface::class)->getMock());
@@ -45,7 +45,7 @@ class AuthenticationProviderManagerTest extends TestCase
]);
try {
- $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $manager->authenticate($token = $this->getMockBuilder(TokenInterface::class)->getMock());
$this->fail();
} catch (ProviderNotFoundException $e) {
$this->assertSame($token, $e->getToken());
@@ -54,7 +54,7 @@ class AuthenticationProviderManagerTest extends TestCase
public function testAuthenticateWhenProviderReturnsAccountStatusException()
{
- $secondAuthenticationProvider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock();
+ $secondAuthenticationProvider = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock();
$manager = new AuthenticationProviderManager([
$this->getAuthenticationProvider(true, null, 'Symfony\Component\Security\Core\Exception\AccountStatusException'),
@@ -65,7 +65,7 @@ class AuthenticationProviderManagerTest extends TestCase
$secondAuthenticationProvider->expects($this->never())->method('supports');
try {
- $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $manager->authenticate($token = $this->getMockBuilder(TokenInterface::class)->getMock());
$this->fail();
} catch (AccountStatusException $e) {
$this->assertSame($token, $e->getToken());
@@ -79,7 +79,7 @@ class AuthenticationProviderManagerTest extends TestCase
]);
try {
- $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $manager->authenticate($token = $this->getMockBuilder(TokenInterface::class)->getMock());
$this->fail();
} catch (AuthenticationException $e) {
$this->assertSame($token, $e->getToken());
@@ -90,26 +90,26 @@ class AuthenticationProviderManagerTest extends TestCase
{
$manager = new AuthenticationProviderManager([
$this->getAuthenticationProvider(true, null, 'Symfony\Component\Security\Core\Exception\AuthenticationException'),
- $this->getAuthenticationProvider(true, $expected = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()),
+ $this->getAuthenticationProvider(true, $expected = $this->getMockBuilder(TokenInterface::class)->getMock()),
]);
- $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $token = $manager->authenticate($this->getMockBuilder(TokenInterface::class)->getMock());
$this->assertSame($expected, $token);
}
public function testAuthenticateReturnsTokenOfTheFirstMatchingProvider()
{
- $second = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock();
+ $second = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock();
$second
->expects($this->never())
->method('supports')
;
$manager = new AuthenticationProviderManager([
- $this->getAuthenticationProvider(true, $expected = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()),
+ $this->getAuthenticationProvider(true, $expected = $this->getMockBuilder(TokenInterface::class)->getMock()),
$second,
]);
- $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $token = $manager->authenticate($this->getMockBuilder(TokenInterface::class)->getMock());
$this->assertSame($expected, $token);
}
@@ -119,25 +119,25 @@ class AuthenticationProviderManagerTest extends TestCase
$this->getAuthenticationProvider(true, $token = new UsernamePasswordToken('foo', 'bar', 'key')),
]);
- $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $token = $manager->authenticate($this->getMockBuilder(TokenInterface::class)->getMock());
$this->assertEquals('', $token->getCredentials());
$manager = new AuthenticationProviderManager([
$this->getAuthenticationProvider(true, $token = new UsernamePasswordToken('foo', 'bar', 'key')),
], false);
- $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $token = $manager->authenticate($this->getMockBuilder(TokenInterface::class)->getMock());
$this->assertEquals('bar', $token->getCredentials());
}
public function testAuthenticateDispatchesAuthenticationFailureEvent()
{
$token = new UsernamePasswordToken('foo', 'bar', 'key');
- $provider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock();
+ $provider = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock();
$provider->expects($this->once())->method('supports')->willReturn(true);
$provider->expects($this->once())->method('authenticate')->willThrowException($exception = new AuthenticationException());
- $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
+ $dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
$dispatcher
->expects($this->once())
->method('dispatch')
@@ -158,11 +158,11 @@ class AuthenticationProviderManagerTest extends TestCase
{
$token = new UsernamePasswordToken('foo', 'bar', 'key');
- $provider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock();
+ $provider = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock();
$provider->expects($this->once())->method('supports')->willReturn(true);
$provider->expects($this->once())->method('authenticate')->willReturn($token);
- $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
+ $dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
$dispatcher
->expects($this->once())
->method('dispatch')
@@ -176,7 +176,7 @@ class AuthenticationProviderManagerTest extends TestCase
protected function getAuthenticationProvider($supports, $token = null, $exception = null)
{
- $provider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock();
+ $provider = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock();
$provider->expects($this->once())
->method('supports')
->willReturn($supports)
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php
index 41dc885dcf..d4e144484e 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php
@@ -91,17 +91,17 @@ class AuthenticationTrustResolverTest extends TestCase
protected function getToken()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ return $this->getMockBuilder(TokenInterface::class)->getMock();
}
protected function getAnonymousToken()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken')->setConstructorArgs(['', ''])->getMock();
+ return $this->getMockBuilder(AnonymousToken::class)->setConstructorArgs(['', ''])->getMock();
}
protected function getRememberMeToken()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken')->setMethods(['setPersistent'])->disableOriginalConstructor()->getMock();
+ return $this->getMockBuilder(RememberMeToken::class)->setMethods(['setPersistent'])->disableOriginalConstructor()->getMock();
}
protected function getResolver()
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
index 85ed848a79..e0fe4a8a11 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
@@ -21,21 +21,21 @@ class AnonymousAuthenticationProviderTest extends TestCase
$provider = $this->getProvider('foo');
$this->assertTrue($provider->supports($this->getSupportedToken('foo')));
- $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
+ $this->assertFalse($provider->supports($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock()));
}
public function testAuthenticateWhenTokenIsNotSupported()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationException::class);
$this->expectExceptionMessage('The token is not supported by this authentication provider.');
$provider = $this->getProvider('foo');
- $provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $provider->authenticate($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock());
}
public function testAuthenticateWhenSecretIsNotValid()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$provider = $this->getProvider('foo');
$provider->authenticate($this->getSupportedToken('bar'));
@@ -51,7 +51,7 @@ class AnonymousAuthenticationProviderTest extends TestCase
protected function getSupportedToken($secret)
{
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken')->setMethods(['getSecret'])->disableOriginalConstructor()->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\AnonymousToken::class)->setMethods(['getSecret'])->disableOriginalConstructor()->getMock();
$token->expects($this->any())
->method('getSecret')
->willReturn($secret)
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
index 065a04a263..e3f0d72134 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
@@ -30,11 +30,11 @@ class LdapBindAuthenticationProviderTest extends TestCase
{
public function testEmptyPasswordShouldThrowAnException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$this->expectExceptionMessage('The presented password must not be empty.');
- $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
+ $userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
- $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
+ $userChecker = $this->getMockBuilder(UserCheckerInterface::class)->getMock();
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap);
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
@@ -45,11 +45,11 @@ class LdapBindAuthenticationProviderTest extends TestCase
public function testNullPasswordShouldThrowAnException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$this->expectExceptionMessage('The presented password must not be empty.');
- $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
- $ldap = $this->getMockBuilder('Symfony\Component\Ldap\LdapInterface')->getMock();
- $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
+ $userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
+ $ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
+ $userChecker = $this->getMockBuilder(UserCheckerInterface::class)->getMock();
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap);
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
@@ -60,7 +60,7 @@ class LdapBindAuthenticationProviderTest extends TestCase
public function testBindFailureShouldThrowAnException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$this->expectExceptionMessage('The presented password is invalid.');
$userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
@@ -182,7 +182,7 @@ class LdapBindAuthenticationProviderTest extends TestCase
public function testEmptyQueryResultShouldThrowAnException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$this->expectExceptionMessage('The presented username is invalid.');
$userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
index f5c7b98a28..ce686aac1f 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
@@ -29,7 +29,7 @@ class InMemoryTokenProviderTest extends TestCase
public function testLoadTokenBySeriesThrowsNotFoundException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\TokenNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\TokenNotFoundException::class);
$provider = new InMemoryTokenProvider();
$provider->loadTokenBySeries('foo');
}
@@ -49,7 +49,7 @@ class InMemoryTokenProviderTest extends TestCase
public function testDeleteToken()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\TokenNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\TokenNotFoundException::class);
$provider = new InMemoryTokenProvider();
$token = new PersistentToken('foo', 'foo', 'foo', 'foo', new \DateTime());
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
index 58ecff77bf..4519146562 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
@@ -30,7 +30,7 @@ class RememberMeTokenTest extends TestCase
public function testConstructorSecretCannotBeEmptyString()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new RememberMeToken(
$this->getUser(),
'',
@@ -40,7 +40,7 @@ class RememberMeTokenTest extends TestCase
protected function getUser($roles = ['ROLE_FOO'])
{
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$user
->expects($this->any())
->method('getRoles')
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
index 0593c9f974..7c6961ce58 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
@@ -29,7 +29,7 @@ class UsernamePasswordTokenTest extends TestCase
public function testSetAuthenticatedToTrue()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$token = new UsernamePasswordToken('foo', 'bar', 'key');
$token->setAuthenticated(true);
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
index 12e78ad460..7228af7656 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
@@ -26,8 +26,8 @@ class AuthorizationCheckerTest extends TestCase
protected function setUp(): void
{
- $this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
- $this->accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
+ $this->authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
+ $this->accessDecisionManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface::class)->getMock();
$this->tokenStorage = new TokenStorage();
$this->authorizationChecker = new AuthorizationChecker(
@@ -70,7 +70,7 @@ class AuthorizationCheckerTest extends TestCase
public function testVoteWithoutAuthenticationToken()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException::class);
$this->authorizationChecker->isGranted('ROLE_FOO');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
index dc1d391477..7899b6a60b 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
@@ -22,7 +22,7 @@ class VoterTest extends TestCase
protected function setUp(): void
{
- $this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $this->token = $this->getMockBuilder(TokenInterface::class)->getMock();
}
public function getTests()
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
index eb2dc498b4..3df2f21120 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
@@ -30,7 +30,7 @@ class EncoderFactoryTest extends TestCase
'arguments' => ['sha512', true, 5],
]]);
- $encoder = $factory->getEncoder($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock());
+ $encoder = $factory->getEncoder($this->getMockBuilder(UserInterface::class)->getMock());
$expectedEncoder = new MessageDigestPasswordEncoder('sha512', true, 5);
$this->assertEquals($expectedEncoder->encodePassword('foo', 'moo'), $encoder->encodePassword('foo', 'moo'));
@@ -42,7 +42,7 @@ class EncoderFactoryTest extends TestCase
'Symfony\Component\Security\Core\User\UserInterface' => new MessageDigestPasswordEncoder('sha1'),
]);
- $encoder = $factory->getEncoder($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock());
+ $encoder = $factory->getEncoder($this->getMockBuilder(UserInterface::class)->getMock());
$expectedEncoder = new MessageDigestPasswordEncoder('sha1');
$this->assertEquals($expectedEncoder->encodePassword('foo', ''), $encoder->encodePassword('foo', ''));
@@ -112,7 +112,7 @@ class EncoderFactoryTest extends TestCase
public function testGetInvalidNamedEncoderForEncoderAware()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$factory = new EncoderFactory([
'Symfony\Component\Security\Core\Tests\Encoder\EncAwareUser' => new MessageDigestPasswordEncoder('sha1'),
'encoder_name' => new MessageDigestPasswordEncoder('sha256'),
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
index d1061c4211..0e2942b185 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
@@ -37,14 +37,14 @@ class MessageDigestPasswordEncoderTest extends TestCase
public function testEncodePasswordAlgorithmDoesNotExist()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$encoder = new MessageDigestPasswordEncoder('foobar');
$encoder->encodePassword('password', '');
}
public function testEncodePasswordLength()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$encoder = new MessageDigestPasswordEncoder();
$encoder->encodePassword(str_repeat('a', 5000), 'salt');
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php
index 7ee256f040..c67bf8668b 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php
@@ -21,13 +21,13 @@ class NativePasswordEncoderTest extends TestCase
{
public function testCostBelowRange()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new NativePasswordEncoder(null, null, 3);
}
public function testCostAboveRange()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new NativePasswordEncoder(null, null, 32);
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
index 37a1f2d3cf..82ed24e3f5 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
@@ -37,14 +37,14 @@ class Pbkdf2PasswordEncoderTest extends TestCase
public function testEncodePasswordAlgorithmDoesNotExist()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$encoder = new Pbkdf2PasswordEncoder('foobar');
$encoder->encodePassword('password', '');
}
public function testEncodePasswordLength()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$encoder = new Pbkdf2PasswordEncoder('foobar');
$encoder->encodePassword(str_repeat('a', 5000), 'salt');
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
index 3f6efccd49..40c038b65a 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
@@ -40,7 +40,7 @@ class PlaintextPasswordEncoderTest extends TestCase
public function testEncodePasswordLength()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$encoder = new PlaintextPasswordEncoder();
$encoder->encodePassword(str_repeat('a', 5000), 'salt');
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php
index 2c4527fef7..b2c5bd186b 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php
@@ -49,7 +49,7 @@ class SodiumPasswordEncoderTest extends TestCase
public function testEncodePasswordLength()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$encoder = new SodiumPasswordEncoder();
$encoder->encodePassword(str_repeat('a', 4097), 'salt');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php
index fb98c0bda2..2c0a265f3f 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php
@@ -21,18 +21,18 @@ class UserPasswordEncoderTest extends TestCase
{
public function testEncodePassword()
{
- $userMock = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $userMock = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$userMock->expects($this->any())
->method('getSalt')
->willReturn('userSalt');
- $mockEncoder = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface')->getMock();
+ $mockEncoder = $this->getMockBuilder(\Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface::class)->getMock();
$mockEncoder->expects($this->any())
->method('encodePassword')
->with($this->equalTo('plainPassword'), $this->equalTo('userSalt'))
->willReturn('encodedPassword');
- $mockEncoderFactory = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface')->getMock();
+ $mockEncoderFactory = $this->getMockBuilder(EncoderFactoryInterface::class)->getMock();
$mockEncoderFactory->expects($this->any())
->method('getEncoder')
->with($this->equalTo($userMock))
@@ -46,7 +46,7 @@ class UserPasswordEncoderTest extends TestCase
public function testIsPasswordValid()
{
- $userMock = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $userMock = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$userMock->expects($this->any())
->method('getSalt')
->willReturn('userSalt');
@@ -54,13 +54,13 @@ class UserPasswordEncoderTest extends TestCase
->method('getPassword')
->willReturn('encodedPassword');
- $mockEncoder = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface')->getMock();
+ $mockEncoder = $this->getMockBuilder(\Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface::class)->getMock();
$mockEncoder->expects($this->any())
->method('isPasswordValid')
->with($this->equalTo('encodedPassword'), $this->equalTo('plainPassword'), $this->equalTo('userSalt'))
->willReturn(true);
- $mockEncoderFactory = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface')->getMock();
+ $mockEncoderFactory = $this->getMockBuilder(EncoderFactoryInterface::class)->getMock();
$mockEncoderFactory->expects($this->any())
->method('getEncoder')
->with($this->equalTo($userMock))
diff --git a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
index aaf3e5291c..29440ce159 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
@@ -44,7 +44,7 @@ class ChainUserProviderTest extends TestCase
public function testLoadUserByUsernameThrowsUsernameNotFoundException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
+ $this->expectException(UsernameNotFoundException::class);
$provider1 = $this->getProvider();
$provider1
->expects($this->once())
@@ -138,7 +138,7 @@ class ChainUserProviderTest extends TestCase
public function testRefreshUserThrowsUnsupportedUserException()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\UnsupportedUserException');
+ $this->expectException(UnsupportedUserException::class);
$provider1 = $this->getProvider();
$provider1
->expects($this->once())
@@ -269,11 +269,11 @@ class ChainUserProviderTest extends TestCase
protected function getAccount()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
}
protected function getProvider()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserProviderInterface::class)->getMock();
}
}
diff --git a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
index bec7307234..ad2b038287 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
@@ -62,7 +62,7 @@ class InMemoryUserProviderTest extends TestCase
public function testCreateUserAlreadyExist()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$provider = new InMemoryUserProvider();
$provider->createUser(new User('fabien', 'foo'));
$provider->createUser(new User('fabien', 'foo'));
@@ -70,7 +70,7 @@ class InMemoryUserProviderTest extends TestCase
public function testLoadUserByUsernameDoesNotExist()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\UsernameNotFoundException::class);
$provider = new InMemoryUserProvider();
$provider->loadUserByUsername('fabien');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
index 7468e95244..240e6ab4e9 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
@@ -20,7 +20,7 @@ class UserTest extends TestCase
{
public function testConstructorException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
new User('', 'superpass');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
index 460e118ece..d4abf8f3f3 100644
--- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
@@ -121,8 +121,8 @@ abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
public function testUserIsNotValid()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
- $user = $this->getMockBuilder('Foo\Bar\User')->getMock();
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
+ $user = $this->getMockBuilder(\Foo\Bar\User::class)->getMock();
$this->tokenStorage = $this->createTokenStorage($user);
$this->validator = $this->createValidator();
@@ -133,7 +133,7 @@ abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
protected function createUser()
{
- $mock = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $mock = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$mock
->expects($this->any())
@@ -152,12 +152,12 @@ abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
protected function createPasswordEncoder($isPasswordValid = true)
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface')->getMock();
+ return $this->getMockBuilder(PasswordEncoderInterface::class)->getMock();
}
protected function createEncoderFactory($encoder = null)
{
- $mock = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface')->getMock();
+ $mock = $this->getMockBuilder(EncoderFactoryInterface::class)->getMock();
$mock
->expects($this->any())
@@ -172,7 +172,7 @@ abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
{
$token = $this->createAuthenticationToken($user);
- $mock = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
+ $mock = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$mock
->expects($this->any())
->method('getToken')
@@ -184,7 +184,7 @@ abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
protected function createAuthenticationToken($user = null)
{
- $mock = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $mock = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$mock
->expects($this->any())
->method('getUser')
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
index 5acbedc6e9..fadb87e6ab 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
@@ -88,7 +88,7 @@ class NativeSessionTokenStorageTest extends TestCase
public function testGetNonExistingToken()
{
- $this->expectException('Symfony\Component\Security\Csrf\Exception\TokenNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Csrf\Exception\TokenNotFoundException::class);
$this->storage->getToken('token_id');
}
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
index af5b0ebc8b..deccfaa53b 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
@@ -88,13 +88,13 @@ class SessionTokenStorageTest extends TestCase
public function testGetNonExistingTokenFromClosedSession()
{
- $this->expectException('Symfony\Component\Security\Csrf\Exception\TokenNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Csrf\Exception\TokenNotFoundException::class);
$this->storage->getToken('token_id');
}
public function testGetNonExistingTokenFromActiveSession()
{
- $this->expectException('Symfony\Component\Security\Csrf\Exception\TokenNotFoundException');
+ $this->expectException(\Symfony\Component\Security\Csrf\Exception\TokenNotFoundException::class);
$this->session->start();
$this->storage->getToken('token_id');
}
diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
index 1e6d9d8995..129df28c3b 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
@@ -36,7 +36,7 @@ class FormLoginAuthenticatorTest extends TestCase
{
$failureResponse = $this->authenticator->onAuthenticationFailure($this->requestWithoutSession, new AuthenticationException());
- $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
@@ -48,7 +48,7 @@ class FormLoginAuthenticatorTest extends TestCase
$failureResponse = $this->authenticator->onAuthenticationFailure($this->requestWithSession, new AuthenticationException());
- $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
@@ -63,7 +63,7 @@ class FormLoginAuthenticatorTest extends TestCase
{
$failureResponse = $this->authenticator->start($this->requestWithoutSession, new AuthenticationException());
- $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
@@ -71,7 +71,7 @@ class FormLoginAuthenticatorTest extends TestCase
{
$failureResponse = $this->authenticator->start($this->requestWithSession, new AuthenticationException());
- $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
@@ -80,7 +80,7 @@ class FormLoginAuthenticatorTest extends TestCase
$this->requestWithoutSession = new Request([], [], [], [], [], []);
$this->requestWithSession = new Request([], [], [], [], [], []);
- $session = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface')
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)
->disableOriginalConstructor()
->getMock();
$this->requestWithSession->setSession($session);
diff --git a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
index c5e1c92b89..7167ba3dc4 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
@@ -234,7 +234,7 @@ class GuardAuthenticationListenerTest extends TestCase
public function testReturnNullFromGetCredentials()
{
- $this->expectException('UnexpectedValueException');
+ $this->expectException(\UnexpectedValueException::class);
$authenticator = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
$providerKey = 'my_firewall4';
@@ -262,17 +262,17 @@ class GuardAuthenticationListenerTest extends TestCase
protected function setUp(): void
{
- $this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager')
+ $this->authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager::class)
->disableOriginalConstructor()
->getMock();
- $this->guardAuthenticatorHandler = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorHandler')
+ $this->guardAuthenticatorHandler = $this->getMockBuilder(\Symfony\Component\Security\Guard\GuardAuthenticatorHandler::class)
->disableOriginalConstructor()
->getMock();
$this->request = new Request([], [], [], [], [], []);
- $this->event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\RequestEvent')
+ $this->event = $this->getMockBuilder(\Symfony\Component\HttpKernel\Event\RequestEvent::class)
->disableOriginalConstructor()
->setMethods(['getRequest'])
->getMock();
@@ -281,8 +281,8 @@ class GuardAuthenticationListenerTest extends TestCase
->method('getRequest')
->willReturn($this->request);
- $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
- $this->rememberMeServices = $this->getMockBuilder('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface')->getMock();
+ $this->logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
+ $this->rememberMeServices = $this->getMockBuilder(\Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface::class)->getMock();
}
protected function tearDown(): void
diff --git a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
index e078a6be12..6309462cc1 100644
--- a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
@@ -190,7 +190,7 @@ class GuardAuthenticatorHandlerTest extends TestCase
private function configurePreviousSession()
{
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
$session->expects($this->any())
->method('getName')
->willReturn('test_session_name');
diff --git a/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php b/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php
index 1f5356ba9e..865554b25a 100644
--- a/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php
@@ -18,7 +18,7 @@ class AccessMapTest extends TestCase
{
public function testReturnsFirstMatchedPattern()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$requestMatcher1 = $this->getRequestMatcher($request, false);
$requestMatcher2 = $this->getRequestMatcher($request, true);
@@ -31,7 +31,7 @@ class AccessMapTest extends TestCase
public function testReturnsEmptyPatternIfNoneMatched()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$requestMatcher = $this->getRequestMatcher($request, false);
$map = new AccessMap();
@@ -42,7 +42,7 @@ class AccessMapTest extends TestCase
private function getRequestMatcher($request, $matches)
{
- $requestMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcherInterface')->getMock();
+ $requestMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcherInterface::class)->getMock();
$requestMatcher->expects($this->once())
->method('matches')->with($request)
->willReturn($matches);
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
index 8fe7ce0c86..b24769aa75 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
@@ -29,14 +29,14 @@ class DefaultAuthenticationFailureHandlerTest extends TestCase
protected function setUp(): void
{
- $this->httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
- $this->httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
- $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $this->httpKernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
+ $this->httpUtils = $this->getMockBuilder(\Symfony\Component\Security\Http\HttpUtils::class)->getMock();
+ $this->logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
- $this->session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
- $this->request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $this->session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
+ $this->request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$this->request->expects($this->any())->method('getSession')->willReturn($this->session);
- $this->exception = $this->getMockBuilder('Symfony\Component\Security\Core\Exception\AuthenticationException')->setMethods(['getMessage'])->getMock();
+ $this->exception = $this->getMockBuilder(\Symfony\Component\Security\Core\Exception\AuthenticationException::class)->setMethods(['getMessage'])->getMock();
}
public function testForward()
@@ -183,8 +183,8 @@ class DefaultAuthenticationFailureHandlerTest extends TestCase
private function getRequest()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
- $request->attributes = $this->getMockBuilder('Symfony\Component\HttpFoundation\ParameterBag')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
+ $request->attributes = $this->getMockBuilder(\Symfony\Component\HttpFoundation\ParameterBag::class)->getMock();
return $request;
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
index 9a423f3dfe..e9b8ce51e6 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
@@ -23,10 +23,10 @@ class DefaultAuthenticationSuccessHandlerTest extends TestCase
*/
public function testRequestRedirections(Request $request, $options, $redirectedUrl)
{
- $urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
+ $urlGenerator = $this->getMockBuilder(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class)->getMock();
$urlGenerator->expects($this->any())->method('generate')->willReturn('http://localhost/login');
$httpUtils = new HttpUtils($urlGenerator);
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$handler = new DefaultAuthenticationSuccessHandler($httpUtils, $options);
if ($request->hasSession()) {
$handler->setFirewallName('admin');
@@ -36,7 +36,7 @@ class DefaultAuthenticationSuccessHandlerTest extends TestCase
public function getRequestRedirections()
{
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
$session->expects($this->once())->method('get')->with('_security.admin.target_path')->willReturn('/admin/dashboard');
$session->expects($this->once())->method('remove')->with('_security.admin.target_path');
$requestWithSession = Request::create('/');
diff --git a/src/Symfony/Component/Security/Http/Tests/EntryPoint/BasicAuthenticationEntryPointTest.php b/src/Symfony/Component/Security/Http/Tests/EntryPoint/BasicAuthenticationEntryPointTest.php
index 711d4e2f1f..7c7f3a1f8b 100644
--- a/src/Symfony/Component/Security/Http/Tests/EntryPoint/BasicAuthenticationEntryPointTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/EntryPoint/BasicAuthenticationEntryPointTest.php
@@ -19,7 +19,7 @@ class BasicAuthenticationEntryPointTest extends TestCase
{
public function testStart()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$authException = new AuthenticationException('The exception message');
@@ -32,7 +32,7 @@ class BasicAuthenticationEntryPointTest extends TestCase
public function testStartWithoutAuthException()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$entryPoint = new BasicAuthenticationEntryPoint('TheRealmName');
diff --git a/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php b/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
index 05c5930ec8..432c8dd7a3 100644
--- a/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
@@ -21,11 +21,11 @@ class FormAuthenticationEntryPointTest extends TestCase
{
public function testStart()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$response = new RedirectResponse('/the/login/path');
- $httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
- $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
+ $httpKernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
+ $httpUtils = $this->getMockBuilder(\Symfony\Component\Security\Http\HttpUtils::class)->getMock();
$httpUtils
->expects($this->once())
->method('createRedirectResponse')
@@ -40,11 +40,11 @@ class FormAuthenticationEntryPointTest extends TestCase
public function testStartWithUseForward()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
- $subRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $subRequest = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$response = new Response('', 200);
- $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
+ $httpUtils = $this->getMockBuilder(\Symfony\Component\Security\Http\HttpUtils::class)->getMock();
$httpUtils
->expects($this->once())
->method('createRequest')
@@ -52,7 +52,7 @@ class FormAuthenticationEntryPointTest extends TestCase
->willReturn($subRequest)
;
- $httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $httpKernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$httpKernel
->expects($this->once())
->method('handle')
diff --git a/src/Symfony/Component/Security/Http/Tests/EntryPoint/RetryAuthenticationEntryPointTest.php b/src/Symfony/Component/Security/Http/Tests/EntryPoint/RetryAuthenticationEntryPointTest.php
index 05c85f23b7..643240918c 100644
--- a/src/Symfony/Component/Security/Http/Tests/EntryPoint/RetryAuthenticationEntryPointTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/EntryPoint/RetryAuthenticationEntryPointTest.php
@@ -25,13 +25,13 @@ class RetryAuthenticationEntryPointTest extends TestCase
$entryPoint = new RetryAuthenticationEntryPoint($httpPort, $httpsPort);
$response = $entryPoint->start($request);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response);
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\RedirectResponse::class, $response);
$this->assertEquals($expectedUrl, $response->headers->get('Location'));
}
public function dataForStart()
{
- if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
+ if (!class_exists(Request::class)) {
return [[]];
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php
index 51235bc2e3..22b528edc7 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php
@@ -26,9 +26,9 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
$request = new Request([], [], [], [], [], []);
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -40,15 +40,15 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
->with($this->equalTo($token))
;
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->once())
->method('authenticate')
- ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken'))
+ ->with($this->isInstanceOf(PreAuthenticatedToken::class))
->willReturn($token)
;
- $listener = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener', [
+ $listener = $this->getMockForAbstractClass(\Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener::class, [
$tokenStorage,
$authenticationManager,
'TheProviderKey',
@@ -74,7 +74,7 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
$request = new Request([], [], [], [], [], []);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -86,15 +86,15 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
;
$exception = new AuthenticationException('Authentication failed.');
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->once())
->method('authenticate')
- ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken'))
+ ->with($this->isInstanceOf(PreAuthenticatedToken::class))
->willThrowException($exception)
;
- $listener = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener', [
+ $listener = $this->getMockForAbstractClass(\Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener::class, [
$tokenStorage,
$authenticationManager,
'TheProviderKey',
@@ -122,7 +122,7 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
$request = new Request([], [], [], [], [], []);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -134,15 +134,15 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
;
$exception = new AuthenticationException('Authentication failed.');
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->once())
->method('authenticate')
- ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken'))
+ ->with($this->isInstanceOf(PreAuthenticatedToken::class))
->willThrowException($exception)
;
- $listener = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener', [
+ $listener = $this->getMockForAbstractClass(\Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener::class, [
$tokenStorage,
$authenticationManager,
'TheProviderKey',
@@ -170,20 +170,20 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
$token = new PreAuthenticatedToken('TheUser', 'TheCredentials', 'TheProviderKey', ['ROLE_FOO']);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
->willReturn($token)
;
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->never())
->method('authenticate')
;
- $listener = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener', [
+ $listener = $this->getMockForAbstractClass(\Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener::class, [
$tokenStorage,
$authenticationManager,
'TheProviderKey',
@@ -211,7 +211,7 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
$token = new PreAuthenticatedToken('AnotherUser', 'TheCredentials', 'TheProviderKey', ['ROLE_FOO']);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -224,15 +224,15 @@ class AbstractPreAuthenticatedListenerTest extends TestCase
;
$exception = new AuthenticationException('Authentication failed.');
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->once())
->method('authenticate')
- ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken'))
+ ->with($this->isInstanceOf(PreAuthenticatedToken::class))
->willThrowException($exception)
;
- $listener = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener', [
+ $listener = $this->getMockForAbstractClass(\Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener::class, [
$tokenStorage,
$authenticationManager,
'TheProviderKey',
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
index 6aaf3c6628..91bed331fa 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
@@ -32,10 +32,10 @@ class AccessListenerTest extends TestCase
{
public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\AccessDeniedException::class);
$request = new Request();
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -43,21 +43,21 @@ class AccessListenerTest extends TestCase
->willReturn([['foo' => 'bar'], null])
;
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->any())
->method('isAuthenticated')
->willReturn(true)
;
- $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
+ $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$tokenStorage
->expects($this->any())
->method('getToken')
->willReturn($token)
;
- $accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
+ $accessDecisionManager = $this->getMockBuilder(AccessDecisionManagerInterface::class)->getMock();
$accessDecisionManager
->expects($this->once())
->method('decide')
@@ -69,7 +69,7 @@ class AccessListenerTest extends TestCase
$tokenStorage,
$accessDecisionManager,
$accessMap,
- $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock()
+ $this->getMockBuilder(AuthenticationManagerInterface::class)->getMock()
);
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST));
@@ -79,7 +79,7 @@ class AccessListenerTest extends TestCase
{
$request = new Request();
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -87,21 +87,21 @@ class AccessListenerTest extends TestCase
->willReturn([['foo' => 'bar'], null])
;
- $notAuthenticatedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $notAuthenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$notAuthenticatedToken
->expects($this->any())
->method('isAuthenticated')
->willReturn(false)
;
- $authenticatedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $authenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$authenticatedToken
->expects($this->any())
->method('isAuthenticated')
->willReturn(true)
;
- $authManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authManager = $this->getMockBuilder(AuthenticationManagerInterface::class)->getMock();
$authManager
->expects($this->once())
->method('authenticate')
@@ -109,7 +109,7 @@ class AccessListenerTest extends TestCase
->willReturn($authenticatedToken)
;
- $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
+ $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -121,7 +121,7 @@ class AccessListenerTest extends TestCase
->with($this->equalTo($authenticatedToken))
;
- $accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
+ $accessDecisionManager = $this->getMockBuilder(AccessDecisionManagerInterface::class)->getMock();
$accessDecisionManager
->expects($this->once())
->method('decide')
@@ -143,7 +143,7 @@ class AccessListenerTest extends TestCase
{
$request = new Request();
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -151,13 +151,13 @@ class AccessListenerTest extends TestCase
->willReturn([null, null])
;
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->never())
->method('isAuthenticated')
;
- $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
+ $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -166,9 +166,9 @@ class AccessListenerTest extends TestCase
$listener = new AccessListener(
$tokenStorage,
- $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock(),
+ $this->getMockBuilder(AccessDecisionManagerInterface::class)->getMock(),
$accessMap,
- $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock()
+ $this->getMockBuilder(AuthenticationManagerInterface::class)->getMock()
);
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST));
@@ -206,8 +206,8 @@ class AccessListenerTest extends TestCase
public function testHandleWhenTheSecurityTokenStorageHasNoToken()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
- $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
+ $this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException::class);
+ $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -226,9 +226,9 @@ class AccessListenerTest extends TestCase
$listener = new AccessListener(
$tokenStorage,
- $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock(),
+ $this->getMockBuilder(AccessDecisionManagerInterface::class)->getMock(),
$accessMap,
- $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock()
+ $this->getMockBuilder(AuthenticationManagerInterface::class)->getMock()
);
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST));
@@ -328,7 +328,7 @@ class AccessListenerTest extends TestCase
{
$request = new Request();
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -336,7 +336,7 @@ class AccessListenerTest extends TestCase
->willReturn([['foo' => 'bar', 'bar' => 'baz'], null])
;
- $authenticatedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $authenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$authenticatedToken
->expects($this->any())
->method('isAuthenticated')
@@ -346,7 +346,7 @@ class AccessListenerTest extends TestCase
$tokenStorage = new TokenStorage();
$tokenStorage->setToken($authenticatedToken);
- $accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
+ $accessDecisionManager = $this->getMockBuilder(AccessDecisionManagerInterface::class)->getMock();
$accessDecisionManager
->expects($this->once())
->method('decide')
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
index e6f9f42217..5940ad2e6e 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
@@ -22,18 +22,18 @@ class AnonymousAuthenticationListenerTest extends TestCase
{
public function testHandleWithTokenStorageHavingAToken()
{
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
- ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())
+ ->willReturn($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock())
;
$tokenStorage
->expects($this->never())
->method('setToken')
;
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->never())
->method('authenticate')
@@ -45,7 +45,7 @@ class AnonymousAuthenticationListenerTest extends TestCase
public function testHandleWithTokenStorageHavingNoToken()
{
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -54,7 +54,7 @@ class AnonymousAuthenticationListenerTest extends TestCase
$anonymousToken = new AnonymousToken('TheSecret', 'anon.', []);
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->once())
->method('authenticate')
@@ -76,14 +76,14 @@ class AnonymousAuthenticationListenerTest extends TestCase
public function testHandledEventIsLogged()
{
- $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $tokenStorage = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger->expects($this->once())
->method('info')
->with('Populated the TokenStorage with an anonymous Token.')
;
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new AnonymousAuthenticationListener($tokenStorage, 'TheSecret', $logger, $authenticationManager);
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), new Request(), HttpKernelInterface::MASTER_REQUEST));
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
index f052792001..337a116b9e 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
@@ -29,9 +29,9 @@ class BasicAuthenticationListenerTest extends TestCase
'PHP_AUTH_PW' => 'ThePassword',
]);
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -43,11 +43,11 @@ class BasicAuthenticationListenerTest extends TestCase
->with($this->equalTo($token))
;
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->once())
->method('authenticate')
- ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken'))
+ ->with($this->isInstanceOf(UsernamePasswordToken::class))
->willReturn($token)
;
@@ -55,7 +55,7 @@ class BasicAuthenticationListenerTest extends TestCase
$tokenStorage,
$authenticationManager,
'TheProviderKey',
- $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock()
+ $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock()
);
$event = $this->getMockBuilder(RequestEvent::class)->disableOriginalConstructor()->getMock();
@@ -75,7 +75,7 @@ class BasicAuthenticationListenerTest extends TestCase
'PHP_AUTH_PW' => 'ThePassword',
]);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -88,17 +88,17 @@ class BasicAuthenticationListenerTest extends TestCase
$response = new Response();
- $authenticationEntryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $authenticationEntryPoint = $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock();
$authenticationEntryPoint
->expects($this->any())
->method('start')
- ->with($this->equalTo($request), $this->isInstanceOf('Symfony\Component\Security\Core\Exception\AuthenticationException'))
+ ->with($this->equalTo($request), $this->isInstanceOf(\Symfony\Component\Security\Core\Exception\AuthenticationException::class))
->willReturn($response)
;
$listener = new BasicAuthenticationListener(
$tokenStorage,
- new AuthenticationProviderManager([$this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock()]),
+ new AuthenticationProviderManager([$this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock()]),
'TheProviderKey',
$authenticationEntryPoint
);
@@ -122,7 +122,7 @@ class BasicAuthenticationListenerTest extends TestCase
{
$request = new Request();
- $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();
$tokenStorage
->expects($this->never())
->method('getToken')
@@ -130,9 +130,9 @@ class BasicAuthenticationListenerTest extends TestCase
$listener = new BasicAuthenticationListener(
$tokenStorage,
- $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(),
+ $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock(),
'TheProviderKey',
- $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock()
+ $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock()
);
$event = $this->getMockBuilder(RequestEvent::class)->disableOriginalConstructor()->getMock();
@@ -151,14 +151,14 @@ class BasicAuthenticationListenerTest extends TestCase
$token = new UsernamePasswordToken('TheUsername', 'ThePassword', 'TheProviderKey', ['ROLE_FOO']);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
->willReturn($token)
;
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$authenticationManager
->expects($this->never())
->method('authenticate')
@@ -168,7 +168,7 @@ class BasicAuthenticationListenerTest extends TestCase
$tokenStorage,
$authenticationManager,
'TheProviderKey',
- $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock()
+ $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock()
);
$event = $this->getMockBuilder(RequestEvent::class)->disableOriginalConstructor()->getMock();
@@ -183,13 +183,13 @@ class BasicAuthenticationListenerTest extends TestCase
public function testItRequiresProviderKey()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$providerKey must not be empty');
new BasicAuthenticationListener(
- $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(),
- $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(),
+ $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock(),
+ $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock(),
'',
- $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock()
+ $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock()
);
}
@@ -202,7 +202,7 @@ class BasicAuthenticationListenerTest extends TestCase
$token = new PreAuthenticatedToken('TheUser', 'TheCredentials', 'TheProviderKey', ['ROLE_FOO']);
- $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();
$tokenStorage
->expects($this->any())
->method('getToken')
@@ -215,17 +215,17 @@ class BasicAuthenticationListenerTest extends TestCase
$response = new Response();
- $authenticationEntryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $authenticationEntryPoint = $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock();
$authenticationEntryPoint
->expects($this->any())
->method('start')
- ->with($this->equalTo($request), $this->isInstanceOf('Symfony\Component\Security\Core\Exception\AuthenticationException'))
+ ->with($this->equalTo($request), $this->isInstanceOf(\Symfony\Component\Security\Core\Exception\AuthenticationException::class))
->willReturn($response)
;
$listener = new BasicAuthenticationListener(
$tokenStorage,
- new AuthenticationProviderManager([$this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock()]),
+ new AuthenticationProviderManager([$this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface::class)->getMock()]),
'TheProviderKey',
$authenticationEntryPoint
);
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php
index 54b7fa606f..7a1170fc66 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php
@@ -20,14 +20,14 @@ class ChannelListenerTest extends TestCase
{
public function testHandleWithNotSecuredRequestAndHttpChannel()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$request
->expects($this->any())
->method('isSecure')
->willReturn(false)
;
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(\Symfony\Component\Security\Http\AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -35,7 +35,7 @@ class ChannelListenerTest extends TestCase
->willReturn([[], 'http'])
;
- $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $entryPoint = $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock();
$entryPoint
->expects($this->never())
->method('start')
@@ -58,14 +58,14 @@ class ChannelListenerTest extends TestCase
public function testHandleWithSecuredRequestAndHttpsChannel()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$request
->expects($this->any())
->method('isSecure')
->willReturn(true)
;
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(\Symfony\Component\Security\Http\AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -73,7 +73,7 @@ class ChannelListenerTest extends TestCase
->willReturn([[], 'https'])
;
- $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $entryPoint = $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock();
$entryPoint
->expects($this->never())
->method('start')
@@ -96,7 +96,7 @@ class ChannelListenerTest extends TestCase
public function testHandleWithNotSecuredRequestAndHttpsChannel()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$request
->expects($this->any())
->method('isSecure')
@@ -105,7 +105,7 @@ class ChannelListenerTest extends TestCase
$response = new Response();
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(\Symfony\Component\Security\Http\AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -113,7 +113,7 @@ class ChannelListenerTest extends TestCase
->willReturn([[], 'https'])
;
- $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $entryPoint = $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock();
$entryPoint
->expects($this->once())
->method('start')
@@ -139,7 +139,7 @@ class ChannelListenerTest extends TestCase
public function testHandleWithSecuredRequestAndHttpChannel()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$request
->expects($this->any())
->method('isSecure')
@@ -148,7 +148,7 @@ class ChannelListenerTest extends TestCase
$response = new Response();
- $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
+ $accessMap = $this->getMockBuilder(\Symfony\Component\Security\Http\AccessMapInterface::class)->getMock();
$accessMap
->expects($this->any())
->method('getPatterns')
@@ -156,7 +156,7 @@ class ChannelListenerTest extends TestCase
->willReturn([[], 'http'])
;
- $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $entryPoint = $this->getMockBuilder(\Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface::class)->getMock();
$entryPoint
->expects($this->once())
->method('start')
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
index 020871ef1d..8bb3420447 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
@@ -43,7 +43,7 @@ class ContextListenerTest extends TestCase
{
public function testItRequiresContextKey()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$contextKey must not be empty');
new ContextListener(
$this->getMockBuilder(TokenStorageInterface::class)->getMock(),
@@ -54,7 +54,7 @@ class ContextListenerTest extends TestCase
public function testUserProvidersNeedToImplementAnInterface()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('User provider "stdClass" must implement "Symfony\Component\Security\Core\User\UserProviderInterface');
$this->handleEventWithPreviousSession([new \stdClass()]);
}
@@ -67,7 +67,7 @@ class ContextListenerTest extends TestCase
);
$token = unserialize($session->get('_security_session'));
- $this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $token);
+ $this->assertInstanceOf(UsernamePasswordToken::class, $token);
$this->assertEquals('test1', $token->getUsername());
}
@@ -79,7 +79,7 @@ class ContextListenerTest extends TestCase
);
$token = unserialize($session->get('_security_session'));
- $this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $token);
+ $this->assertInstanceOf(UsernamePasswordToken::class, $token);
$this->assertEquals('test1', $token->getUsername());
}
@@ -149,8 +149,8 @@ class ContextListenerTest extends TestCase
$event = $this->getMockBuilder(RequestEvent::class)
->disableOriginalConstructor()
->getMock();
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
+ $request = $this->getMockBuilder(Request::class)->getMock();
+ $session = $this->getMockBuilder(SessionInterface::class)->getMock();
$event->expects($this->any())
->method('getRequest')
@@ -199,7 +199,7 @@ class ContextListenerTest extends TestCase
->willReturn(true);
$event->expects($this->any())
->method('getRequest')
- ->willReturn($this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock());
+ ->willReturn($this->getMockBuilder(Request::class)->getMock());
$dispatcher->expects($this->once())
->method('addListener')
@@ -216,7 +216,7 @@ class ContextListenerTest extends TestCase
$listener = new ContextListener($tokenStorage, [], 'key123', null, $dispatcher);
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(Request::class)->getMock();
$request->expects($this->any())
->method('hasSession')
->willReturn(true);
@@ -235,7 +235,7 @@ class ContextListenerTest extends TestCase
public function testHandleRemovesTokenIfNoPreviousSessionWasFound()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(Request::class)->getMock();
$request->expects($this->any())->method('hasPreviousSession')->willReturn(false);
$event = $this->getMockBuilder(RequestEvent::class)
@@ -305,7 +305,7 @@ class ContextListenerTest extends TestCase
public function testRuntimeExceptionIsThrownIfNoSupportingUserProviderWasRegistered()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->handleEventWithPreviousSession([new NotSupportingUserProvider(false), new NotSupportingUserProvider(true)]);
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php
index 7328394b48..aa2d657d04 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php
@@ -77,13 +77,13 @@ class ExceptionListenerTest extends TestCase
{
$event = $this->createEvent(new AuthenticationException());
- $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $entryPoint = $this->getMockBuilder(AuthenticationEntryPointInterface::class)->getMock();
$entryPoint->expects($this->once())->method('start')->willReturn('NOT A RESPONSE');
$listener = $this->createExceptionListener(null, null, null, $entryPoint);
$listener->onKernelException($event);
// the exception has been replaced by our LogicException
- $this->assertInstanceOf('LogicException', $event->getThrowable());
+ $this->assertInstanceOf(\LogicException::class, $event->getThrowable());
$this->assertStringEndsWith('start()" method must return a Response object ("string" returned).', $event->getThrowable()->getMessage());
}
@@ -106,12 +106,12 @@ class ExceptionListenerTest extends TestCase
*/
public function testAccessDeniedExceptionFullFledgedAndWithoutAccessDeniedHandlerAndWithErrorPage(\Exception $exception, \Exception $eventException = null)
{
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
$kernel->expects($this->once())->method('handle')->willReturn(new Response('Unauthorized', 401));
$event = $this->createEvent($exception, $kernel);
- $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
+ $httpUtils = $this->getMockBuilder(HttpUtils::class)->getMock();
$httpUtils->expects($this->once())->method('createRequest')->willReturn(Request::create('/error'));
$listener = $this->createExceptionListener(null, $this->createTrustResolver(true), $httpUtils, null, '/error');
@@ -131,7 +131,7 @@ class ExceptionListenerTest extends TestCase
{
$event = $this->createEvent($exception);
- $accessDeniedHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface')->getMock();
+ $accessDeniedHandler = $this->getMockBuilder(AccessDeniedHandlerInterface::class)->getMock();
$accessDeniedHandler->expects($this->once())->method('handle')->willReturn(new Response('error'));
$listener = $this->createExceptionListener(null, $this->createTrustResolver(true), null, null, null, $accessDeniedHandler);
@@ -148,8 +148,8 @@ class ExceptionListenerTest extends TestCase
{
$event = $this->createEvent($exception);
- $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
- $tokenStorage->expects($this->once())->method('getToken')->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
+ $tokenStorage->expects($this->once())->method('getToken')->willReturn($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock());
$listener = $this->createExceptionListener($tokenStorage, $this->createTrustResolver(false), null, $this->createEntryPoint());
$listener->onKernelException($event);
@@ -182,7 +182,7 @@ class ExceptionListenerTest extends TestCase
private function createEntryPoint(Response $response = null)
{
- $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock();
+ $entryPoint = $this->getMockBuilder(AuthenticationEntryPointInterface::class)->getMock();
$entryPoint->expects($this->once())->method('start')->willReturn($response ?: new Response('OK'));
return $entryPoint;
@@ -190,7 +190,7 @@ class ExceptionListenerTest extends TestCase
private function createTrustResolver($fullFledged)
{
- $trustResolver = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface')->getMock();
+ $trustResolver = $this->getMockBuilder(AuthenticationTrustResolverInterface::class)->getMock();
$trustResolver->expects($this->once())->method('isFullFledged')->willReturn($fullFledged);
return $trustResolver;
@@ -199,7 +199,7 @@ class ExceptionListenerTest extends TestCase
private function createEvent(\Exception $exception, $kernel = null)
{
if (null === $kernel) {
- $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
}
return new ExceptionEvent($kernel, Request::create('/'), HttpKernelInterface::MASTER_REQUEST, $exception);
@@ -208,9 +208,9 @@ class ExceptionListenerTest extends TestCase
private function createExceptionListener(TokenStorageInterface $tokenStorage = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null)
{
return new ExceptionListener(
- $tokenStorage ?: $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(),
- $trustResolver ?: $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface')->getMock(),
- $httpUtils ?: $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock(),
+ $tokenStorage ?: $this->getMockBuilder(TokenStorageInterface::class)->getMock(),
+ $trustResolver ?: $this->getMockBuilder(AuthenticationTrustResolverInterface::class)->getMock(),
+ $httpUtils ?: $this->getMockBuilder(HttpUtils::class)->getMock(),
'key',
$authenticationEntryPoint,
$errorPage,
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
index cf46161032..8367a233d2 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
@@ -32,7 +32,7 @@ class RememberMeListenerTest extends TestCase
$tokenStorage
->expects($this->any())
->method('getToken')
- ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())
+ ->willReturn($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock())
;
$tokenStorage
@@ -79,7 +79,7 @@ class RememberMeListenerTest extends TestCase
$service
->expects($this->once())
->method('autoLogin')
- ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())
+ ->willReturn($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock())
;
$service
@@ -101,7 +101,7 @@ class RememberMeListenerTest extends TestCase
public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExceptionThrownAuthenticationManagerImplementation()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectException(AuthenticationException::class);
$this->expectExceptionMessage('Authentication failed.');
[$listener, $tokenStorage, $service, $manager] = $this->getListener(false, false);
@@ -114,7 +114,7 @@ class RememberMeListenerTest extends TestCase
$service
->expects($this->once())
->method('autoLogin')
- ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())
+ ->willReturn($this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock())
;
$service
@@ -176,7 +176,7 @@ class RememberMeListenerTest extends TestCase
->willReturn(null)
;
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$service
->expects($this->once())
->method('autoLogin')
@@ -210,7 +210,7 @@ class RememberMeListenerTest extends TestCase
->willReturn(null)
;
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$service
->expects($this->once())
->method('autoLogin')
@@ -260,7 +260,7 @@ class RememberMeListenerTest extends TestCase
->willReturn(null)
;
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$service
->expects($this->once())
->method('autoLogin')
@@ -308,7 +308,7 @@ class RememberMeListenerTest extends TestCase
->willReturn(null)
;
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$service
->expects($this->once())
->method('autoLogin')
@@ -333,7 +333,7 @@ class RememberMeListenerTest extends TestCase
->expects($this->once())
->method('dispatch')
->with(
- $this->isInstanceOf('Symfony\Component\Security\Http\Event\InteractiveLoginEvent'),
+ $this->isInstanceOf(\Symfony\Component\Security\Http\Event\InteractiveLoginEvent::class),
SecurityEvents::INTERACTIVE_LOGIN
)
;
@@ -379,22 +379,22 @@ class RememberMeListenerTest extends TestCase
protected function getLogger()
{
- return $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ return $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
}
protected function getManager()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
}
protected function getService()
{
- return $this->getMockBuilder('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface::class)->getMock();
}
protected function getTokenStorage()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class)->getMock();
}
protected function getDispatcher()
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
index fd29297a57..888d672547 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
@@ -25,9 +25,9 @@ class RemoteUserAuthenticationListenerTest extends TestCase
$request = new Request([], [], [], [], [], $serverVars);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new RemoteUserAuthenticationListener(
$tokenStorage,
@@ -44,12 +44,12 @@ class RemoteUserAuthenticationListenerTest extends TestCase
public function testGetPreAuthenticatedDataNoUser()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$request = new Request([], [], [], [], [], []);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new RemoteUserAuthenticationListener(
$tokenStorage,
@@ -70,9 +70,9 @@ class RemoteUserAuthenticationListenerTest extends TestCase
$request = new Request([], [], [], [], [], [
'TheUserKey' => 'TheUser',
]);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new RemoteUserAuthenticationListener(
$tokenStorage,
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
index cc31cc8d51..da57ddefd6 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
@@ -129,7 +129,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
public function testAttemptAuthenticationNoJson()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$this->expectExceptionMessage('Invalid JSON');
$this->createListener();
$request = new Request();
@@ -141,7 +141,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
public function testAttemptAuthenticationNoUsername()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$this->expectExceptionMessage('The key "username" must be provided');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"usr": "dunglas", "password": "foo"}');
@@ -152,7 +152,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
public function testAttemptAuthenticationNoPassword()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$this->expectExceptionMessage('The key "password" must be provided');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": "dunglas", "pass": "foo"}');
@@ -163,7 +163,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
public function testAttemptAuthenticationUsernameNotAString()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$this->expectExceptionMessage('The key "username" must be a string.');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": 1, "password": "foo"}');
@@ -174,7 +174,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
public function testAttemptAuthenticationPasswordNotAString()
{
- $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectException(\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class);
$this->expectExceptionMessage('The key "password" must be a string.');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": "dunglas", "password": 1}');
@@ -244,7 +244,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
$this->configurePreviousSession($request);
$event = new RequestEvent($this->getMockBuilder(KernelInterface::class)->getMock(), $request, KernelInterface::MASTER_REQUEST);
- $sessionStrategy = $this->getMockBuilder('Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface')->getMock();
+ $sessionStrategy = $this->getMockBuilder(\Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface::class)->getMock();
$sessionStrategy->expects($this->once())
->method('onAuthentication')
->with($request, $this->isInstanceOf(TokenInterface::class));
@@ -256,7 +256,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
private function configurePreviousSession(Request $request)
{
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
$session->expects($this->any())
->method('getName')
->willReturn('test_session_name');
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
index c81b2d589e..52ed236889 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
@@ -32,9 +32,9 @@ class X509AuthenticationListenerTest extends TestCase
$request = new Request([], [], [], [], [], $serverVars);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new X509AuthenticationListener($tokenStorage, $authenticationManager, 'TheProviderKey');
@@ -60,9 +60,9 @@ class X509AuthenticationListenerTest extends TestCase
{
$request = new Request([], [], [], [], [], ['SSL_CLIENT_S_DN' => $credentials]);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new X509AuthenticationListener($tokenStorage, $authenticationManager, 'TheProviderKey');
@@ -86,12 +86,12 @@ class X509AuthenticationListenerTest extends TestCase
public function testGetPreAuthenticatedDataNoData()
{
- $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectException(\Symfony\Component\Security\Core\Exception\BadCredentialsException::class);
$request = new Request([], [], [], [], [], []);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new X509AuthenticationListener($tokenStorage, $authenticationManager, 'TheProviderKey');
@@ -109,9 +109,9 @@ class X509AuthenticationListenerTest extends TestCase
'TheUserKey' => 'TheUser',
'TheCredentialsKey' => 'TheCredentials',
]);
- $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();
- $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
+ $authenticationManager = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface::class)->getMock();
$listener = new X509AuthenticationListener($tokenStorage, $authenticationManager, 'TheProviderKey', 'TheUserKey', 'TheCredentialsKey');
diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php
index 50675a6003..3eb2607ba6 100644
--- a/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php
@@ -23,7 +23,7 @@ class FirewallMapTest extends TestCase
$request = new Request();
- $notMatchingMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcher')->getMock();
+ $notMatchingMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcher::class)->getMock();
$notMatchingMatcher
->expects($this->once())
->method('matches')
@@ -33,7 +33,7 @@ class FirewallMapTest extends TestCase
$map->add($notMatchingMatcher, [function () {}]);
- $matchingMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcher')->getMock();
+ $matchingMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcher::class)->getMock();
$matchingMatcher
->expects($this->once())
->method('matches')
@@ -41,11 +41,11 @@ class FirewallMapTest extends TestCase
->willReturn(true)
;
$theListener = function () {};
- $theException = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ExceptionListener')->disableOriginalConstructor()->getMock();
+ $theException = $this->getMockBuilder(\Symfony\Component\Security\Http\Firewall\ExceptionListener::class)->disableOriginalConstructor()->getMock();
$map->add($matchingMatcher, [$theListener], $theException);
- $tooLateMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcher')->getMock();
+ $tooLateMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcher::class)->getMock();
$tooLateMatcher
->expects($this->never())
->method('matches')
@@ -65,7 +65,7 @@ class FirewallMapTest extends TestCase
$request = new Request();
- $notMatchingMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcher')->getMock();
+ $notMatchingMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcher::class)->getMock();
$notMatchingMatcher
->expects($this->once())
->method('matches')
@@ -76,11 +76,11 @@ class FirewallMapTest extends TestCase
$map->add($notMatchingMatcher, [function () {}]);
$theListener = function () {};
- $theException = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ExceptionListener')->disableOriginalConstructor()->getMock();
+ $theException = $this->getMockBuilder(\Symfony\Component\Security\Http\Firewall\ExceptionListener::class)->disableOriginalConstructor()->getMock();
$map->add(null, [$theListener], $theException);
- $tooLateMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcher')->getMock();
+ $tooLateMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcher::class)->getMock();
$tooLateMatcher
->expects($this->never())
->method('matches')
@@ -100,7 +100,7 @@ class FirewallMapTest extends TestCase
$request = new Request();
- $notMatchingMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcher')->getMock();
+ $notMatchingMatcher = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestMatcher::class)->getMock();
$notMatchingMatcher
->expects($this->once())
->method('matches')
diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php
index 0afb660b85..f4b98fdd98 100644
--- a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php
@@ -20,18 +20,18 @@ class FirewallTest extends TestCase
{
public function testOnKernelRequestRegistersExceptionListener()
{
- $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
+ $dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
- $listener = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ExceptionListener')->disableOriginalConstructor()->getMock();
+ $listener = $this->getMockBuilder(ExceptionListener::class)->disableOriginalConstructor()->getMock();
$listener
->expects($this->once())
->method('register')
->with($this->equalTo($dispatcher))
;
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
+ $request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
- $map = $this->getMockBuilder('Symfony\Component\Security\Http\FirewallMapInterface')->getMock();
+ $map = $this->getMockBuilder(FirewallMapInterface::class)->getMock();
$map
->expects($this->once())
->method('getListeners')
@@ -39,7 +39,7 @@ class FirewallTest extends TestCase
->willReturn([[], $listener, null])
;
- $event = new RequestEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST);
+ $event = new RequestEvent($this->getMockBuilder(HttpKernelInterface::class)->getMock(), $request, HttpKernelInterface::MASTER_REQUEST);
$firewall = new Firewall($map, $dispatcher);
$firewall->onKernelRequest($event);
@@ -57,7 +57,7 @@ class FirewallTest extends TestCase
$called[] = 2;
};
- $map = $this->getMockBuilder('Symfony\Component\Security\Http\FirewallMapInterface')->getMock();
+ $map = $this->getMockBuilder(FirewallMapInterface::class)->getMock();
$map
->expects($this->once())
->method('getListeners')
@@ -67,8 +67,8 @@ class FirewallTest extends TestCase
$event = $this->getMockBuilder(RequestEvent::class)
->setMethods(['hasResponse'])
->setConstructorArgs([
- $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(),
- $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock(),
+ $this->getMockBuilder(HttpKernelInterface::class)->getMock(),
+ $this->getMockBuilder(Request::class)->disableOriginalConstructor()->disableOriginalClone()->getMock(),
HttpKernelInterface::MASTER_REQUEST,
])
->getMock()
@@ -79,7 +79,7 @@ class FirewallTest extends TestCase
->willReturn(true)
;
- $firewall = new Firewall($map, $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock());
+ $firewall = new Firewall($map, $this->getMockBuilder(EventDispatcherInterface::class)->getMock());
$firewall->onKernelRequest($event);
$this->assertSame([1], $called);
@@ -87,19 +87,19 @@ class FirewallTest extends TestCase
public function testOnKernelRequestWithSubRequest()
{
- $map = $this->getMockBuilder('Symfony\Component\Security\Http\FirewallMapInterface')->getMock();
+ $map = $this->getMockBuilder(FirewallMapInterface::class)->getMock();
$map
->expects($this->never())
->method('getListeners')
;
$event = new RequestEvent(
- $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(),
- $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(),
+ $this->getMockBuilder(HttpKernelInterface::class)->getMock(),
+ $this->getMockBuilder(Request::class)->getMock(),
HttpKernelInterface::SUB_REQUEST
);
- $firewall = new Firewall($map, $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock());
+ $firewall = new Firewall($map, $this->getMockBuilder(EventDispatcherInterface::class)->getMock());
$firewall->onKernelRequest($event);
$this->assertFalse($event->hasResponse());
diff --git a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
index 05d02b886e..932f1cfb55 100644
--- a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
@@ -86,7 +86,7 @@ class HttpUtilsTest extends TestCase
public function testCreateRedirectResponseWithRouteName()
{
- $utils = new HttpUtils($urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock());
+ $utils = new HttpUtils($urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock());
$urlGenerator
->expects($this->any())
@@ -97,7 +97,7 @@ class HttpUtilsTest extends TestCase
$urlGenerator
->expects($this->any())
->method('getContext')
- ->willReturn($this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock())
+ ->willReturn($this->getMockBuilder(\Symfony\Component\Routing\RequestContext::class)->getMock())
;
$response = $utils->createRedirectResponse($this->getRequest(), 'foobar');
@@ -120,7 +120,7 @@ class HttpUtilsTest extends TestCase
public function testCreateRequestWithRouteName()
{
- $utils = new HttpUtils($urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock());
+ $utils = new HttpUtils($urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock());
$urlGenerator
->expects($this->once())
@@ -130,7 +130,7 @@ class HttpUtilsTest extends TestCase
$urlGenerator
->expects($this->any())
->method('getContext')
- ->willReturn($this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock())
+ ->willReturn($this->getMockBuilder(\Symfony\Component\Routing\RequestContext::class)->getMock())
;
$subRequest = $utils->createRequest($this->getRequest(), 'foobar');
@@ -140,7 +140,7 @@ class HttpUtilsTest extends TestCase
public function testCreateRequestWithAbsoluteUrl()
{
- $utils = new HttpUtils($this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock());
+ $utils = new HttpUtils($this->getMockBuilder(UrlGeneratorInterface::class)->getMock());
$subRequest = $utils->createRequest($this->getRequest(), 'http://symfony.com/');
$this->assertEquals('/', $subRequest->getPathInfo());
@@ -149,7 +149,7 @@ class HttpUtilsTest extends TestCase
public function testCreateRequestPassesSessionToTheNewRequest()
{
$request = $this->getRequest();
- $request->setSession($session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock());
+ $request->setSession($session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock());
$utils = new HttpUtils($this->getUrlGenerator());
$subRequest = $utils->createRequest($request, '/foobar');
@@ -195,7 +195,7 @@ class HttpUtilsTest extends TestCase
public function testCheckRequestPathWithUrlMatcherAndResourceNotFound()
{
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\UrlMatcherInterface::class)->getMock();
$urlMatcher
->expects($this->any())
->method('match')
@@ -210,7 +210,7 @@ class HttpUtilsTest extends TestCase
public function testCheckRequestPathWithUrlMatcherAndMethodNotAllowed()
{
$request = $this->getRequest();
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$urlMatcher
->expects($this->any())
->method('matchRequest')
@@ -224,7 +224,7 @@ class HttpUtilsTest extends TestCase
public function testCheckRequestPathWithUrlMatcherAndResourceFoundByUrl()
{
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\UrlMatcherInterface::class)->getMock();
$urlMatcher
->expects($this->any())
->method('match')
@@ -239,7 +239,7 @@ class HttpUtilsTest extends TestCase
public function testCheckRequestPathWithUrlMatcherAndResourceFoundByRequest()
{
$request = $this->getRequest();
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
$urlMatcher
->expects($this->any())
->method('matchRequest')
@@ -253,8 +253,8 @@ class HttpUtilsTest extends TestCase
public function testCheckRequestPathWithUrlMatcherLoadingException()
{
- $this->expectException('RuntimeException');
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
+ $this->expectException(\RuntimeException::class);
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\UrlMatcherInterface::class)->getMock();
$urlMatcher
->expects($this->any())
->method('match')
@@ -267,7 +267,7 @@ class HttpUtilsTest extends TestCase
public function testCheckPathWithoutRouteParam()
{
- $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
+ $urlMatcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\UrlMatcherInterface::class)->getMock();
$urlMatcher
->expects($this->any())
->method('match')
@@ -280,7 +280,7 @@ class HttpUtilsTest extends TestCase
public function testUrlMatcher()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface');
new HttpUtils($this->getUrlGenerator(), new \stdClass());
}
@@ -305,7 +305,7 @@ class HttpUtilsTest extends TestCase
public function testUrlGeneratorIsRequiredToGenerateUrl()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$this->expectExceptionMessage('You must provide a UrlGeneratorInterface instance to be able to use routes.');
$utils = new HttpUtils();
$utils->generateUri(new Request(), 'route_name');
@@ -313,7 +313,7 @@ class HttpUtilsTest extends TestCase
private function getUrlGenerator($generatedUrl = '/foo/bar')
{
- $urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
+ $urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
$urlGenerator
->expects($this->any())
->method('generate')
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/CookieClearingLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/CookieClearingLogoutHandlerTest.php
index f2407fcb3f..cee1d5076a 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/CookieClearingLogoutHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/CookieClearingLogoutHandlerTest.php
@@ -24,7 +24,7 @@ class CookieClearingLogoutHandlerTest extends TestCase
{
$request = new Request();
$response = new Response();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$handler = new CookieClearingLogoutHandler(['foo' => ['path' => '/foo', 'domain' => 'foo.foo', 'secure' => true, 'samesite' => Cookie::SAMESITE_STRICT], 'foo2' => ['path' => null, 'domain' => null]]);
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
index 06eb56139e..7e75ce4549 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
@@ -39,7 +39,7 @@ class CsrfTokenClearingLogoutHandlerTest extends TestCase
$this->assertSame('bar', $this->session->get('foo/foo'));
$this->assertSame('baz', $this->session->get('foo/foobar'));
- $this->csrfTokenClearingLogoutHandler->logout(new Request(), new Response(), $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $this->csrfTokenClearingLogoutHandler->logout(new Request(), new Response(), $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock());
$this->assertFalse($this->csrfTokenStorage->hasToken('foo'));
$this->assertFalse($this->csrfTokenStorage->hasToken('foobar'));
@@ -59,7 +59,7 @@ class CsrfTokenClearingLogoutHandlerTest extends TestCase
$this->assertSame('bar', $this->session->get('bar/foo'));
$this->assertSame('baz', $this->session->get('bar/foobar'));
- $this->csrfTokenClearingLogoutHandler->logout(new Request(), new Response(), $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $this->csrfTokenClearingLogoutHandler->logout(new Request(), new Response(), $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock());
$this->assertTrue($barNamespaceCsrfSessionStorage->hasToken('foo'));
$this->assertTrue($barNamespaceCsrfSessionStorage->hasToken('foobar'));
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
index 2b74b8ccb0..84fd3dafc8 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
@@ -22,10 +22,10 @@ class DefaultLogoutSuccessHandlerTest extends TestCase
{
public function testLogout()
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$response = new RedirectResponse('/dashboard');
- $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
+ $httpUtils = $this->getMockBuilder(\Symfony\Component\Security\Http\HttpUtils::class)->getMock();
$httpUtils->expects($this->once())
->method('createRedirectResponse')
->with($request, '/dashboard')
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
index 539ff4c50e..4ea8fa1604 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
@@ -48,7 +48,7 @@ class LogoutUrlGeneratorTest extends TestCase
public function testGetLogoutPathWithoutLogoutListenerRegisteredForKeyThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('No LogoutListener found for firewall key "unregistered_key".');
$this->generator->registerListener('secured_area', '/logout', null, null, null);
@@ -65,7 +65,7 @@ class LogoutUrlGeneratorTest extends TestCase
public function testGuessFromAnonymousTokenThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unable to generate a logout url for an anonymous token.');
$this->tokenStorage->setToken(new AnonymousToken('default', 'anon.'));
@@ -99,7 +99,7 @@ class LogoutUrlGeneratorTest extends TestCase
public function testUnableToGuessThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unable to find the current firewall LogoutListener, please provide the provider key manually');
$this->generator->registerListener('secured_area', '/logout', null, null);
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php
index cf25d1f77c..f8fb31dbea 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php
@@ -21,9 +21,9 @@ class SessionLogoutHandlerTest extends TestCase
{
$handler = new SessionLogoutHandler();
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
$response = new Response();
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock();
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\Session::class)->disableOriginalConstructor()->getMock();
$request
->expects($this->once())
@@ -36,6 +36,6 @@ class SessionLogoutHandlerTest extends TestCase
->method('invalidate')
;
- $handler->logout($request, $response, $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+ $handler->logout($request, $response, $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock());
}
}
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
index 7694454304..f8da09a941 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
@@ -52,7 +52,7 @@ class AbstractRememberMeServicesTest extends TestCase
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$service = $this->getService(null, ['name' => 'foo', 'path' => null, 'domain' => null]);
$request = new Request();
$request->cookies->set('foo', 'foo');
@@ -72,7 +72,7 @@ class AbstractRememberMeServicesTest extends TestCase
$request = new Request();
$request->cookies->set('foo', 'foo');
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$user
->expects($this->once())
->method('getRoles')
@@ -100,10 +100,10 @@ class AbstractRememberMeServicesTest extends TestCase
$service = $this->getService(null, $options);
$request = new Request();
$response = new Response();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$service->logout($request, $response, $token);
$cookie = $request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Cookie', $cookie);
+ $this->assertInstanceOf(\Symfony\Component\HttpFoundation\Cookie::class, $cookie);
$this->assertTrue($cookie->isCleared());
$this->assertSame($options['name'], $cookie->getName());
$this->assertSame($options['path'], $cookie->getPath());
@@ -135,7 +135,7 @@ class AbstractRememberMeServicesTest extends TestCase
$service = $this->getService(null, ['name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null]);
$request = new Request();
$response = new Response();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->once())
->method('getUser')
@@ -157,8 +157,8 @@ class AbstractRememberMeServicesTest extends TestCase
$service = $this->getService(null, ['name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null]);
$request = new Request();
$response = new Response();
- $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $account = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->once())
->method('getUser')
@@ -181,8 +181,8 @@ class AbstractRememberMeServicesTest extends TestCase
$service = $this->getService(null, ['name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null]);
$request = new Request();
$response = new Response();
- $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $account = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->once())
->method('getUser')
@@ -208,8 +208,8 @@ class AbstractRememberMeServicesTest extends TestCase
$request = new Request();
$request->request->set('foo', ['bar' => $value]);
$response = new Response();
- $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $account = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->once())
->method('getUser')
@@ -235,8 +235,8 @@ class AbstractRememberMeServicesTest extends TestCase
$request = new Request();
$request->request->set('foo', $value);
$response = new Response();
- $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $account = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->once())
->method('getUser')
@@ -277,7 +277,7 @@ class AbstractRememberMeServicesTest extends TestCase
public function testThereShouldBeNoCookieDelimiterInCookieParts()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('cookie delimiter');
$cookieParts = ['aa', 'b'.AbstractRememberMeServices::COOKIE_DELIMITER.'b', 'cc'];
$service = $this->getService();
@@ -291,14 +291,14 @@ class AbstractRememberMeServicesTest extends TestCase
$userProvider = $this->getProvider();
}
- return $this->getMockForAbstractClass('Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices', [
+ return $this->getMockForAbstractClass(AbstractRememberMeServices::class, [
[$userProvider], 'foosecret', 'fookey', $options, $logger,
]);
}
protected function getProvider()
{
- $provider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
+ $provider = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserProviderInterface::class)->getMock();
$provider
->expects($this->any())
->method('supportsClass')
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php
index 832c4b912e..fb65baa612 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php
@@ -83,7 +83,7 @@ class ResponseListenerTest extends TestCase
private function getResponse()
{
$response = new Response();
- $response->headers = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->getMock();
+ $response->headers = $this->getMockBuilder(\Symfony\Component\HttpFoundation\ResponseHeaderBag::class)->getMock();
return $response;
}
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
index 4a34d61421..5a1330f747 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
@@ -64,7 +64,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
$request = new Request();
$request->cookies->set('foo', base64_encode('class:'.base64_encode('foouser').':123456789:fooHash'));
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$user
->expects($this->once())
->method('getPassword')
@@ -89,7 +89,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
$request = new Request();
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() - 1, 'foopass'));
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$user
->expects($this->once())
->method('getPassword')
@@ -114,7 +114,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
*/
public function testAutoLogin($username)
{
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$user
->expects($this->once())
->method('getRoles')
@@ -140,7 +140,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
$returnedToken = $service->autoLogin($request);
- $this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', $returnedToken);
+ $this->assertInstanceOf(\Symfony\Component\Security\Core\Authentication\Token\RememberMeToken::class, $returnedToken);
$this->assertSame($user, $returnedToken->getUser());
$this->assertEquals('foosecret', $returnedToken->getSecret());
}
@@ -158,7 +158,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
$service = $this->getService(null, ['name' => 'foo', 'path' => null, 'domain' => null, 'secure' => true, 'httponly' => false]);
$request = new Request();
$response = new Response();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$service->logout($request, $response, $token);
@@ -188,7 +188,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
$service = $this->getService(null, ['name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null]);
$request = new Request();
$response = new Response();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token
->expects($this->once())
->method('getUser')
@@ -210,8 +210,8 @@ class TokenBasedRememberMeServicesTest extends TestCase
$request = new Request();
$response = new Response();
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
+ $user = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserInterface::class)->getMock();
$user
->expects($this->once())
->method('getPassword')
@@ -275,7 +275,7 @@ class TokenBasedRememberMeServicesTest extends TestCase
protected function getProvider()
{
- $provider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
+ $provider = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserProviderInterface::class)->getMock();
$provider
->expects($this->any())
->method('supportsClass')
diff --git a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
index c4df17b53b..71798aa843 100644
--- a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
@@ -27,7 +27,7 @@ class SessionAuthenticationStrategyTest extends TestCase
public function testUnsupportedStrategy()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Invalid session authentication strategy "foo"');
$request = $this->getRequest();
$request->expects($this->never())->method('getSession');
@@ -38,7 +38,7 @@ class SessionAuthenticationStrategyTest extends TestCase
public function testSessionIsMigrated()
{
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
$session->expects($this->once())->method('migrate')->with($this->equalTo(true));
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE);
@@ -47,7 +47,7 @@ class SessionAuthenticationStrategyTest extends TestCase
public function testSessionIsInvalidated()
{
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
+ $session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
$session->expects($this->once())->method('invalidate');
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::INVALIDATE);
@@ -56,7 +56,7 @@ class SessionAuthenticationStrategyTest extends TestCase
private function getRequest($session = null)
{
- $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+ $request = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Request::class)->getMock();
if (null !== $session) {
$request->expects($this->any())->method('getSession')->willReturn($session);
@@ -67,6 +67,6 @@ class SessionAuthenticationStrategyTest extends TestCase
private function getToken()
{
- return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
+ return $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
}
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Util/TargetPathTraitTest.php b/src/Symfony/Component/Security/Http/Tests/Util/TargetPathTraitTest.php
index 34a6a8ef15..1f5bb3356a 100644
--- a/src/Symfony/Component/Security/Http/Tests/Util/TargetPathTraitTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Util/TargetPathTraitTest.php
@@ -12,7 +12,7 @@ class TargetPathTraitTest extends TestCase
{
$obj = new TestClassWithTargetPathTrait();
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')
+ $session = $this->getMockBuilder(SessionInterface::class)
->getMock();
$session->expects($this->once())
@@ -26,7 +26,7 @@ class TargetPathTraitTest extends TestCase
{
$obj = new TestClassWithTargetPathTrait();
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')
+ $session = $this->getMockBuilder(SessionInterface::class)
->getMock();
$session->expects($this->once())
@@ -45,7 +45,7 @@ class TargetPathTraitTest extends TestCase
{
$obj = new TestClassWithTargetPathTrait();
- $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')
+ $session = $this->getMockBuilder(SessionInterface::class)
->getMock();
$session->expects($this->once())
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/DiscriminatorMapTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/DiscriminatorMapTest.php
index 81f2db2cdd..6570bc5804 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/DiscriminatorMapTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/DiscriminatorMapTest.php
@@ -35,25 +35,25 @@ class DiscriminatorMapTest extends TestCase
public function testExceptionWithoutTypeProperty()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new DiscriminatorMap(['mapping' => ['foo' => 'FooClass']]);
}
public function testExceptionWithEmptyTypeProperty()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new DiscriminatorMap(['typeProperty' => '', 'mapping' => ['foo' => 'FooClass']]);
}
public function testExceptionWithoutMappingProperty()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new DiscriminatorMap(['typeProperty' => 'type']);
}
public function testExceptionWitEmptyMappingProperty()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new DiscriminatorMap(['typeProperty' => 'type', 'mapping' => []]);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
index 3fad6d82f8..45a755e090 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
@@ -21,19 +21,19 @@ class GroupsTest extends TestCase
{
public function testEmptyGroupsParameter()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new Groups(['value' => []]);
}
public function testNotAnArrayGroupsParameter()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new Groups(['value' => 12]);
}
public function testInvalidGroupsParameter()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
new Groups(['value' => ['a', 1, new \stdClass()]]);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
index 2c421576d1..9fbe55ce07 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
@@ -21,7 +21,7 @@ class MaxDepthTest extends TestCase
{
public function testNotSetMaxDepthParameter()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" should be set.');
new MaxDepth([]);
}
@@ -41,7 +41,7 @@ class MaxDepthTest extends TestCase
*/
public function testNotAnIntMaxDepthParameter($value)
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" must be a positive integer.');
new MaxDepth(['value' => $value]);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/SerializedNameTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/SerializedNameTest.php
index cb934580b0..7881b63f6b 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/SerializedNameTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/SerializedNameTest.php
@@ -21,7 +21,7 @@ class SerializedNameTest extends TestCase
{
public function testNotSetSerializedNameParameter()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\SerializedName" should be set.');
new SerializedName([]);
}
@@ -39,7 +39,7 @@ class SerializedNameTest extends TestCase
*/
public function testNotAStringSerializedNameParameter($value)
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\SerializedName" must be a non-empty string.');
new SerializedName(['value' => $value]);
}
diff --git a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
index 65d7a65f5a..9f5b1141bf 100644
--- a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
+++ b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
@@ -25,7 +25,7 @@ class SerializerPassTest extends TestCase
{
public function testThrowExceptionWhenNoNormalizers()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('You must tag at least one service as "serializer.normalizer" to use the "serializer" service');
$container = new ContainerBuilder();
$container->register('serializer');
@@ -36,7 +36,7 @@ class SerializerPassTest extends TestCase
public function testThrowExceptionWhenNoEncoders()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('You must tag at least one service as "serializer.encoder" to use the "serializer" service');
$container = new ContainerBuilder();
$container->register('serializer')
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
index 215e733861..7ab6486692 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
@@ -27,7 +27,7 @@ class ChainDecoderTest extends TestCase
protected function setUp(): void
{
$this->decoder1 = $this
- ->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface')
+ ->getMockBuilder(\Symfony\Component\Serializer\Encoder\DecoderInterface::class)
->getMock();
$this->decoder1
@@ -40,7 +40,7 @@ class ChainDecoderTest extends TestCase
]);
$this->decoder2 = $this
- ->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface')
+ ->getMockBuilder(\Symfony\Component\Serializer\Encoder\DecoderInterface::class)
->getMock();
$this->decoder2
@@ -72,7 +72,7 @@ class ChainDecoderTest extends TestCase
public function testDecodeUnsupportedFormat()
{
- $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\RuntimeException::class);
$this->chainDecoder->decode('string_to_decode', self::FORMAT_3);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
index 68b6f1e3b5..bb9dc3c2f5 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
@@ -29,7 +29,7 @@ class ChainEncoderTest extends TestCase
protected function setUp(): void
{
$this->encoder1 = $this
- ->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface')
+ ->getMockBuilder(EncoderInterface::class)
->getMock();
$this->encoder1
@@ -42,7 +42,7 @@ class ChainEncoderTest extends TestCase
]);
$this->encoder2 = $this
- ->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface')
+ ->getMockBuilder(EncoderInterface::class)
->getMock();
$this->encoder2
@@ -74,7 +74,7 @@ class ChainEncoderTest extends TestCase
public function testEncodeUnsupportedFormat()
{
- $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\RuntimeException::class);
$this->chainEncoder->encode(['foo' => 123], self::FORMAT_3);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
index 809bd02796..a51e23e56b 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
@@ -60,7 +60,7 @@ class JsonDecodeTest extends TestCase
*/
public function testDecodeWithException($value)
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->decode->decode($value, JsonEncoder::FORMAT);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
index 157b3999ea..57b74d4c67 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
@@ -53,7 +53,7 @@ class JsonEncodeTest extends TestCase
public function testEncodeWithError()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->encode->encode("\xB1\x31", JsonEncoder::FORMAT);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
index b74d10bfca..3dedbd327c 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
@@ -67,7 +67,7 @@ class JsonEncoderTest extends TestCase
public function testEncodeNotUtf8WithoutPartialOnError()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$arr = [
'utf8' => 'Hello World!',
'notUtf8' => "\xb0\xd0\xb5\xd0",
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
index 88c47b6d4f..98024410cc 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -71,7 +71,7 @@ class XmlEncoderTest extends TestCase
public function testDocTypeIsNotAllowed()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->expectExceptionMessage('Document types are not allowed.');
$this->encoder->decode('
', 'foo');
}
@@ -665,19 +665,19 @@ XML;
public function testDecodeInvalidXml()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->encoder->decode('
', 'xml');
}
public function testPreventsComplexExternalEntities()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->encoder->decode(']>&test;', 'xml');
}
public function testDecodeEmptyXml()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid XML data, it can not be empty.');
$this->encoder->decode(' ', 'xml');
}
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php
index 923d8fc39d..87c3ebfd22 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php
@@ -22,7 +22,7 @@ class AttributeMetadataTest extends TestCase
public function testInterface()
{
$attributeMetadata = new AttributeMetadata('name');
- $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface', $attributeMetadata);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Mapping\AttributeMetadataInterface::class, $attributeMetadata);
}
public function testGetName()
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php
index 636d8a8ab8..9906959e4c 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php
@@ -23,7 +23,7 @@ class ClassMetadataTest extends TestCase
public function testInterface()
{
$classMetadata = new ClassMetadata('name');
- $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\ClassMetadataInterface', $classMetadata);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Mapping\ClassMetadataInterface::class, $classMetadata);
}
public function testAttributeMetadata()
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
index 907311d435..cd185853b3 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
@@ -57,7 +57,7 @@ class CacheMetadataFactoryTest extends TestCase
public function testInvalidClassThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$decorated = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock();
$factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter());
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php
index 3034eb4c4a..7ba03dedc2 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php
@@ -26,7 +26,7 @@ class ClassMetadataFactoryTest extends TestCase
public function testInterface()
{
$classMetadata = new ClassMetadataFactory(new LoaderChain([]));
- $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface', $classMetadata);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface::class, $classMetadata);
}
public function testGetMetadataFor()
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
index 0f7868c09d..973a728e28 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
@@ -35,7 +35,7 @@ abstract class AnnotationLoaderTest extends TestCase
public function testInterface()
{
- $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\Loader\LoaderInterface', $this->loader);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::class, $this->loader);
}
public function testLoadClassMetadataReturnsTrueIfSuccessful()
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
index 8a5e0e13f7..1d41ff1344 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
@@ -44,7 +44,7 @@ class XmlFileLoaderTest extends TestCase
public function testInterface()
{
- $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\Loader\LoaderInterface', $this->loader);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::class, $this->loader);
}
public function testLoadClassMetadataReturnsTrueIfSuccessful()
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
index 2e708665f5..1fc3946dad 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -45,7 +45,7 @@ class YamlFileLoaderTest extends TestCase
public function testInterface()
{
- $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\Loader\LoaderInterface', $this->loader);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::class, $this->loader);
}
public function testLoadClassMetadataReturnsTrueIfSuccessful()
@@ -61,7 +61,7 @@ class YamlFileLoaderTest extends TestCase
public function testLoadClassMetadataReturnsThrowsInvalidMapping()
{
- $this->expectException('Symfony\Component\Serializer\Exception\MappingException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\MappingException::class);
$loader = new YamlFileLoader(__DIR__.'/../../Fixtures/invalid-mapping.yml');
$loader->loadClassMetadata($this->metadata);
}
diff --git a/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php b/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php
index 4847004c97..15e36a0df4 100644
--- a/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php
+++ b/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php
@@ -22,7 +22,7 @@ class CamelCaseToSnakeCaseNameConverterTest extends TestCase
public function testInterface()
{
$attributeMetadata = new CamelCaseToSnakeCaseNameConverter();
- $this->assertInstanceOf('Symfony\Component\Serializer\NameConverter\NameConverterInterface', $attributeMetadata);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\NameConverter\NameConverterInterface::class, $attributeMetadata);
}
/**
diff --git a/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php b/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php
index 250f6be40e..119edfbfb9 100644
--- a/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php
+++ b/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php
@@ -30,7 +30,7 @@ final class MetadataAwareNameConverterTest extends TestCase
{
$classMetadataFactory = $this->createMock(ClassMetadataFactoryInterface::class);
$nameConverter = new MetadataAwareNameConverter($classMetadataFactory);
- $this->assertInstanceOf('Symfony\Component\Serializer\NameConverter\NameConverterInterface', $nameConverter);
+ $this->assertInstanceOf(NameConverterInterface::class, $nameConverter);
}
/**
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
index 1985911ea6..dec6c47b58 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
@@ -40,8 +40,8 @@ class AbstractNormalizerTest extends TestCase
protected function setUp(): void
{
- $loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs([[]])->getMock();
- $this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs([$loader])->getMock();
+ $loader = $this->getMockBuilder(\Symfony\Component\Serializer\Mapping\Loader\LoaderChain::class)->setConstructorArgs([[]])->getMock();
+ $this->classMetadata = $this->getMockBuilder(\Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory::class)->setConstructorArgs([$loader])->getMock();
$this->normalizer = new AbstractNormalizerDummy($this->classMetadata);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
index 55fced0ab3..de88d07813 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
@@ -61,7 +61,7 @@ class AbstractObjectNormalizerTest extends TestCase
public function testDenormalizeWithExtraAttributes()
{
- $this->expectException('Symfony\Component\Serializer\Exception\ExtraAttributesException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\ExtraAttributesException::class);
$this->expectExceptionMessage('Extra attributes are not allowed ("fooFoo", "fooBar" are unknown).');
$factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$normalizer = new AbstractObjectNormalizerDummy($factory);
@@ -75,7 +75,7 @@ class AbstractObjectNormalizerTest extends TestCase
public function testDenormalizeWithExtraAttributesAndNoGroupsWithMetadataFactory()
{
- $this->expectException('Symfony\Component\Serializer\Exception\ExtraAttributesException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\ExtraAttributesException::class);
$this->expectExceptionMessage('Extra attributes are not allowed ("fooFoo", "fooBar" are unknown).');
$normalizer = new AbstractObjectNormalizerWithMetadata();
$normalizer->denormalize(
@@ -351,7 +351,7 @@ class AbstractObjectNormalizerTest extends TestCase
*/
public function testExtraAttributesException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\LogicException::class);
$this->expectExceptionMessage('A class metadata factory must be provided in the constructor when setting "allow_extra_attributes" to false.');
$normalizer = new ObjectNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
index b7566f8cf4..8551370d7a 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
@@ -31,9 +31,9 @@ class CustomNormalizerTest extends TestCase
public function testInterface()
{
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\NormalizerInterface', $this->normalizer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\DenormalizerInterface', $this->normalizer);
- $this->assertInstanceOf('Symfony\Component\Serializer\SerializerAwareInterface', $this->normalizer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Normalizer\NormalizerInterface::class, $this->normalizer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Normalizer\DenormalizerInterface::class, $this->normalizer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\SerializerAwareInterface::class, $this->normalizer);
}
public function testSerialize()
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
index f1a906b593..1e54f5b37b 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
@@ -36,8 +36,8 @@ class DataUriNormalizerTest extends TestCase
public function testInterface()
{
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\NormalizerInterface', $this->normalizer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\DenormalizerInterface', $this->normalizer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Normalizer\NormalizerInterface::class, $this->normalizer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Normalizer\DenormalizerInterface::class, $this->normalizer);
}
public function testSupportNormalization()
@@ -91,7 +91,7 @@ class DataUriNormalizerTest extends TestCase
{
$file = $this->normalizer->denormalize(self::TEST_TXT_DATA, 'SplFileInfo');
- $this->assertInstanceOf('SplFileInfo', $file);
+ $this->assertInstanceOf(\SplFileInfo::class, $file);
$this->assertSame(file_get_contents(self::TEST_TXT_DATA), $this->getContent($file));
}
@@ -99,7 +99,7 @@ class DataUriNormalizerTest extends TestCase
{
$file = $this->normalizer->denormalize(self::TEST_TXT_DATA, 'SplFileObject');
- $this->assertInstanceOf('SplFileObject', $file);
+ $this->assertInstanceOf(\SplFileObject::class, $file);
$this->assertEquals(file_get_contents(self::TEST_TXT_DATA), $this->getContent($file));
}
@@ -107,13 +107,13 @@ class DataUriNormalizerTest extends TestCase
{
$file = $this->normalizer->denormalize(self::TEST_GIF_DATA, 'Symfony\Component\HttpFoundation\File\File');
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $file);
+ $this->assertInstanceOf(File::class, $file);
$this->assertSame(file_get_contents(self::TEST_GIF_DATA), $this->getContent($file->openFile()));
}
public function testGiveNotAccessToLocalFiles()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->expectExceptionMessage('The provided "data:" URI is not valid.');
$this->normalizer->denormalize('/etc/shadow', 'SplFileObject');
}
@@ -123,7 +123,7 @@ class DataUriNormalizerTest extends TestCase
*/
public function testInvalidData($uri)
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->normalizer->denormalize($uri, 'SplFileObject');
}
@@ -149,7 +149,7 @@ class DataUriNormalizerTest extends TestCase
*/
public function testValidData($uri)
{
- $this->assertInstanceOf('SplFileObject', $this->normalizer->denormalize($uri, 'SplFileObject'));
+ $this->assertInstanceOf(\SplFileObject::class, $this->normalizer->denormalize($uri, 'SplFileObject'));
}
public function validUriProvider()
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
index 282d8a899f..ffe6374e2d 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
@@ -69,7 +69,7 @@ class DateIntervalNormalizerTest extends TestCase
public function testNormalizeInvalidObjectThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The object must be an instance of "\DateInterval".');
$this->normalizer->normalize(new \stdClass());
}
@@ -104,26 +104,26 @@ class DateIntervalNormalizerTest extends TestCase
public function testDenormalizeExpectsString()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->normalizer->denormalize(1234, \DateInterval::class);
}
public function testDenormalizeNonISO8601IntervalStringThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->expectExceptionMessage('Expected a valid ISO 8601 interval string.');
$this->normalizer->denormalize('10 years 2 months 3 days', \DateInterval::class, null);
}
public function testDenormalizeInvalidDataThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->normalizer->denormalize('invalid interval', \DateInterval::class);
}
public function testDenormalizeFormatMismatchThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->normalizer->denormalize('P00Y00M00DT00H00M00S', \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => 'P%yY%mM%dD']);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
index b77e34c619..a041074b84 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
@@ -157,7 +157,7 @@ class DateTimeNormalizerTest extends TestCase
public function testNormalizeInvalidObjectThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The object must implement the "\DateTimeInterface".');
$this->normalizer->normalize(new \stdClass());
}
@@ -236,27 +236,27 @@ class DateTimeNormalizerTest extends TestCase
public function testDenormalizeInvalidDataThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->normalizer->denormalize('invalid date', \DateTimeInterface::class);
}
public function testDenormalizeNullThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->expectExceptionMessage('The data is either an empty string or null, you should pass a string that can be parsed with the passed format or a valid DateTime string.');
$this->normalizer->denormalize(null, \DateTimeInterface::class);
}
public function testDenormalizeEmptyStringThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->expectExceptionMessage('The data is either an empty string or null, you should pass a string that can be parsed with the passed format or a valid DateTime string.');
$this->normalizer->denormalize('', \DateTimeInterface::class);
}
public function testDenormalizeFormatMismatchThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->normalizer->denormalize('2016-01-01T00:00:00+00:00', \DateTimeInterface::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d|']);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php
index 91d144e844..0fdbca0497 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php
@@ -44,7 +44,7 @@ class DateTimeZoneNormalizerTest extends TestCase
public function testNormalizeBadObjectTypeThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\InvalidArgumentException::class);
$this->normalizer->normalize(new \stdClass());
}
@@ -63,13 +63,13 @@ class DateTimeZoneNormalizerTest extends TestCase
public function testDenormalizeNullTimeZoneThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\NotNormalizableValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\NotNormalizableValueException::class);
$this->normalizer->denormalize(null, \DateTimeZone::class, null);
}
public function testDenormalizeBadTimeZoneThrowsException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\NotNormalizableValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\NotNormalizableValueException::class);
$this->normalizer->denormalize('Jupiter/Europa', \DateTimeZone::class, null);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
index c16bf1ee1f..5c77f33a51 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
@@ -73,8 +73,8 @@ class GetSetMethodNormalizerTest extends TestCase
public function testInterface()
{
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\NormalizerInterface', $this->normalizer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\DenormalizerInterface', $this->normalizer);
+ $this->assertInstanceOf(NormalizerInterface::class, $this->normalizer);
+ $this->assertInstanceOf(DenormalizerInterface::class, $this->normalizer);
}
public function testNormalize()
@@ -364,9 +364,9 @@ class GetSetMethodNormalizerTest extends TestCase
public function testUnableToNormalizeObjectAttribute()
{
- $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\LogicException::class);
$this->expectExceptionMessage('Cannot normalize attribute "object" because the injected serializer is not a normalizer');
- $serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
+ $serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
$this->normalizer->setSerializer($serializer);
$obj = new GetSetDummy();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
index e30fd27e8d..b4d54cf3e4 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
@@ -244,7 +244,7 @@ class ObjectNormalizerTest extends TestCase
public function testConstructorWithUnknownObjectTypeHintDenormalize()
{
- $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\RuntimeException::class);
$this->expectExceptionMessage('Could not determine the class of the parameter "unknown".');
$data = [
'id' => 10,
@@ -519,9 +519,9 @@ class ObjectNormalizerTest extends TestCase
public function testUnableToNormalizeObjectAttribute()
{
- $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\LogicException::class);
$this->expectExceptionMessage('Cannot normalize attribute "object" because the injected serializer is not a normalizer');
- $serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
+ $serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
$this->normalizer->setSerializer($serializer);
$obj = new ObjectDummy();
@@ -583,7 +583,7 @@ class ObjectNormalizerTest extends TestCase
public function testThrowUnexpectedValueException()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$this->normalizer->denormalize(['foo' => 'bar'], ObjectTypeHinted::class);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
index 663eacc3ef..991943beb0 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
@@ -68,7 +68,7 @@ class PropertyNormalizerTest extends TestCase
private function createNormalizer(array $defaultContext = [])
{
- $this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
+ $this->serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
$this->normalizer = new PropertyNormalizer(null, null, null, null, null, $defaultContext);
$this->normalizer->setSerializer($this->serializer);
}
@@ -327,9 +327,9 @@ class PropertyNormalizerTest extends TestCase
public function testUnableToNormalizeObjectAttribute()
{
- $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\LogicException::class);
$this->expectExceptionMessage('Cannot normalize attribute "bar" because the injected serializer is not a normalizer');
- $serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
+ $serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
$this->normalizer->setSerializer($serializer);
$obj = new PropertyDummy();
diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php
index 7a6562c235..9260300eea 100644
--- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php
@@ -57,11 +57,11 @@ class SerializerTest extends TestCase
{
$serializer = new Serializer();
- $this->assertInstanceOf('Symfony\Component\Serializer\SerializerInterface', $serializer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\NormalizerInterface', $serializer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Normalizer\DenormalizerInterface', $serializer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Encoder\EncoderInterface', $serializer);
- $this->assertInstanceOf('Symfony\Component\Serializer\Encoder\DecoderInterface', $serializer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\SerializerInterface::class, $serializer);
+ $this->assertInstanceOf(NormalizerInterface::class, $serializer);
+ $this->assertInstanceOf(DenormalizerInterface::class, $serializer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Encoder\EncoderInterface::class, $serializer);
+ $this->assertInstanceOf(\Symfony\Component\Serializer\Encoder\DecoderInterface::class, $serializer);
}
public function testItThrowsExceptionOnInvalidNormalizer()
@@ -82,8 +82,8 @@ class SerializerTest extends TestCase
public function testNormalizeNoMatch()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
- $serializer = new Serializer([$this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()]);
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
+ $serializer = new Serializer([$this->getMockBuilder(CustomNormalizer::class)->getMock()]);
$serializer->normalize(new \stdClass(), 'xml');
}
@@ -103,21 +103,21 @@ class SerializerTest extends TestCase
public function testNormalizeOnDenormalizer()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$serializer = new Serializer([new TestDenormalizer()], []);
$this->assertTrue($serializer->normalize(new \stdClass(), 'json'));
}
public function testDenormalizeNoMatch()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
- $serializer = new Serializer([$this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()]);
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
+ $serializer = new Serializer([$this->getMockBuilder(CustomNormalizer::class)->getMock()]);
$serializer->denormalize('foo', 'stdClass');
}
public function testDenormalizeOnNormalizer()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$serializer = new Serializer([new TestNormalizer()], []);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$this->assertTrue($serializer->denormalize(json_encode($data), 'stdClass', 'json'));
@@ -134,14 +134,14 @@ class SerializerTest extends TestCase
public function testNormalizeWithSupportOnData()
{
- $normalizer1 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\NormalizerInterface')->getMock();
+ $normalizer1 = $this->getMockBuilder(NormalizerInterface::class)->getMock();
$normalizer1->method('supportsNormalization')
->willReturnCallback(function ($data, $format) {
return isset($data->test);
});
$normalizer1->method('normalize')->willReturn('test1');
- $normalizer2 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\NormalizerInterface')->getMock();
+ $normalizer2 = $this->getMockBuilder(NormalizerInterface::class)->getMock();
$normalizer2->method('supportsNormalization')
->willReturn(true);
$normalizer2->method('normalize')->willReturn('test2');
@@ -157,14 +157,14 @@ class SerializerTest extends TestCase
public function testDenormalizeWithSupportOnData()
{
- $denormalizer1 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\DenormalizerInterface')->getMock();
+ $denormalizer1 = $this->getMockBuilder(DenormalizerInterface::class)->getMock();
$denormalizer1->method('supportsDenormalization')
->willReturnCallback(function ($data, $type, $format) {
return isset($data['test1']);
});
$denormalizer1->method('denormalize')->willReturn('test1');
- $denormalizer2 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\DenormalizerInterface')->getMock();
+ $denormalizer2 = $this->getMockBuilder(DenormalizerInterface::class)->getMock();
$denormalizer2->method('supportsDenormalization')
->willReturn(true);
$denormalizer2->method('denormalize')->willReturn('test2');
@@ -214,7 +214,7 @@ class SerializerTest extends TestCase
public function testSerializeNoEncoder()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$serializer = new Serializer([], []);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->serialize($data, 'json');
@@ -222,7 +222,7 @@ class SerializerTest extends TestCase
public function testSerializeNoNormalizer()
{
- $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\LogicException::class);
$serializer = new Serializer([], ['json' => new JsonEncoder()]);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->serialize(Model::fromArray($data), 'json');
@@ -248,7 +248,7 @@ class SerializerTest extends TestCase
public function testDeserializeNoNormalizer()
{
- $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\LogicException::class);
$serializer = new Serializer([], ['json' => new JsonEncoder()]);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->deserialize(json_encode($data), Model::class, 'json');
@@ -256,7 +256,7 @@ class SerializerTest extends TestCase
public function testDeserializeWrongNormalizer()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->deserialize(json_encode($data), Model::class, 'json');
@@ -264,7 +264,7 @@ class SerializerTest extends TestCase
public function testDeserializeNoEncoder()
{
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\UnexpectedValueException::class);
$serializer = new Serializer([], []);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->deserialize(json_encode($data), Model::class, 'json');
@@ -472,14 +472,14 @@ class SerializerTest extends TestCase
public function testExceptionWhenTypeIsNotKnownInDiscriminator()
{
- $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\RuntimeException::class);
$this->expectExceptionMessage('The type "second" has no mapped class for the abstract object "Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface"');
$this->serializerWithClassDiscriminator()->deserialize('{"type":"second","one":1}', DummyMessageInterface::class, 'json');
}
public function testExceptionWhenTypeIsNotInTheBodyToDeserialiaze()
{
- $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Serializer\Exception\RuntimeException::class);
$this->expectExceptionMessage('Type property "type" not found for the abstract object "Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface"');
$this->serializerWithClassDiscriminator()->deserialize('{"one":1}', DummyMessageInterface::class, 'json');
}
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
index f2aa3e7273..82b3c832a7 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
@@ -122,7 +122,7 @@ class StopwatchEventTest extends TestCase
public function testStopWithoutStart()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$event = new StopwatchEvent(microtime(true) * 1000);
$event->stop();
}
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
index 5dd0c3c2d8..a5bcb5d724 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
@@ -30,7 +30,7 @@ class StopwatchTest extends TestCase
$stopwatch = new Stopwatch();
$event = $stopwatch->start('foo', 'cat');
- $this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
+ $this->assertInstanceOf(\Symfony\Component\Stopwatch\StopwatchEvent::class, $event);
$this->assertEquals('cat', $event->getCategory());
$this->assertSame($event, $stopwatch->getEvent('foo'));
}
@@ -62,14 +62,14 @@ class StopwatchTest extends TestCase
{
$stopwatch = new Stopwatch();
- $sections = new \ReflectionProperty('Symfony\Component\Stopwatch\Stopwatch', 'sections');
+ $sections = new \ReflectionProperty(Stopwatch::class, 'sections');
$sections->setAccessible(true);
$section = $sections->getValue($stopwatch);
- $events = new \ReflectionProperty('Symfony\Component\Stopwatch\Section', 'events');
+ $events = new \ReflectionProperty(\Symfony\Component\Stopwatch\Section::class, 'events');
$events->setAccessible(true);
- $stopwatchMockEvent = $this->getMockBuilder('Symfony\Component\Stopwatch\StopwatchEvent')
+ $stopwatchMockEvent = $this->getMockBuilder(\Symfony\Component\Stopwatch\StopwatchEvent::class)
->setConstructorArgs([microtime(true) * 1000])
->getMock()
;
@@ -86,20 +86,20 @@ class StopwatchTest extends TestCase
usleep(200000);
$event = $stopwatch->stop('foo');
- $this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
+ $this->assertInstanceOf(\Symfony\Component\Stopwatch\StopwatchEvent::class, $event);
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
}
public function testUnknownEvent()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$stopwatch = new Stopwatch();
$stopwatch->getEvent('foo');
}
public function testStopWithoutStart()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$stopwatch = new Stopwatch();
$stopwatch->stop('foo');
}
@@ -163,7 +163,7 @@ class StopwatchTest extends TestCase
public function testReopenANewSectionShouldThrowAnException()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$stopwatch = new Stopwatch();
$stopwatch->openSection('section');
}
diff --git a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
index 862b0f04d4..c590d8557d 100644
--- a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
@@ -36,7 +36,7 @@ class DelegatingEngineTest extends TestCase
public function testRenderWithNoSupportedEngine()
{
- $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);
@@ -61,7 +61,7 @@ class DelegatingEngineTest extends TestCase
public function testStreamRequiresStreamingEngine()
{
- $this->expectException('LogicException');
+ $this->expectException(\LogicException::class);
$this->expectExceptionMessage('Template "template.php" cannot be streamed as the engine supporting it does not implement StreamingEngineInterface');
$delegatingEngine = new DelegatingEngine([new TestEngine()]);
$delegatingEngine->stream('template.php', ['foo' => 'bar']);
@@ -110,7 +110,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);
@@ -121,7 +121,7 @@ class DelegatingEngineTest extends TestCase
private function getEngineMock($template, $supports)
{
- $engine = $this->getMockBuilder('Symfony\Component\Templating\EngineInterface')->getMock();
+ $engine = $this->getMockBuilder(EngineInterface::class)->getMock();
$engine->expects($this->once())
->method('supports')
@@ -133,7 +133,7 @@ class DelegatingEngineTest extends TestCase
private function getStreamingEngineMock($template, $supports)
{
- $engine = $this->getMockForAbstractClass('Symfony\Component\Templating\Tests\MyStreamingEngine');
+ $engine = $this->getMockForAbstractClass(\Symfony\Component\Templating\Tests\MyStreamingEngine::class);
$engine->expects($this->once())
->method('supports')
diff --git a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
index 46febca324..45eada7f3c 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
@@ -35,7 +35,7 @@ class CacheLoaderTest extends TestCase
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), $dir);
$this->assertFalse($loader->load(new TemplateReference('foo', 'php')), '->load() returns false if the embed loader is not able to load the template');
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger
->expects($this->once())
->method('debug')
@@ -43,7 +43,7 @@ class CacheLoaderTest extends TestCase
$loader->setLogger($logger);
$loader->load(new TemplateReference('index'));
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger
->expects($this->once())
->method('debug')
diff --git a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
index 213468d4f9..bb63c12fb2 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
@@ -49,16 +49,16 @@ class FilesystemLoaderTest extends TestCase
$path = self::$fixturesPath.'/templates';
$loader = new ProjectTemplateLoader2($pathPattern);
$storage = $loader->load(new TemplateReference($path.'/foo.php', 'php'));
- $this->assertInstanceOf('Symfony\Component\Templating\Storage\FileStorage', $storage, '->load() returns a FileStorage if you pass an absolute path');
+ $this->assertInstanceOf(\Symfony\Component\Templating\Storage\FileStorage::class, $storage, '->load() returns a FileStorage if you pass an absolute path');
$this->assertEquals($path.'/foo.php', (string) $storage, '->load() returns a FileStorage pointing to the passed absolute path');
$this->assertFalse($loader->load(new TemplateReference('bar', 'php')), '->load() returns false if the template is not found');
$storage = $loader->load(new TemplateReference('foo.php', 'php'));
- $this->assertInstanceOf('Symfony\Component\Templating\Storage\FileStorage', $storage, '->load() returns a FileStorage if you pass a relative template that exists');
+ $this->assertInstanceOf(\Symfony\Component\Templating\Storage\FileStorage::class, $storage, '->load() returns a FileStorage if you pass a relative template that exists');
$this->assertEquals($path.'/foo.php', (string) $storage, '->load() returns a FileStorage pointing to the absolute path of the template');
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$logger->expects($this->exactly(2))->method('debug');
$loader = new ProjectTemplateLoader2($pathPattern);
diff --git a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php
index 6d133415d0..3459ba093b 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php
@@ -20,7 +20,7 @@ class LoaderTest extends TestCase
public function testGetSetLogger()
{
$loader = new ProjectTemplateLoader4();
- $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
$loader->setLogger($logger);
$this->assertSame($logger, $loader->getLogger(), '->setLogger() sets the logger instance');
}
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index bfe6933f5b..c6676fcde5 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -129,7 +129,7 @@ class PhpEngineTest extends TestCase
*/
public function testRenderForbiddenParameter($name)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader);
$this->loader->setTemplate('foo.php', 'bar');
$engine->render('foo.php', [$name => 'foo']);
diff --git a/src/Symfony/Component/Templating/Tests/Storage/FileStorageTest.php b/src/Symfony/Component/Templating/Tests/Storage/FileStorageTest.php
index ed3ca51d9d..2a0e73c195 100644
--- a/src/Symfony/Component/Templating/Tests/Storage/FileStorageTest.php
+++ b/src/Symfony/Component/Templating/Tests/Storage/FileStorageTest.php
@@ -19,7 +19,7 @@ class FileStorageTest extends TestCase
public function testGetContent()
{
$storage = new FileStorage('foo');
- $this->assertInstanceOf('Symfony\Component\Templating\Storage\Storage', $storage, 'FileStorage is an instance of Storage');
+ $this->assertInstanceOf(\Symfony\Component\Templating\Storage\Storage::class, $storage, 'FileStorage is an instance of Storage');
$storage = new FileStorage(__DIR__.'/../Fixtures/templates/foo.php');
$this->assertEquals(''."\n", $storage->getContent(), '->getContent() returns the content of the template');
}
diff --git a/src/Symfony/Component/Templating/Tests/Storage/StringStorageTest.php b/src/Symfony/Component/Templating/Tests/Storage/StringStorageTest.php
index ecfeb800c8..7b32542e18 100644
--- a/src/Symfony/Component/Templating/Tests/Storage/StringStorageTest.php
+++ b/src/Symfony/Component/Templating/Tests/Storage/StringStorageTest.php
@@ -19,7 +19,7 @@ class StringStorageTest extends TestCase
public function testGetContent()
{
$storage = new StringStorage('foo');
- $this->assertInstanceOf('Symfony\Component\Templating\Storage\Storage', $storage, 'StringStorage is an instance of Storage');
+ $this->assertInstanceOf(\Symfony\Component\Templating\Storage\Storage::class, $storage, 'StringStorage is an instance of Storage');
$storage = new StringStorage('foo');
$this->assertEquals('foo', $storage->getContent(), '->getContent() returns the content of the template');
}
diff --git a/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php b/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php
index ac589c975e..0b21e8c830 100644
--- a/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php
+++ b/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php
@@ -35,7 +35,7 @@ class YamlFileDumper extends FileDumper
*/
public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = [])
{
- if (!class_exists('Symfony\Component\Yaml\Yaml')) {
+ if (!class_exists(Yaml::class)) {
throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.');
}
diff --git a/src/Symfony/Component/Translation/Loader/FileLoader.php b/src/Symfony/Component/Translation/Loader/FileLoader.php
index 60c5b348e8..2ffba392d5 100644
--- a/src/Symfony/Component/Translation/Loader/FileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/FileLoader.php
@@ -47,7 +47,7 @@ abstract class FileLoader extends ArrayLoader
$catalogue = parent::load($messages, $locale, $domain);
- if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
+ if (class_exists(FileResource::class)) {
$catalogue->addResource(new FileResource($resource));
}
diff --git a/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php b/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php
index 0b7168181d..2a1aecc601 100644
--- a/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php
@@ -52,7 +52,7 @@ class IcuDatFileLoader extends IcuResFileLoader
$catalogue = new MessageCatalogue($locale);
$catalogue->add($messages, $domain);
- if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
+ if (class_exists(FileResource::class)) {
$catalogue->addResource(new FileResource($resource.'.dat'));
}
diff --git a/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php b/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php
index 9aa30bd652..64bbd3e14f 100644
--- a/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php
@@ -52,7 +52,7 @@ class IcuResFileLoader implements LoaderInterface
$catalogue = new MessageCatalogue($locale);
$catalogue->add($messages, $domain);
- if (class_exists('Symfony\Component\Config\Resource\DirectoryResource')) {
+ if (class_exists(DirectoryResource::class)) {
$catalogue->addResource(new DirectoryResource($resource));
}
diff --git a/src/Symfony/Component/Translation/Loader/QtFileLoader.php b/src/Symfony/Component/Translation/Loader/QtFileLoader.php
index aa89e03978..9cf2fe9760 100644
--- a/src/Symfony/Component/Translation/Loader/QtFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/QtFileLoader.php
@@ -70,7 +70,7 @@ class QtFileLoader implements LoaderInterface
$translation = $translation->nextSibling;
}
- if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
+ if (class_exists(FileResource::class)) {
$catalogue->addResource(new FileResource($resource));
}
}
diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
index dc7e936860..f573dfe4c7 100644
--- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
@@ -46,7 +46,7 @@ class XliffFileLoader implements LoaderInterface
$catalogue = new MessageCatalogue($locale);
$this->extract($resource, $catalogue, $domain);
- if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
+ if (class_exists(FileResource::class)) {
$catalogue->addResource(new FileResource($resource));
}
diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php
index e4bee0cfbf..b03c7b77d0 100644
--- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php
@@ -32,7 +32,7 @@ class YamlFileLoader extends FileLoader
protected function loadResource($resource)
{
if (null === $this->yamlParser) {
- if (!class_exists('Symfony\Component\Yaml\Parser')) {
+ if (!class_exists(\Symfony\Component\Yaml\Parser::class)) {
throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml component.');
}
diff --git a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
index f82b18fdd7..30fc1171ed 100644
--- a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
+++ b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
@@ -41,7 +41,7 @@ abstract class AbstractOperationTest extends TestCase
public function testGetMessagesFromUnknownDomain()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->createOperation(
new MessageCatalogue('en'),
new MessageCatalogue('en')
diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php
index d9801a8fa1..3b630911ee 100644
--- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php
+++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php
@@ -107,7 +107,7 @@ class XliffLintCommandTest extends TestCase
public function testLintFileNotReadable()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$tester = $this->createCommandTester();
$filename = $this->createFile();
unlink($filename);
diff --git a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
index 1a600c8c6b..e1c5f67f0a 100644
--- a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
+++ b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
@@ -19,7 +19,7 @@ class TranslationDataCollectorTest extends TestCase
{
protected function setUp(): void
{
- if (!class_exists('Symfony\Component\HttpKernel\DataCollector\DataCollector')) {
+ if (!class_exists(\Symfony\Component\HttpKernel\DataCollector\DataCollector::class)) {
$this->markTestSkipped('The "DataCollector" is not available');
}
}
@@ -140,7 +140,7 @@ class TranslationDataCollectorTest extends TestCase
private function getTranslator()
{
$translator = $this
- ->getMockBuilder('Symfony\Component\Translation\DataCollectorTranslator')
+ ->getMockBuilder(DataCollectorTranslator::class)
->disableOriginalConstructor()
->getMock()
;
diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
index 113536bca8..6364b9bcaf 100644
--- a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
+++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
@@ -48,7 +48,7 @@ class TranslationExtractorPassTest extends TestCase
public function testProcessMissingAlias()
{
- $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
$this->expectExceptionMessage('The alias for the tag "translation.extractor" of service "foo.id" must be set.');
$container = new ContainerBuilder();
$container->register('translation.extractor');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
index 9537e1f1c4..44cba5f340 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
@@ -41,7 +41,7 @@ class CsvFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new CsvFileLoader();
$resource = __DIR__.'/../fixtures/not-exists.csv';
$loader->load($resource, 'en', 'domain1');
@@ -49,7 +49,7 @@ class CsvFileLoaderTest extends TestCase
public function testLoadNonLocalResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new CsvFileLoader();
$resource = 'http://example.com/resources.csv';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
index 77db041f5d..fe107210d5 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
@@ -21,7 +21,7 @@ class IcuDatFileLoaderTest extends LocalizedTestCase
{
public function testLoadInvalidResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new IcuDatFileLoader();
$loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2');
}
@@ -53,7 +53,7 @@ class IcuDatFileLoaderTest extends LocalizedTestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new IcuDatFileLoader();
$loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
}
diff --git a/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
index 99b2f90421..c334652232 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
@@ -33,14 +33,14 @@ class IcuResFileLoaderTest extends LocalizedTestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new IcuResFileLoader();
$loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
}
public function testLoadInvalidResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new IcuResFileLoader();
$loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted', 'en', 'domain1');
}
diff --git a/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
index fd66e2015a..3330e7e372 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
@@ -41,7 +41,7 @@ class IniFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new IniFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.ini';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
index c5a9ca64d4..c3ef1f7628 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
@@ -41,7 +41,7 @@ class JsonFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new JsonFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.json';
$loader->load($resource, 'en', 'domain1');
@@ -49,7 +49,7 @@ class JsonFileLoaderTest extends TestCase
public function testParseException()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$this->expectExceptionMessage('Error parsing JSON: Syntax error, malformed JSON');
$loader = new JsonFileLoader();
$resource = __DIR__.'/../fixtures/malformed.json';
diff --git a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
index 3fe3a9925b..8da81ba8c7 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
@@ -44,7 +44,7 @@ class MoFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new MoFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.mo';
$loader->load($resource, 'en', 'domain1');
@@ -52,7 +52,7 @@ class MoFileLoaderTest extends TestCase
public function testLoadInvalidResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new MoFileLoader();
$resource = __DIR__.'/../fixtures/empty.mo';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
index d4da6452f6..1b2c9fac06 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
@@ -30,7 +30,7 @@ class PhpFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new PhpFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.php';
$loader->load($resource, 'en', 'domain1');
@@ -38,7 +38,7 @@ class PhpFileLoaderTest extends TestCase
public function testLoadThrowsAnExceptionIfFileNotLocal()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new PhpFileLoader();
$resource = 'http://example.com/resources.php';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
index 72c4c66723..04c084eac5 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
@@ -55,7 +55,7 @@ class PoFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new PoFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.po';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
index 95981c7fe8..0d2817b39c 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
@@ -34,7 +34,7 @@ class QtFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new QtFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.ts';
$loader->load($resource, 'en', 'domain1');
@@ -42,7 +42,7 @@ class QtFileLoaderTest extends TestCase
public function testLoadNonLocalResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new QtFileLoader();
$resource = 'http://domain1.com/resources.ts';
$loader->load($resource, 'en', 'domain1');
@@ -50,7 +50,7 @@ class QtFileLoaderTest extends TestCase
public function testLoadInvalidResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new QtFileLoader();
$resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf';
$loader->load($resource, 'en', 'domain1');
@@ -61,7 +61,7 @@ class QtFileLoaderTest extends TestCase
$loader = new QtFileLoader();
$resource = __DIR__.'/../fixtures/empty.xlf';
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$this->expectExceptionMessage(sprintf('Unable to load "%s".', $resource));
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
index 28c91229b0..ace7b84d5a 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -112,21 +112,21 @@ class XliffFileLoaderTest extends TestCase
public function testLoadInvalidResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new XliffFileLoader();
$loader->load(__DIR__.'/../fixtures/resources.php', 'en', 'domain1');
}
public function testLoadResourceDoesNotValidate()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new XliffFileLoader();
$loader->load(__DIR__.'/../fixtures/non-valid.xlf', 'en', 'domain1');
}
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new XliffFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.xlf';
$loader->load($resource, 'en', 'domain1');
@@ -134,7 +134,7 @@ class XliffFileLoaderTest extends TestCase
public function testLoadThrowsAnExceptionIfFileNotLocal()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new XliffFileLoader();
$resource = 'http://example.com/resources.xlf';
$loader->load($resource, 'en', 'domain1');
@@ -142,7 +142,7 @@ class XliffFileLoaderTest extends TestCase
public function testDocTypeIsNotAllowed()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$this->expectExceptionMessage('Document types are not allowed.');
$loader = new XliffFileLoader();
$loader->load(__DIR__.'/../fixtures/withdoctype.xlf', 'en', 'domain1');
@@ -153,7 +153,7 @@ class XliffFileLoaderTest extends TestCase
$loader = new XliffFileLoader();
$resource = __DIR__.'/../fixtures/empty.xlf';
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$this->expectExceptionMessage(sprintf('Unable to load "%s":', $resource));
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
index b46fff7470..f1e6f4aece 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
@@ -41,7 +41,7 @@ class YamlFileLoaderTest extends TestCase
public function testLoadNonExistingResource()
{
- $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\NotFoundResourceException::class);
$loader = new YamlFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.yml';
$loader->load($resource, 'en', 'domain1');
@@ -49,7 +49,7 @@ class YamlFileLoaderTest extends TestCase
public function testLoadThrowsAnExceptionIfFileNotLocal()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new YamlFileLoader();
$resource = 'http://example.com/resources.yml';
$loader->load($resource, 'en', 'domain1');
@@ -57,7 +57,7 @@ class YamlFileLoaderTest extends TestCase
public function testLoadThrowsAnExceptionIfNotAnArray()
{
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectException(\Symfony\Component\Translation\Exception\InvalidResourceException::class);
$loader = new YamlFileLoader();
$resource = __DIR__.'/../fixtures/non-valid.yml';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
index d4090b1520..151fb2dc6b 100644
--- a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
+++ b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
@@ -126,10 +126,10 @@ class MessageCatalogueTest extends TestCase
public function testAddCatalogue()
{
- $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r->expects($this->any())->method('__toString')->willReturn('r');
- $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r1 = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r1->expects($this->any())->method('__toString')->willReturn('r1');
$catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo']]);
@@ -150,13 +150,13 @@ class MessageCatalogueTest extends TestCase
public function testAddFallbackCatalogue()
{
- $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r->expects($this->any())->method('__toString')->willReturn('r');
- $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r1 = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r1->expects($this->any())->method('__toString')->willReturn('r1');
- $r2 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r2 = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r2->expects($this->any())->method('__toString')->willReturn('r2');
$catalogue = new MessageCatalogue('fr_FR', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]);
@@ -179,7 +179,7 @@ class MessageCatalogueTest extends TestCase
public function testAddFallbackCatalogueWithParentCircularReference()
{
- $this->expectException('Symfony\Component\Translation\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Translation\Exception\LogicException::class);
$main = new MessageCatalogue('en_US');
$fallback = new MessageCatalogue('fr_FR');
@@ -189,7 +189,7 @@ class MessageCatalogueTest extends TestCase
public function testAddFallbackCatalogueWithFallbackCircularReference()
{
- $this->expectException('Symfony\Component\Translation\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Translation\Exception\LogicException::class);
$fr = new MessageCatalogue('fr');
$en = new MessageCatalogue('en');
$es = new MessageCatalogue('es');
@@ -201,7 +201,7 @@ class MessageCatalogueTest extends TestCase
public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne()
{
- $this->expectException('Symfony\Component\Translation\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Translation\Exception\LogicException::class);
$catalogue = new MessageCatalogue('en');
$catalogue->addCatalogue(new MessageCatalogue('fr', []));
}
@@ -209,11 +209,11 @@ class MessageCatalogueTest extends TestCase
public function testGetAddResource()
{
$catalogue = new MessageCatalogue('en');
- $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r->expects($this->any())->method('__toString')->willReturn('r');
$catalogue->addResource($r);
$catalogue->addResource($r);
- $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock();
+ $r1 = $this->getMockBuilder(\Symfony\Component\Config\Resource\ResourceInterface::class)->getMock();
$r1->expects($this->any())->method('__toString')->willReturn('r1');
$catalogue->addResource($r1);
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
index a22dcc969f..86ef327aff 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
@@ -105,7 +105,7 @@ class TranslatorCacheTest extends TestCase
$catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded
/** @var LoaderInterface|MockObject $loader */
- $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(LoaderInterface::class)->getMock();
$loader
->expects($this->exactly(2))
->method('load')
@@ -252,8 +252,8 @@ class TranslatorCacheTest extends TestCase
public function testRefreshCacheWhenResourcesAreNoLongerFresh()
{
- $resource = $this->getMockBuilder('Symfony\Component\Config\Resource\SelfCheckingResourceInterface')->getMock();
- $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
+ $resource = $this->getMockBuilder(SelfCheckingResourceInterface::class)->getMock();
+ $loader = $this->getMockBuilder(LoaderInterface::class)->getMock();
$resource->method('isFresh')->willReturn(false);
$loader
->expects($this->exactly(2))
@@ -309,7 +309,7 @@ class TranslatorCacheTest extends TestCase
private function createFailingLoader(): LoaderInterface
{
- $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
+ $loader = $this->getMockBuilder(LoaderInterface::class)->getMock();
$loader
->expects($this->never())
->method('load');
diff --git a/src/Symfony/Component/Translation/Tests/Writer/TranslationWriterTest.php b/src/Symfony/Component/Translation/Tests/Writer/TranslationWriterTest.php
index 3ea5ca779f..5723ec4fa5 100644
--- a/src/Symfony/Component/Translation/Tests/Writer/TranslationWriterTest.php
+++ b/src/Symfony/Component/Translation/Tests/Writer/TranslationWriterTest.php
@@ -19,7 +19,7 @@ class TranslationWriterTest extends TestCase
{
public function testWrite()
{
- $dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock();
+ $dumper = $this->getMockBuilder(DumperInterface::class)->getMock();
$dumper
->expects($this->once())
->method('dump');
diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php
index 78aa1cfa3c..f976513ba1 100644
--- a/src/Symfony/Component/Validator/ConstraintValidator.php
+++ b/src/Symfony/Component/Validator/ConstraintValidator.php
@@ -87,7 +87,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
protected function formatValue($value, int $format = 0)
{
if (($format & self::PRETTY_DATE) && $value instanceof \DateTimeInterface) {
- if (class_exists('IntlDateFormatter')) {
+ if (class_exists(\IntlDateFormatter::class)) {
$formatter = new \IntlDateFormatter(\Locale::getDefault(), \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT, 'UTC');
return $formatter->format(new \DateTime(
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintTest.php b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
index 26cc460d39..23466dd4ff 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
@@ -38,7 +38,7 @@ class ConstraintTest extends TestCase
public function testSetNotExistingPropertyThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException(InvalidOptionsException::class);
new ConstraintA([
'foo' => 'bar',
@@ -49,14 +49,14 @@ class ConstraintTest extends TestCase
{
$constraint = new ConstraintA();
- $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException(InvalidOptionsException::class);
$constraint->foo = 'bar';
}
public function testInvalidAndRequiredOptionsPassed()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException(InvalidOptionsException::class);
new ConstraintC([
'option1' => 'default',
@@ -104,14 +104,14 @@ class ConstraintTest extends TestCase
public function testSetUndefinedDefaultProperty()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new ConstraintB('foo');
}
public function testRequiredOptionsMustBeDefined()
{
- $this->expectException('Symfony\Component\Validator\Exception\MissingOptionsException');
+ $this->expectException(\Symfony\Component\Validator\Exception\MissingOptionsException::class);
new ConstraintC();
}
@@ -209,7 +209,7 @@ class ConstraintTest extends TestCase
public function testGetErrorNameForUnknownCode()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
Constraint::getErrorName(1);
}
@@ -226,7 +226,7 @@ class ConstraintTest extends TestCase
public function testInvalidOptions()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException(InvalidOptionsException::class);
$this->expectExceptionMessage('The options "0", "5" do not exist in constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintA".');
new ConstraintA(['property2' => 'foo', 'bar', 5 => 'baz']);
}
@@ -244,7 +244,7 @@ class ConstraintTest extends TestCase
public function testAnnotationSetUndefinedDefaultOption()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('No default option is configured for constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintB".');
new ConstraintB(['value' => 1]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
index 38d7076cf2..73af627ac2 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
@@ -82,14 +82,14 @@ abstract class AbstractComparisonValidatorTestCase extends ConstraintValidatorTe
*/
public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires either the "value" or "propertyPath" option to be set.');
$this->createConstraint($options);
}
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "value" or "propertyPath" options to be set, not both.');
$this->createConstraint(([
'value' => 'value',
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
index 5893298711..78e5b60103 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
@@ -22,7 +22,7 @@ class AllTest extends TestCase
{
public function testRejectNonConstraints()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new All([
'foo',
]);
@@ -30,7 +30,7 @@ class AllTest extends TestCase
public function testRejectValidConstraint()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new All([
new Valid(),
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
index 6c10a4e4ec..fb7fd281bb 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
@@ -33,7 +33,7 @@ class AllValidatorTest extends ConstraintValidatorTestCase
public function testThrowsExceptionIfNotTraversable()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate('foo.barbar', new All(new Range(['min' => 4])));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php
index 816fca1de4..786b90f7ec 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php
@@ -147,7 +147,7 @@ class BicValidatorTest extends ConstraintValidatorTestCase
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "iban" and "ibanPropertyPath" options of the Iban constraint cannot be used at the same time');
new Bic([
'iban' => 'value',
@@ -182,7 +182,7 @@ class BicValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Bic());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
index 86a1af88da..71b6b717ea 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
@@ -182,7 +182,7 @@ class CallbackValidatorTest extends ConstraintValidatorTestCase
public function testExpectValidMethods()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$object = new CallbackValidatorTest_Object();
$this->validator->validate($object, new Callback(['callback' => ['foobar']]));
@@ -190,7 +190,7 @@ class CallbackValidatorTest extends ConstraintValidatorTestCase
public function testExpectValidCallbacks()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$object = new CallbackValidatorTest_Object();
$this->validator->validate($object, new Callback(['callback' => ['foo', 'bar']]));
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
index b8571c5f81..ea169e9726 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
@@ -39,7 +39,7 @@ class ChoiceValidatorTest extends ConstraintValidatorTestCase
public function testExpectArrayIfMultipleIsTrue()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$constraint = new Choice([
'choices' => ['foo', 'bar'],
'multiple' => true,
@@ -62,13 +62,13 @@ class ChoiceValidatorTest extends ConstraintValidatorTestCase
public function testChoicesOrCallbackExpected()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->validator->validate('foobar', new Choice());
}
public function testValidCallbackExpected()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->validator->validate('foobar', new Choice(['callback' => 'abcd']));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
index 254154dae7..8a1c73e1f6 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
@@ -25,7 +25,7 @@ class CollectionTest extends TestCase
{
public function testRejectInvalidFieldsOption()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Collection([
'fields' => 'foo',
]);
@@ -33,7 +33,7 @@ class CollectionTest extends TestCase
public function testRejectNonConstraints()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Collection([
'foo' => 'bar',
]);
@@ -41,7 +41,7 @@ class CollectionTest extends TestCase
public function testRejectValidConstraint()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Collection([
'foo' => new Valid(),
]);
@@ -49,7 +49,7 @@ class CollectionTest extends TestCase
public function testRejectValidConstraintWithinOptional()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Collection([
'foo' => new Optional(new Valid()),
]);
@@ -57,7 +57,7 @@ class CollectionTest extends TestCase
public function testRejectValidConstraintWithinRequired()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Collection([
'foo' => new Required(new Valid()),
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
index 3b3ee04509..effac4156c 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
@@ -54,7 +54,7 @@ abstract class CollectionValidatorTest extends ConstraintValidatorTestCase
public function testThrowsExceptionIfNotTraversable()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate('foobar', new Collection(['fields' => [
'foo' => new Range(['min' => 4]),
]]));
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
index 82c224ff4d..69466d3d53 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
@@ -105,7 +105,7 @@ class CompositeTest extends TestCase
public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new ConcreteComposite([
'constraints' => [
new NotNull(['groups' => ['Default', 'Foobar']]),
@@ -138,7 +138,7 @@ class CompositeTest extends TestCase
public function testFailIfNoConstraint()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new ConcreteComposite([
new NotNull(['groups' => 'Default']),
'NotBlank',
@@ -147,7 +147,7 @@ class CompositeTest extends TestCase
public function testFailIfNoConstraintObject()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new ConcreteComposite([
new NotNull(['groups' => 'Default']),
new \ArrayObject(),
@@ -156,7 +156,7 @@ class CompositeTest extends TestCase
public function testValidCantBeNested()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new ConcreteComposite([
new Valid(),
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
index 6616457313..c27792fcef 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
@@ -37,7 +37,7 @@ abstract class CountValidatorTest extends ConstraintValidatorTestCase
public function testExpectsCountableType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Count(5));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
index 27d83fea27..8f49b7f804 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
@@ -55,7 +55,7 @@ class CountryValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Country());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
index f2ca4b5a10..840cb96866 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
@@ -55,7 +55,7 @@ class CurrencyValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Currency());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
index 438957af74..37c80efd95 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
@@ -38,7 +38,7 @@ class DateTimeValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new DateTime());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
index ed97ece8e5..4aa4990c51 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
@@ -38,7 +38,7 @@ class DateValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Date());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php
index 84da112693..471578bb49 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php
@@ -27,7 +27,7 @@ class EmailTest extends TestCase
public function testUnknownModesTriggerException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "mode" parameter value is not valid.');
new Email(['mode' => 'Unknown Mode']);
}
@@ -41,14 +41,14 @@ class EmailTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new Email(['normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new Email(['normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
index 7a2829f629..d631bad0e6 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
@@ -27,7 +27,7 @@ class EmailValidatorTest extends ConstraintValidatorTestCase
public function testUnknownDefaultModeTriggerException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The "defaultMode" parameter value is not valid.');
new EmailValidator('Unknown Mode');
}
@@ -55,7 +55,7 @@ class EmailValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Email());
}
@@ -224,7 +224,7 @@ class EmailValidatorTest extends ConstraintValidatorTestCase
public function testUnknownModesOnValidateTriggerException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The "Symfony\Component\Validator\Constraints\Email::$mode" parameter value is not valid.');
$constraint = new Email();
$constraint->mode = 'Unknown Mode';
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
index aea824cfda..31227bb737 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
@@ -57,7 +57,7 @@ class FileTest extends TestCase
*/
public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($maxSize)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$file = new File(['maxSize' => 1000]);
$file->maxSize = $maxSize;
}
@@ -82,7 +82,7 @@ class FileTest extends TestCase
*/
public function testInvalidMaxSize($maxSize)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
new File(['maxSize' => $maxSize]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
index 9894bf266c..36987b26a4 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
@@ -68,7 +68,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleTypeOrFile()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new File());
}
@@ -224,7 +224,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMaxSize()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new File([
'maxSize' => '1abc',
]);
@@ -307,7 +307,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
public function testValidMimeType()
{
$file = $this
- ->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
+ ->getMockBuilder(\Symfony\Component\HttpFoundation\File\File::class)
->setConstructorArgs([__DIR__.'/Fixtures/foo'])
->getMock();
$file
@@ -331,7 +331,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
public function testValidWildcardMimeType()
{
$file = $this
- ->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
+ ->getMockBuilder(\Symfony\Component\HttpFoundation\File\File::class)
->setConstructorArgs([__DIR__.'/Fixtures/foo'])
->getMock();
$file
@@ -358,7 +358,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMimeType(File $constraint)
{
$file = $this
- ->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
+ ->getMockBuilder(\Symfony\Component\HttpFoundation\File\File::class)
->setConstructorArgs([__DIR__.'/Fixtures/foo'])
->getMock();
$file
@@ -398,7 +398,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
public function testInvalidWildcardMimeType()
{
$file = $this
- ->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
+ ->getMockBuilder(\Symfony\Component\HttpFoundation\File\File::class)
->setConstructorArgs([__DIR__.'/Fixtures/foo'])
->getMock();
$file
@@ -486,7 +486,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
[(string) \UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'],
];
- if (class_exists('Symfony\Component\HttpFoundation\File\UploadedFile')) {
+ if (class_exists(UploadedFile::class)) {
// when no maxSize is specified on constraint, it should use the ini value
$tests[] = [(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [
'{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576,
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php
index c614572ae1..34dc92eca1 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php
@@ -55,7 +55,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
public function testThrowsConstraintExceptionIfPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\PositiveOrZero" constraint cannot be set.');
return new PositiveOrZero(['propertyPath' => 'field']);
@@ -63,7 +63,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
public function testThrowsConstraintExceptionIfValue()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\PositiveOrZero" constraint cannot be set.');
return new PositiveOrZero(['value' => 0]);
@@ -74,14 +74,14 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
*/
public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires either the "value" or "propertyPath" option to be set.');
$this->markTestSkipped('Value option always set for PositiveOrZero constraint');
}
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "value" or "propertyPath" options to be set, not both.');
$this->markTestSkipped('Value option is set for PositiveOrZero constraint automatically');
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php
index 471f7016e6..50aea4f7a0 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php
@@ -53,7 +53,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
public function testThrowsConstraintExceptionIfPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\Positive" constraint cannot be set.');
return new Positive(['propertyPath' => 'field']);
@@ -61,7 +61,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
public function testThrowsConstraintExceptionIfValue()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\Positive" constraint cannot be set.');
return new Positive(['value' => 0]);
@@ -72,14 +72,14 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
*/
public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires either the "value" or "propertyPath" option to be set.');
$this->markTestSkipped('Value option always set for Positive constraint.');
}
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "value" or "propertyPath" options to be set, not both.');
$this->markTestSkipped('Value option is set for Positive constraint automatically');
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
index 96f1a8139c..1f089088ed 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
@@ -287,7 +287,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMinWidth()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'minWidth' => '1abc',
]);
@@ -297,7 +297,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMaxWidth()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'maxWidth' => '1abc',
]);
@@ -307,7 +307,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMinHeight()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'minHeight' => '1abc',
]);
@@ -317,7 +317,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMaxHeight()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'maxHeight' => '1abc',
]);
@@ -327,7 +327,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMinPixels()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'minPixels' => '1abc',
]);
@@ -337,7 +337,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMaxPixels()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'maxPixels' => '1abc',
]);
@@ -414,7 +414,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMinRatio()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'minRatio' => '1abc',
]);
@@ -424,7 +424,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
public function testInvalidMaxRatio()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$constraint = new Image([
'maxRatio' => '1abc',
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IpTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IpTest.php
index f9313f9985..459bad5b87 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IpTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IpTest.php
@@ -30,14 +30,14 @@ class IpTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new Ip(['normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new Ip(['normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
index 29ae46dacc..1597637611 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
@@ -38,13 +38,13 @@ class IpValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Ip());
}
public function testInvalidValidatorVersion()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Ip([
'version' => 666,
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
index 57d087937d..e1a3b1d3c6 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
@@ -138,7 +138,7 @@ class IsbnValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$constraint = new Isbn(true);
$this->validator->validate(new \stdClass(), $constraint);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
index 83b112dfcc..7ba0593f43 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
@@ -108,7 +108,7 @@ class IssnValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$constraint = new Issn();
$this->validator->validate(new \stdClass(), $constraint);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
index d17d597e72..ae3afaa56c 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
@@ -55,7 +55,7 @@ class LanguageValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Language());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php
index 7748b3063f..34a97b81d7 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php
@@ -33,14 +33,14 @@ class LengthTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new Length(['min' => 0, 'max' => 10, 'normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new Length(['min' => 0, 'max' => 10, 'normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php
index 66633d8db9..9e78bbb695 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php
@@ -53,7 +53,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
public function testThrowsConstraintExceptionIfPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\NegativeOrZero" constraint cannot be set.');
return new NegativeOrZero(['propertyPath' => 'field']);
@@ -61,7 +61,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
public function testThrowsConstraintExceptionIfValue()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\NegativeOrZero" constraint cannot be set.');
return new NegativeOrZero(['value' => 0]);
@@ -72,14 +72,14 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
*/
public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires either the "value" or "propertyPath" option to be set.');
$this->markTestSkipped('Value option always set for NegativeOrZero constraint');
}
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "value" or "propertyPath" options to be set, not both.');
$this->markTestSkipped('Value option is set for NegativeOrZero constraint automatically');
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php
index 41ca8ded52..0b850b90ce 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php
@@ -53,7 +53,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
public function testThrowsConstraintExceptionIfPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\Negative" constraint cannot be set.');
return new Negative(['propertyPath' => 'field']);
@@ -61,7 +61,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
public function testThrowsConstraintExceptionIfValue()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\Negative" constraint cannot be set.');
return new Negative(['value' => 0]);
@@ -72,14 +72,14 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
*/
public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires either the "value" or "propertyPath" option to be set.');
$this->markTestSkipped('Value option always set for Negative constraint');
}
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "value" or "propertyPath" options to be set, not both.');
$this->markTestSkipped('Value option is set for Negative constraint automatically');
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
index 5fde299d70..11e144e607 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
@@ -103,7 +103,7 @@ class LuhnValidatorTest extends ConstraintValidatorTestCase
*/
public function testInvalidTypes($number)
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$constraint = new Luhn();
$this->validator->validate($number, $constraint);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php b/src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php
index 0a3ae6b346..a3be128146 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php
@@ -49,14 +49,14 @@ class NotBlankTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new NotBlank(['normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new NotBlank(['normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php
index 868040fafb..6c3438e16d 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php
@@ -165,19 +165,19 @@ class NotCompromisedPasswordValidatorTest extends ConstraintValidatorTestCase
public function testInvalidConstraint()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedTypeException::class);
$this->validator->validate(null, new Luhn());
}
public function testInvalidValue()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedTypeException::class);
$this->validator->validate([], new NotCompromisedPassword());
}
public function testApiError()
{
- $this->expectException('Symfony\Contracts\HttpClient\Exception\ExceptionInterface');
+ $this->expectException(\Symfony\Contracts\HttpClient\Exception\ExceptionInterface::class);
$this->expectExceptionMessage('Problem contacting the Have I been Pwned API.');
$this->validator->validate(self::PASSWORD_TRIGGERING_AN_ERROR, new NotCompromisedPassword());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php
index 909f3e1f2e..db7b406c58 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php
@@ -97,14 +97,14 @@ class RegexTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
index 384c0ec36c..d64b7e50be 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
@@ -38,7 +38,7 @@ class RegexValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Regex(['pattern' => '/^[0-9]+$/']));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
index bb447583fe..6d79135520 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
@@ -38,7 +38,7 @@ class TimeValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Time());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TimezoneTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TimezoneTest.php
index cc4666f170..85c93cbe13 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TimezoneTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TimezoneTest.php
@@ -36,7 +36,7 @@ class TimezoneTest extends TestCase
public function testExceptionForGroupedTimezonesByCountryWithWrongZone()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Timezone([
'zone' => \DateTimeZone::ALL,
'countryCode' => 'AR',
@@ -45,7 +45,7 @@ class TimezoneTest extends TestCase
public function testExceptionForGroupedTimezonesByCountryWithoutZone()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Timezone(['countryCode' => 'AR']);
}
@@ -54,7 +54,7 @@ class TimezoneTest extends TestCase
*/
public function testExceptionForInvalidGroupedTimezones(int $zone)
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
new Timezone(['zone' => $zone]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php
index 9e3e4e2f2f..17e088f174 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php
@@ -42,7 +42,7 @@ class TimezoneValidatorTest extends ConstraintValidatorTestCase
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Timezone());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php
index ee05aa0b88..19e8531772 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php
@@ -24,7 +24,7 @@ class UniqueValidatorTest extends ConstraintValidatorTestCase
public function testExpectsUniqueConstraintCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate('', new Unique());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php
index 6fad1a832f..ab6ffeeb69 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php
@@ -30,14 +30,14 @@ class UrlTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new Url(['normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new Url(['normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php
index d5843d569b..bfa4615bc7 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php
@@ -30,14 +30,14 @@ class UuidTest extends TestCase
public function testInvalidNormalizerThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("string" given).');
new Uuid(['normalizer' => 'Unknown Callable']);
}
public function testInvalidNormalizerObjectThrowsException()
{
- $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Validator\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The "normalizer" option must be a valid callable ("stdClass" given).');
new Uuid(['normalizer' => new \stdClass()]);
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
index 7bb500dcaa..0436ee15b7 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
@@ -41,15 +41,15 @@ class UuidValidatorTest extends ConstraintValidatorTestCase
public function testExpectsUuidConstraintCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
- $constraint = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\Constraint');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedTypeException::class);
+ $constraint = $this->getMockForAbstractClass(\Symfony\Component\Validator\Constraint::class);
$this->validator->validate('216fff40-98d9-11e3-a5e2-0800200c9a66', $constraint);
}
public function testExpectsStringCompatibleType()
{
- $this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
+ $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->validator->validate(new \stdClass(), new Uuid());
}
diff --git a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
index 12176c45a3..4555fcecbe 100644
--- a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
@@ -47,7 +47,7 @@ class ContainerConstraintValidatorFactoryTest extends TestCase
public function testGetInstanceInvalidValidatorClass()
{
- $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ValidatorException::class);
$constraint = $this->getMockBuilder(Constraint::class)->getMock();
$constraint
->expects($this->once())
diff --git a/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php b/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
index 45e73fc434..5e4a009036 100644
--- a/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
+++ b/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
@@ -47,7 +47,7 @@ class AddConstraintValidatorsPassTest extends TestCase
public function testAbstractConstraintValidator()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.');
$container = new ContainerBuilder();
$container->register('validator.validator_factory')
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
index 16cce5fbb1..d7114265fb 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
@@ -49,14 +49,14 @@ class ClassMetadataTest extends TestCase
public function testAddConstraintDoesNotAcceptValid()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$this->metadata->addConstraint(new Valid());
}
public function testAddConstraintRequiresClassConstraints()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$this->metadata->addConstraint(new PropertyConstraint());
}
@@ -270,24 +270,24 @@ class ClassMetadataTest extends TestCase
{
$this->metadata->setGroupSequence(['Foo', $this->metadata->getDefaultGroup()]);
- $this->assertInstanceOf('Symfony\Component\Validator\Constraints\GroupSequence', $this->metadata->getGroupSequence());
+ $this->assertInstanceOf(\Symfony\Component\Validator\Constraints\GroupSequence::class, $this->metadata->getGroupSequence());
}
public function testGroupSequencesFailIfNotContainingDefaultGroup()
{
- $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\GroupDefinitionException::class);
$this->metadata->setGroupSequence(['Foo', 'Bar']);
}
public function testGroupSequencesFailIfContainingDefault()
{
- $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\GroupDefinitionException::class);
$this->metadata->setGroupSequence(['Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP]);
}
public function testGroupSequenceFailsIfGroupSequenceProviderIsSet()
{
- $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\GroupDefinitionException::class);
$metadata = new ClassMetadata(self::PROVIDERCLASS);
$metadata->setGroupSequenceProvider(true);
$metadata->setGroupSequence(['GroupSequenceProviderEntity', 'Foo']);
@@ -295,7 +295,7 @@ class ClassMetadataTest extends TestCase
public function testGroupSequenceProviderFailsIfGroupSequenceIsSet()
{
- $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\GroupDefinitionException::class);
$metadata = new ClassMetadata(self::PROVIDERCLASS);
$metadata->setGroupSequence(['GroupSequenceProviderEntity', 'Foo']);
$metadata->setGroupSequenceProvider(true);
@@ -303,7 +303,7 @@ class ClassMetadataTest extends TestCase
public function testGroupSequenceProviderFailsIfDomainClassIsInvalid()
{
- $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\GroupDefinitionException::class);
$metadata = new ClassMetadata('stdClass');
$metadata->setGroupSequenceProvider(true);
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
index 6fe103bf39..6cbfadad5b 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
@@ -18,7 +18,7 @@ class BlackHoleMetadataFactoryTest extends TestCase
{
public function testGetMetadataForThrowsALogicException()
{
- $this->expectException('Symfony\Component\Validator\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Validator\Exception\LogicException::class);
$metadataFactory = new BlackHoleMetadataFactory();
$metadataFactory->getMetadataFor('foo');
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php
index 641aa977c1..c7e89d5a3b 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php
@@ -35,7 +35,7 @@ class FilesLoaderTest extends TestCase
public function getFilesLoader(LoaderInterface $loader)
{
- return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', [[
+ return $this->getMockForAbstractClass(\Symfony\Component\Validator\Tests\Fixtures\FilesLoader::class, [[
__DIR__.'/constraint-mapping.xml',
__DIR__.'/constraint-mapping.yaml',
__DIR__.'/constraint-mapping.test',
@@ -45,6 +45,6 @@ class FilesLoaderTest extends TestCase
public function getFileLoader()
{
- return $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ return $this->getMockBuilder(LoaderInterface::class)->getMock();
}
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php
index 45b8576f0e..c7ebaaa872 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php
@@ -21,12 +21,12 @@ class LoaderChainTest extends TestCase
{
$metadata = new ClassMetadata('\stdClass');
- $loader1 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ $loader1 = $this->getMockBuilder(\Symfony\Component\Validator\Mapping\Loader\LoaderInterface::class)->getMock();
$loader1->expects($this->once())
->method('loadClassMetadata')
->with($this->equalTo($metadata));
- $loader2 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ $loader2 = $this->getMockBuilder(\Symfony\Component\Validator\Mapping\Loader\LoaderInterface::class)->getMock();
$loader2->expects($this->once())
->method('loadClassMetadata')
->with($this->equalTo($metadata));
@@ -43,12 +43,12 @@ class LoaderChainTest extends TestCase
{
$metadata = new ClassMetadata('\stdClass');
- $loader1 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ $loader1 = $this->getMockBuilder(\Symfony\Component\Validator\Mapping\Loader\LoaderInterface::class)->getMock();
$loader1->expects($this->any())
->method('loadClassMetadata')
->willReturn(true);
- $loader2 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ $loader2 = $this->getMockBuilder(\Symfony\Component\Validator\Mapping\Loader\LoaderInterface::class)->getMock();
$loader2->expects($this->any())
->method('loadClassMetadata')
->willReturn(false);
@@ -65,12 +65,12 @@ class LoaderChainTest extends TestCase
{
$metadata = new ClassMetadata('\stdClass');
- $loader1 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ $loader1 = $this->getMockBuilder(\Symfony\Component\Validator\Mapping\Loader\LoaderInterface::class)->getMock();
$loader1->expects($this->any())
->method('loadClassMetadata')
->willReturn(false);
- $loader2 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
+ $loader2 = $this->getMockBuilder(\Symfony\Component\Validator\Mapping\Loader\LoaderInterface::class)->getMock();
$loader2->expects($this->any())
->method('loadClassMetadata')
->willReturn(false);
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
index 979b7cfa61..1813019b43 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -45,7 +45,7 @@ class YamlFileLoaderTest extends TestCase
*/
public function testInvalidYamlFiles($path)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$loader = new YamlFileLoader(__DIR__.'/'.$path);
$metadata = new ClassMetadata(Entity::class);
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
index a82ebae9e7..6793187363 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
@@ -44,7 +44,7 @@ class MemberMetadataTest extends TestCase
public function testAddConstraintRequiresClassConstraints()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(ConstraintDefinitionException::class);
$this->metadata->addConstraint(new ClassConstraint());
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
index abeb2c5bf1..5739da6ed5 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
@@ -27,7 +27,7 @@ class PropertyMetadataTest extends TestCase
public function testInvalidPropertyName()
{
- $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ValidatorException::class);
new PropertyMetadata(self::CLASSNAME, 'foobar');
}
@@ -55,7 +55,7 @@ class PropertyMetadataTest extends TestCase
$metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
$metadata->name = 'test';
- $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ValidatorException::class);
$metadata->getPropertyValue($entity);
}
diff --git a/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php
index 6866a88084..af61c68ac4 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php
@@ -544,7 +544,7 @@ class RecursiveValidatorTest extends TestCase
public function testFailOnScalarReferences()
{
- $this->expectException('Symfony\Component\Validator\Exception\NoSuchMetadataException');
+ $this->expectException(\Symfony\Component\Validator\Exception\NoSuchMetadataException::class);
$entity = new Entity();
$entity->reference = 'string';
@@ -799,7 +799,7 @@ class RecursiveValidatorTest extends TestCase
public function testMetadataMustExistIfTraversalIsDisabled()
{
- $this->expectException('Symfony\Component\Validator\Exception\NoSuchMetadataException');
+ $this->expectException(\Symfony\Component\Validator\Exception\NoSuchMetadataException::class);
$entity = new Entity();
$entity->reference = new \ArrayIterator();
@@ -1667,7 +1667,7 @@ class RecursiveValidatorTest extends TestCase
public function testExpectTraversableIfTraversalEnabledOnClass()
{
- $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$entity = new Entity();
$this->metadata->addConstraint(new Traverse(true));
@@ -1902,7 +1902,7 @@ class RecursiveValidatorTest extends TestCase
public function testValidateFailsIfNoConstraintsAndNoObjectOrArray()
{
- $this->expectException('Symfony\Component\Validator\Exception\RuntimeException');
+ $this->expectException(\Symfony\Component\Validator\Exception\RuntimeException::class);
$this->validate('Foobar');
}
@@ -1933,8 +1933,8 @@ class RecursiveValidatorTest extends TestCase
$entity->initialized = false;
// prepare initializers that set "initialized" to true
- $initializer1 = $this->getMockBuilder('Symfony\\Component\\Validator\\ObjectInitializerInterface')->getMock();
- $initializer2 = $this->getMockBuilder('Symfony\\Component\\Validator\\ObjectInitializerInterface')->getMock();
+ $initializer1 = $this->getMockBuilder(\Symfony\Component\Validator\ObjectInitializerInterface::class)->getMock();
+ $initializer2 = $this->getMockBuilder(\Symfony\Component\Validator\ObjectInitializerInterface::class)->getMock();
$initializer1->expects($this->once())
->method('initialize')
@@ -2076,7 +2076,7 @@ class RecursiveValidatorTest extends TestCase
$childB->name = 'fake';
$entity->childA = [$childA];
$entity->childB = [$childB];
- $validatorContext = $this->getMockBuilder('Symfony\Component\Validator\Validator\ContextualValidatorInterface')->getMock();
+ $validatorContext = $this->getMockBuilder(\Symfony\Component\Validator\Validator\ContextualValidatorInterface::class)->getMock();
$validatorContext
->expects($this->once())
->method('validate')
@@ -2084,7 +2084,7 @@ class RecursiveValidatorTest extends TestCase
->willReturnSelf();
$validator = $this
- ->getMockBuilder('Symfony\Component\Validator\Validator\RecursiveValidator')
+ ->getMockBuilder(RecursiveValidator::class)
->disableOriginalConstructor()
->setMethods(['startContext'])
->getMock();
@@ -2110,7 +2110,7 @@ class RecursiveValidatorTest extends TestCase
$entity->childA = [$childA];
$entity->childB = [$childB];
- $validatorContext = $this->getMockBuilder('Symfony\Component\Validator\Validator\ContextualValidatorInterface')->getMock();
+ $validatorContext = $this->getMockBuilder(\Symfony\Component\Validator\Validator\ContextualValidatorInterface::class)->getMock();
$validatorContext
->expects($this->once())
->method('validate')
@@ -2118,7 +2118,7 @@ class RecursiveValidatorTest extends TestCase
->willReturnSelf();
$validator = $this
- ->getMockBuilder('Symfony\Component\Validator\Validator\RecursiveValidator')
+ ->getMockBuilder(RecursiveValidator::class)
->disableOriginalConstructor()
->setMethods(['startContext'])
->getMock();
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/MemcachedCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/MemcachedCasterTest.php
index df48390af9..b252675c7a 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/MemcachedCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/MemcachedCasterTest.php
@@ -23,7 +23,7 @@ class MemcachedCasterTest extends TestCase
public function testCastMemcachedWithDefaultOptions()
{
- if (!class_exists('Memcached')) {
+ if (!class_exists(\Memcached::class)) {
$this->markTestSkipped('Memcached not available');
}
@@ -53,7 +53,7 @@ EOTXT;
public function testCastMemcachedWithCustomOptions()
{
- if (!class_exists('Memcached')) {
+ if (!class_exists(\Memcached::class)) {
$this->markTestSkipped('Memcached not available');
}
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php
index fca242cfc6..21fecc9962 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php
@@ -34,10 +34,10 @@ class PdoCasterTest extends TestCase
$cast = PdoCaster::castPdo($pdo, [], new Stub(), false);
- $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]);
+ $this->assertInstanceOf(\Symfony\Component\VarDumper\Caster\EnumStub::class, $cast["\0~\0attributes"]);
$attr = $cast["\0~\0attributes"] = $cast["\0~\0attributes"]->value;
- $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\ConstStub', $attr['CASE']);
+ $this->assertInstanceOf(\Symfony\Component\VarDumper\Caster\ConstStub::class, $attr['CASE']);
$this->assertSame('NATURAL', $attr['CASE']->class);
$this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class);
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
index e5f2cb84ae..a5d059ce23 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
@@ -27,7 +27,7 @@ class ReflectionCasterTest extends TestCase
public function testReflectionCaster()
{
- $var = new \ReflectionClass('ReflectionClass');
+ $var = new \ReflectionClass(\ReflectionClass::class);
$this->assertDumpMatchesFormat(
<<<'EOTXT'
diff --git a/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php b/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php
index 1361fa4554..8fb269805b 100644
--- a/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php
+++ b/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php
@@ -2,7 +2,7 @@
namespace Symfony\Component\VarDumper\Tests\Fixture;
-if (!class_exists('Symfony\Component\VarDumper\Tests\Fixture\DumbFoo')) {
+if (!class_exists(\Symfony\Component\VarDumper\Tests\Fixture\DumbFoo::class)) {
class DumbFoo
{
public $foo = 'foo';
diff --git a/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php b/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php
index 6d0deb68dc..a5ce64a5b0 100644
--- a/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php
+++ b/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php
@@ -18,7 +18,7 @@ class InstantiatorTest extends TestCase
{
public function testNotFoundClass()
{
- $this->expectException('Symfony\Component\VarExporter\Exception\ClassNotFoundException');
+ $this->expectException(\Symfony\Component\VarExporter\Exception\ClassNotFoundException::class);
$this->expectExceptionMessage('Class "SomeNotExistingClass" not found.');
Instantiator::instantiate('SomeNotExistingClass');
}
@@ -28,7 +28,7 @@ class InstantiatorTest extends TestCase
*/
public function testFailingInstantiation(string $class)
{
- $this->expectException('Symfony\Component\VarExporter\Exception\NotInstantiableTypeException');
+ $this->expectException(\Symfony\Component\VarExporter\Exception\NotInstantiableTypeException::class);
$this->expectExceptionMessageMatches('/Type ".*" is not instantiable\./');
Instantiator::instantiate($class);
}
diff --git a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php
index 7eb60be917..228378441f 100644
--- a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php
+++ b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php
@@ -22,7 +22,7 @@ class VarExporterTest extends TestCase
public function testPhpIncompleteClassesAreForbidden()
{
- $this->expectException('Symfony\Component\VarExporter\Exception\ClassNotFoundException');
+ $this->expectException(\Symfony\Component\VarExporter\Exception\ClassNotFoundException::class);
$this->expectExceptionMessage('Class "SomeNotExistingClass" not found.');
$unserializeCallback = ini_set('unserialize_callback_func', 'var_dump');
try {
@@ -37,7 +37,7 @@ class VarExporterTest extends TestCase
*/
public function testFailingSerialization($value)
{
- $this->expectException('Symfony\Component\VarExporter\Exception\NotInstantiableTypeException');
+ $this->expectException(\Symfony\Component\VarExporter\Exception\NotInstantiableTypeException::class);
$this->expectExceptionMessageMatches('/Type ".*" is not instantiable\./');
$expectedDump = $this->getDump($value);
try {
@@ -50,7 +50,7 @@ class VarExporterTest extends TestCase
public function provideFailingSerialization()
{
yield [hash_init('md5')];
- yield [new \ReflectionClass('stdClass')];
+ yield [new \ReflectionClass(\stdClass::class)];
yield [(new \ReflectionFunction(function (): int {}))->getReturnType()];
yield [new \ReflectionGenerator((function () { yield 123; })())];
yield [function () {}];
@@ -173,11 +173,11 @@ class VarExporterTest extends TestCase
$value = new \Error();
- $rt = new \ReflectionProperty('Error', 'trace');
+ $rt = new \ReflectionProperty(\Error::class, 'trace');
$rt->setAccessible(true);
$rt->setValue($value, ['file' => __FILE__, 'line' => 123]);
- $rl = new \ReflectionProperty('Error', 'line');
+ $rl = new \ReflectionProperty(\Error::class, 'line');
$rl->setAccessible(true);
$rl->setValue($value, 234);
diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
index 6ba3c1ef47..da20a2b3ac 100644
--- a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
@@ -36,7 +36,7 @@ class DefinitionTest extends TestCase
public function testSetInitialPlaceAndPlaceIsNotDefined()
{
- $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
$this->expectExceptionMessage('Place "d" cannot be the initial place as it does not exist.');
new Definition([], [], 'd');
}
@@ -54,7 +54,7 @@ class DefinitionTest extends TestCase
public function testAddTransitionAndFromPlaceIsNotDefined()
{
- $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
$this->expectExceptionMessage('Place "c" referenced in transition "name" does not exist.');
$places = range('a', 'b');
@@ -63,7 +63,7 @@ class DefinitionTest extends TestCase
public function testAddTransitionAndToPlaceIsNotDefined()
{
- $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
$this->expectExceptionMessage('Place "c" referenced in transition "name" does not exist.');
$places = range('a', 'b');
diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
index 701b7456d0..45f0483fc7 100644
--- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php
+++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
@@ -55,7 +55,7 @@ class RegistryTest extends TestCase
public function testGetWithMultipleMatch()
{
- $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Too many workflows (workflow2, workflow3) match this subject (Symfony\Component\Workflow\Tests\Subject2); set a different name on each and use the second (name) argument of this method.');
$w1 = $this->registry->get(new Subject2());
$this->assertInstanceOf(Workflow::class, $w1);
@@ -64,7 +64,7 @@ class RegistryTest extends TestCase
public function testGetWithNoMatch()
{
- $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Unable to find a workflow for class "stdClass".');
$w1 = $this->registry->get(new \stdClass());
$this->assertInstanceOf(Workflow::class, $w1);
diff --git a/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
index f3014e817d..b929a8ca42 100644
--- a/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
@@ -11,7 +11,7 @@ class StateMachineValidatorTest extends TestCase
{
public function testWithMultipleTransitionWithSameNameShareInput()
{
- $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.');
$places = ['a', 'b', 'c'];
$transitions[] = new Transition('t1', 'a', 'b');
@@ -35,7 +35,7 @@ class StateMachineValidatorTest extends TestCase
public function testWithMultipleTos()
{
- $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
$this->expectExceptionMessage('A transition in StateMachine can only have one output.');
$places = ['a', 'b', 'c'];
$transitions[] = new Transition('t1', 'a', ['b', 'c']);
@@ -58,7 +58,7 @@ class StateMachineValidatorTest extends TestCase
public function testWithMultipleFroms()
{
- $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
$this->expectExceptionMessage('A transition in StateMachine can only have one input.');
$places = ['a', 'b', 'c'];
$transitions[] = new Transition('t1', ['a', 'b'], 'c');
@@ -106,7 +106,7 @@ class StateMachineValidatorTest extends TestCase
public function testWithTooManyInitialPlaces()
{
- $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
$this->expectExceptionMessage('The state machine "foo" can not store many places. But the definition has 2 initial places. Only one is supported.');
$places = range('a', 'c');
$transitions = [];
diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
index 3750c61205..3eabbdc41e 100644
--- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
@@ -144,7 +144,7 @@ YAML;
public function testLintFileNotReadable()
{
- $this->expectException('RuntimeException');
+ $this->expectException(\RuntimeException::class);
$tester = $this->createCommandTester();
$filename = $this->createFile('');
unlink($filename);
diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php
index 41c8b02c7b..7f3e245f30 100644
--- a/src/Symfony/Component/Yaml/Tests/DumperTest.php
+++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php
@@ -194,7 +194,7 @@ EOF;
public function testObjectSupportDisabledWithExceptions()
{
- $this->expectException('Symfony\Component\Yaml\Exception\DumpException');
+ $this->expectException(\Symfony\Component\Yaml\Exception\DumpException::class);
$this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
}
@@ -619,14 +619,14 @@ YAML;
public function testZeroIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The indentation must be greater than zero');
new Dumper(0);
}
public function testNegativeIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The indentation must be greater than zero');
new Dumper(-4);
}
diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php
index 261e430449..acbde08ae1 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -69,14 +69,14 @@ class InlineTest extends TestCase
public function testParsePhpConstantThrowsExceptionWhenUndefined()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('The constant "WRONG_CONSTANT" is not defined');
Inline::parse('!php/const WRONG_CONSTANT', Yaml::PARSE_CONSTANT);
}
public function testParsePhpConstantThrowsExceptionOnInvalidType()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessageMatches('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#');
Inline::parse('!php/const PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}
@@ -120,60 +120,60 @@ class InlineTest extends TestCase
public function testParseScalarWithNonEscapedBlackslashShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Found unknown escape character "\V".');
Inline::parse('"Foo\Var"');
}
public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
Inline::parse('"Foo\\"');
}
public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$value = "'don't do somthin' like that'";
Inline::parse($value);
}
public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$value = '"don"t do somthin" like that"';
Inline::parse($value);
}
public function testParseInvalidMappingKeyShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$value = '{ "foo " bar": "bar" }';
Inline::parse($value);
}
public function testParseMappingKeyWithColonNotFollowedBySpace()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}")');
Inline::parse('{foo:""}');
}
public function testParseInvalidMappingShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
Inline::parse('[foo] bar');
}
public function testParseInvalidSequenceShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
Inline::parse('{ foo: bar } bar');
}
public function testParseInvalidTaggedSequenceShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
Inline::parse('!foo { bar: baz } qux', Yaml::PARSE_CUSTOM_TAGS);
}
@@ -219,14 +219,14 @@ class InlineTest extends TestCase
public function testParseUnquotedAsterisk()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('A reference must contain at least one character at line 1.');
Inline::parse('{ foo: * }');
}
public function testParseUnquotedAsteriskFollowedByAComment()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('A reference must contain at least one character at line 1.');
Inline::parse('{ foo: * #foo }');
}
@@ -613,7 +613,7 @@ class InlineTest extends TestCase
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessageMatches($expectedMessage);
Inline::parse($data);
@@ -631,7 +631,7 @@ class InlineTest extends TestCase
public function testNotSupportedMissingValue()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Malformed inline YAML string: "{this, is not, supported}" at line 1.');
Inline::parse('{this, is not, supported}');
}
@@ -648,7 +648,7 @@ class InlineTest extends TestCase
public function testMappingKeysCannotBeOmitted()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Missing mapping key');
Inline::parse('{: foo}');
}
@@ -679,7 +679,7 @@ class InlineTest extends TestCase
*/
public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead');
$this->assertSame($expected, Inline::parse($yaml));
}
@@ -732,7 +732,7 @@ class InlineTest extends TestCase
public function testUnfinishedInlineMap()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage("Unexpected end of line, expected one of \",}\n\" at line 1 (near \"{abc: 'def'\").");
Inline::parse("{abc: 'def'");
}
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index feec99984a..6bf904a067 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -514,7 +514,7 @@ YAML;
public function testObjectsSupportDisabledWithExceptions()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$yaml = <<<'EOF'
foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
bar: 1
@@ -564,14 +564,14 @@ EOF;
$this->fail('charsets other than UTF-8 are rejected.');
} catch (\Exception $e) {
- $this->assertInstanceOf('Symfony\Component\Yaml\Exception\ParseException', $e, 'charsets other than UTF-8 are rejected.');
+ $this->assertInstanceOf(ParseException::class, $e, 'charsets other than UTF-8 are rejected.');
}
}
}
public function testUnindentedCollectionException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$yaml = <<<'EOF'
collection:
@@ -586,7 +586,7 @@ EOF;
public function testShortcutKeyUnindentedCollectionException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$yaml = <<<'EOF'
collection:
@@ -600,7 +600,7 @@ EOF;
public function testMultipleDocumentsNotSupportedException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessageMatches('/^Multiple documents are not supported.+/');
Yaml::parse(<<<'EOL'
# Ranking of 1998 home runs
@@ -619,7 +619,7 @@ EOL
public function testSequenceInAMapping()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
Yaml::parse(<<<'EOF'
yaml:
hash: me
@@ -727,7 +727,7 @@ EOT;
*/
public function testParseExceptionNotAffectedByMultiLineStringLastResortParsing($yaml)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->parser->parse($yaml);
}
@@ -759,7 +759,7 @@ EOT;
public function testMappingInASequence()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
Yaml::parse(<<<'EOF'
yaml:
- array stuff
@@ -770,7 +770,7 @@ EOF
public function testScalarInSequence()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('missing colon');
Yaml::parse(<<<'EOF'
foo:
@@ -793,7 +793,7 @@ EOF
*/
public function testMappingDuplicateKeyBlock()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Duplicate key "child" detected');
$input = <<<'EOD'
parent:
@@ -813,7 +813,7 @@ EOD;
public function testMappingDuplicateKeyFlow()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Duplicate key "child" detected');
$input = <<<'EOD'
parent: { child: first, child: duplicate }
@@ -832,7 +832,7 @@ EOD;
*/
public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage(sprintf('Duplicate key "%s" detected at line %d', $duplicateKey, $lineNumber));
Yaml::parse($input);
@@ -1058,7 +1058,7 @@ EOF;
public function testFloatKeys()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Numeric keys are not supported. Quote your evaluable mapping keys instead');
$yaml = <<<'EOF'
foo:
@@ -1071,7 +1071,7 @@ EOF;
public function testBooleanKeys()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Non-string keys are not supported. Quote your evaluable mapping keys instead');
$yaml = <<<'EOF'
true: foo
@@ -1108,7 +1108,7 @@ EOF;
public function testColonInMappingValueException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('A colon cannot be used in an unquoted mapping value');
$yaml = <<<'EOF'
foo: bar: baz
@@ -1346,7 +1346,7 @@ EOT
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessageMatches($expectedMessage);
$this->parser->parse($data);
@@ -2168,35 +2168,35 @@ YAML
public function testCustomTagsDisabled()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!iterator" at line 1 (near "!iterator [foo]").');
$this->parser->parse('!iterator [foo]');
}
public function testUnsupportedTagWithScalar()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!iterator" at line 1 (near "!iterator foo").');
$this->parser->parse('!iterator foo');
}
public function testUnsupportedBuiltInTagWithScalar()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('The string "!!iterator foo" could not be parsed as it uses an unsupported built-in tag at line 1 (near "!!iterator foo").');
$this->parser->parse('!!iterator foo');
}
public function testExceptionWhenUsingUnsupportedBuiltInTags()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").');
$this->parser->parse('!!foo');
}
public function testComplexMappingThrowsParseException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Complex mappings are not supported at line 1 (near "? "1"").');
$yaml = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Complex mappings are not supported at line 2 (near "? "1"").');
$yaml = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Complex mappings are not supported at line 1 (near "- ? "1"").');
$yaml = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Unable to parse at line 2 (near " foo = bar").');
$ini = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Reference "foo" does not exist at line 2');
$yaml = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessageMatches('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
$this->parser->parseFile(__DIR__.'/Fixtures/nonexistent.yml');
}
public function testParsingNotReadableFilesThrowsException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessageMatches('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
@@ -2497,7 +2497,7 @@ YAML;
public function testEvalRefException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Reference "foo" does not exist');
$yaml = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectException(ParseException::class);
$this->expectExceptionMessage('Circular reference [foo, bar, foo] detected');
$this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS);
}
diff --git a/src/Symfony/Component/Yaml/Tests/YamlTest.php b/src/Symfony/Component/Yaml/Tests/YamlTest.php
index 7be1266497..151b5b9deb 100644
--- a/src/Symfony/Component/Yaml/Tests/YamlTest.php
+++ b/src/Symfony/Component/Yaml/Tests/YamlTest.php
@@ -26,14 +26,14 @@ class YamlTest extends TestCase
public function testZeroIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The indentation must be greater than zero');
Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0);
}
public function testNegativeIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The indentation must be greater than zero');
Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4);
}
diff --git a/src/Symfony/Contracts/Service/Test/ServiceLocatorTest.php b/src/Symfony/Contracts/Service/Test/ServiceLocatorTest.php
index 5ed9149529..d5b82674fa 100644
--- a/src/Symfony/Contracts/Service/Test/ServiceLocatorTest.php
+++ b/src/Symfony/Contracts/Service/Test/ServiceLocatorTest.php
@@ -67,7 +67,7 @@ abstract class ServiceLocatorTest extends TestCase
public function testThrowsOnUndefinedInternalService()
{
if (!$this->getExpectedException()) {
- $this->expectException('Psr\Container\NotFoundExceptionInterface');
+ $this->expectException(\Psr\Container\NotFoundExceptionInterface::class);
$this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
}
$locator = $this->getServiceLocator([
@@ -79,7 +79,7 @@ abstract class ServiceLocatorTest extends TestCase
public function testThrowsOnCircularReference()
{
- $this->expectException('Psr\Container\ContainerExceptionInterface');
+ $this->expectException(\Psr\Container\ContainerExceptionInterface::class);
$this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
$locator = $this->getServiceLocator([
'foo' => function () use (&$locator) { return $locator->get('bar'); },
diff --git a/src/Symfony/Contracts/Translation/Test/TranslatorTest.php b/src/Symfony/Contracts/Translation/Test/TranslatorTest.php
index 4d84f4729f..ffaf877f04 100644
--- a/src/Symfony/Contracts/Translation/Test/TranslatorTest.php
+++ b/src/Symfony/Contracts/Translation/Test/TranslatorTest.php
@@ -163,7 +163,7 @@ class TranslatorTest extends TestCase
*/
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
{
- $this->expectException('InvalidArgumentException');
+ $this->expectException(\InvalidArgumentException::class);
$translator = $this->getTranslator();
$translator->trans($id, ['%count%' => $number]);