An authentication exception occurred.
- خطایی هنگام تعیین اعتبار اتفاق افتاد.
+ خطایی هنگام احراز هویت رخ داده است.Authentication credentials could not be found.
- شرایط تعیین اعتبار پیدا نشد.
+ شرایط احراز هویت یافت نشد.Authentication request could not be processed due to a system problem.
- درخواست تعیین اعتبار به دلیل مشکل سیستم قابل بررسی نیست.
+ درخواست احراز هویت به دلیل وجود مشکل در سیستم قابل پردازش نمی باشد.Invalid credentials.
- شرایط نامعتبر.
+ احراز هویت نامعتبر می باشد.Cookie has already been used by someone else.
- کوکی قبلا برای شخص دیگری استفاده شده است.
+ Cookie قبلا توسط شخص دیگری استفاده گردیده است.Not privileged to request the resource.
- دسترسی لازم برای درخواست این منبع را ندارید.
+ دسترسی لازم برای درخواست از این منبع را دارا نمی باشید.Invalid CSRF token.
- توکن CSRF معتبر نیست.
+ توکن CSRF معتبر نمی باشد.Digest nonce has expired.
- Digest nonce منقضی شده است.
+ Digest nonce منقضی گردیده است.No authentication provider found to support the authentication token.
- هیچ ارایه کننده تعیین اعتباری برای ساپورت توکن تعیین اعتبار پیدا نشد.
+ هیچ ارایه دهنده احراز هویتی برای پشتیبانی از توکن احراز هویت پیدا نشد.No session available, it either timed out or cookies are not enabled.
- جلسهای در دسترس نیست. این میتواند یا به دلیل پایان یافتن زمان باشد یا اینکه کوکی ها فعال نیستند.
+ هیچ جلسهای در دسترس نمی باشد. این میتواند به دلیل پایان یافتن زمان و یا فعال نبودن کوکی ها باشد.No token could be found.
@@ -52,19 +52,19 @@
Account has expired.
- حساب کاربری منقضی شده است.
+ حساب کاربری منقضی گردیده است.Credentials have expired.
- پارامترهای تعیین اعتبار منقضی شدهاند.
+ مجوزهای احراز هویت منقضی گردیدهاند.Account is disabled.
- حساب کاربری غیرفعال است.
+ حساب کاربری غیرفعال می باشد.Account is locked.
- حساب کاربری قفل شده است.
+ حساب کاربری قفل گردیده است.
From 7568d3452d80f68a834580dd99b7b153a357858c Mon Sep 17 00:00:00 2001
From: Gocha Ossinkine
Date: Tue, 23 Jul 2019 19:02:38 +0500
Subject: [PATCH 002/147] [HttpFoundation] Revert getClientIp @return docblock
---
src/Symfony/Component/HttpFoundation/Request.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 7185d75e92209..0f7f46fff0eab 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -912,7 +912,7 @@ public function getClientIps()
* ("Client-Ip" for instance), configure it via the $trustedHeaderSet
* argument of the Request::setTrustedProxies() method instead.
*
- * @return string|null The client IP address
+ * @return string The client IP address
*
* @see getClientIps()
* @see http://en.wikipedia.org/wiki/X-Forwarded-For
From 43e5e97989fb0b3993723a8ee3f2faa1a9436156 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Sat, 27 Jul 2019 20:27:05 +0200
Subject: [PATCH 003/147] bumped Symfony version to 3.4.31
---
src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 90ef0c537b5a6..9e283b47717f9 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
private $requestStackSize = 0;
private $resetServices = false;
- const VERSION = '3.4.30';
- const VERSION_ID = 30430;
+ const VERSION = '3.4.31-DEV';
+ const VERSION_ID = 30431;
const MAJOR_VERSION = 3;
const MINOR_VERSION = 4;
- const RELEASE_VERSION = 30;
- const EXTRA_VERSION = '';
+ const RELEASE_VERSION = 31;
+ const EXTRA_VERSION = 'DEV';
const END_OF_MAINTENANCE = '11/2020';
const END_OF_LIFE = '11/2021';
From 48e7b146119735d1e237b2fbbec6c44cf798a979 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Sun, 28 Jul 2019 09:20:12 +0200
Subject: [PATCH 004/147] drop 4.2 branch from pull request template
---
.github/PULL_REQUEST_TEMPLATE.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 3d686194101c0..52ffbb2a4d1ae 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,6 +1,6 @@
| Q | A
| ------------- | ---
-| Branch? | 4.4 for features / 3.4, 4.2 or 4.3 for bug fixes
+| Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes
| Bug fix? | yes/no
| New feature? | yes/no
| BC breaks? | no
From ee491444f4ed8ead53487cfdaf8377262e4cb4a4 Mon Sep 17 00:00:00 2001
From: Ryan Weaver
Date: Mon, 24 Jun 2019 12:50:01 -0400
Subject: [PATCH 005/147] Failing test case for complex near-circular situation
+ lazy
---
.../Tests/ContainerBuilderTest.php | 7 ++
.../Tests/Dumper/PhpDumperTest.php | 7 ++
.../containers/container_almost_circular.php | 30 ++++++-
.../php/services_almost_circular_private.php | 64 ++++++++++++++
.../php/services_almost_circular_public.php | 86 +++++++++++++++++++
5 files changed, 193 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index 46074a67a5937..ec163609180e1 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -1423,6 +1423,13 @@ public function testAlmostCircular($visibility)
$this->assertEquals((object) ['bar6' => (object) []], $foo6);
$this->assertInstanceOf(\stdClass::class, $container->get('root'));
+
+ $manager3 = $container->get('manager3');
+ $listener3 = $container->get('listener3');
+ $this->assertSame($manager3, $listener3->manager, 'Both should identically be the manager3 service');
+
+ $listener4 = $container->get('listener4');
+ $this->assertInstanceOf('stdClass', $listener4);
}
public function provideAlmostCircular()
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index 926933bb0e410..0fca22cb694c7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -842,6 +842,13 @@ public function testAlmostCircular($visibility)
$this->assertEquals((object) ['bar6' => (object) []], $foo6);
$this->assertInstanceOf(\stdClass::class, $container->get('root'));
+
+ $manager3 = $container->get('manager3');
+ $listener3 = $container->get('listener3');
+ $this->assertSame($manager3, $listener3->manager);
+
+ $listener4 = $container->get('listener4');
+ $this->assertInstanceOf('stdClass', $listener4);
}
public function provideAlmostCircular()
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php
index df136cfa5ddba..a1f885399bd58 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
-use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls;
@@ -102,6 +101,35 @@
$container->register('subscriber2', 'stdClass')->setPublic(false)
->addArgument(new Reference('manager2'));
+// doctrine-like event system with listener
+
+$container->register('manager3', 'stdClass')
+ ->setLazy(true)
+ ->setPublic(true)
+ ->addArgument(new Reference('connection3'));
+
+$container->register('connection3', 'stdClass')
+ ->setPublic($public)
+ ->setProperty('listener', [new Reference('listener3')]);
+
+$container->register('listener3', 'stdClass')
+ ->setPublic(true)
+ ->setProperty('manager', new Reference('manager3'));
+
+// doctrine-like event system with small differences
+
+$container->register('manager4', 'stdClass')
+ ->setLazy(true)
+ ->addArgument(new Reference('connection4'));
+
+$container->register('connection4', 'stdClass')
+ ->setPublic($public)
+ ->setProperty('listener', [new Reference('listener4')]);
+
+$container->register('listener4', 'stdClass')
+ ->setPublic(true)
+ ->addArgument(new Reference('manager4'));
+
// private service involved in a loop
$container->register('foo6', 'stdClass')
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
index 5345aa3b308a8..55ddf616c1d9d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
@@ -39,9 +39,13 @@ public function __construct()
'level4' => 'getLevel4Service',
'level5' => 'getLevel5Service',
'level6' => 'getLevel6Service',
+ 'listener3' => 'getListener3Service',
+ 'listener4' => 'getListener4Service',
'logger' => 'getLoggerService',
'manager' => 'getManagerService',
'manager2' => 'getManager2Service',
+ 'manager3' => 'getManager3Service',
+ 'manager4' => 'getManager4Service',
'multiuse1' => 'getMultiuse1Service',
'root' => 'getRootService',
'subscriber' => 'getSubscriberService',
@@ -53,6 +57,7 @@ public function __construct()
'level4' => true,
'level5' => true,
'level6' => true,
+ 'manager4' => true,
'multiuse1' => true,
];
@@ -69,6 +74,8 @@ public function getRemovedIds()
'bar6' => true,
'config' => true,
'config2' => true,
+ 'connection3' => true,
+ 'connection4' => true,
'dispatcher' => true,
'dispatcher2' => true,
'foo4' => true,
@@ -81,6 +88,7 @@ public function getRemovedIds()
'level5' => true,
'level6' => true,
'logger2' => true,
+ 'manager4' => true,
'multiuse1' => true,
'subscriber2' => true,
];
@@ -272,6 +280,36 @@ protected function getFoobar4Service()
return $instance;
}
+ /**
+ * Gets the public 'listener3' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getListener3Service()
+ {
+ $this->services['listener3'] = $instance = new \stdClass();
+
+ $instance->manager = ${($_ = isset($this->services['manager3']) ? $this->services['manager3'] : $this->getManager3Service()) && false ?: '_'};
+
+ return $instance;
+ }
+
+ /**
+ * Gets the public 'listener4' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getListener4Service()
+ {
+ $a = ${($_ = isset($this->services['manager4']) ? $this->services['manager4'] : $this->getManager4Service()) && false ?: '_'};
+
+ if (isset($this->services['listener4'])) {
+ return $this->services['listener4'];
+ }
+
+ return $this->services['listener4'] = new \stdClass($a);
+ }
+
/**
* Gets the public 'logger' shared service.
*
@@ -324,6 +362,19 @@ protected function getManager2Service()
return $this->services['manager2'] = new \stdClass($a);
}
+ /**
+ * Gets the public 'manager3' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getManager3Service($lazyLoad = true)
+ {
+ $a = new \stdClass();
+ $a->listener = [0 => ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && false ?: '_'}];
+
+ return $this->services['manager3'] = new \stdClass($a);
+ }
+
/**
* Gets the public 'root' shared service.
*
@@ -430,6 +481,19 @@ protected function getLevel6Service()
return $instance;
}
+ /**
+ * Gets the private 'manager4' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getManager4Service($lazyLoad = true)
+ {
+ $a = new \stdClass();
+ $a->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && false ?: '_'}];
+
+ return $this->services['manager4'] = new \stdClass($a);
+ }
+
/**
* Gets the private 'multiuse1' shared service.
*
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
index b569b335fc857..09ca4591bf80c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
@@ -30,6 +30,8 @@ public function __construct()
'baz6' => 'getBaz6Service',
'connection' => 'getConnectionService',
'connection2' => 'getConnection2Service',
+ 'connection3' => 'getConnection3Service',
+ 'connection4' => 'getConnection4Service',
'dispatcher' => 'getDispatcherService',
'dispatcher2' => 'getDispatcher2Service',
'foo' => 'getFooService',
@@ -46,9 +48,13 @@ public function __construct()
'level4' => 'getLevel4Service',
'level5' => 'getLevel5Service',
'level6' => 'getLevel6Service',
+ 'listener3' => 'getListener3Service',
+ 'listener4' => 'getListener4Service',
'logger' => 'getLoggerService',
'manager' => 'getManagerService',
'manager2' => 'getManager2Service',
+ 'manager3' => 'getManager3Service',
+ 'manager4' => 'getManager4Service',
'multiuse1' => 'getMultiuse1Service',
'root' => 'getRootService',
'subscriber' => 'getSubscriberService',
@@ -60,6 +66,7 @@ public function __construct()
'level4' => true,
'level5' => true,
'level6' => true,
+ 'manager4' => true,
'multiuse1' => true,
];
@@ -81,6 +88,7 @@ public function getRemovedIds()
'level5' => true,
'level6' => true,
'logger2' => true,
+ 'manager4' => true,
'multiuse1' => true,
'subscriber2' => true,
];
@@ -212,6 +220,34 @@ protected function getConnection2Service()
return $instance;
}
+ /**
+ * Gets the public 'connection3' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getConnection3Service()
+ {
+ $this->services['connection3'] = $instance = new \stdClass();
+
+ $instance->listener = [0 => ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && false ?: '_'}];
+
+ return $instance;
+ }
+
+ /**
+ * Gets the public 'connection4' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getConnection4Service()
+ {
+ $this->services['connection4'] = $instance = new \stdClass();
+
+ $instance->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && false ?: '_'}];
+
+ return $instance;
+ }
+
/**
* Gets the public 'dispatcher' shared service.
*
@@ -372,6 +408,36 @@ protected function getFoobar4Service()
return $instance;
}
+ /**
+ * Gets the public 'listener3' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getListener3Service()
+ {
+ $this->services['listener3'] = $instance = new \stdClass();
+
+ $instance->manager = ${($_ = isset($this->services['manager3']) ? $this->services['manager3'] : $this->getManager3Service()) && false ?: '_'};
+
+ return $instance;
+ }
+
+ /**
+ * Gets the public 'listener4' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getListener4Service()
+ {
+ $a = ${($_ = isset($this->services['manager4']) ? $this->services['manager4'] : $this->getManager4Service()) && false ?: '_'};
+
+ if (isset($this->services['listener4'])) {
+ return $this->services['listener4'];
+ }
+
+ return $this->services['listener4'] = new \stdClass($a);
+ }
+
/**
* Gets the public 'logger' shared service.
*
@@ -424,6 +490,16 @@ protected function getManager2Service()
return $this->services['manager2'] = new \stdClass($a);
}
+ /**
+ * Gets the public 'manager3' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getManager3Service($lazyLoad = true)
+ {
+ return $this->services['manager3'] = new \stdClass(${($_ = isset($this->services['connection3']) ? $this->services['connection3'] : $this->getConnection3Service()) && false ?: '_'});
+ }
+
/**
* Gets the public 'root' shared service.
*
@@ -530,6 +606,16 @@ protected function getLevel6Service()
return $instance;
}
+ /**
+ * Gets the private 'manager4' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getManager4Service($lazyLoad = true)
+ {
+ return $this->services['manager4'] = new \stdClass(${($_ = isset($this->services['connection4']) ? $this->services['connection4'] : $this->getConnection4Service()) && false ?: '_'});
+ }
+
/**
* Gets the private 'multiuse1' shared service.
*
From 66dc9069aa72b6cfcfc07782202b04a3362f3e3f Mon Sep 17 00:00:00 2001
From: Tobias Schultze
Date: Sun, 28 Jul 2019 22:46:51 +0200
Subject: [PATCH 006/147] [Stopwatch] fix some phpdocs
---
.../HttpKernel/DataCollector/TimeDataCollector.php | 7 +++----
src/Symfony/Component/Stopwatch/Section.php | 6 ++++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
index 7ab14b7cb856a..d070e838685d4 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
@@ -15,10 +15,9 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Stopwatch\Stopwatch;
+use Symfony\Component\Stopwatch\StopwatchEvent;
/**
- * TimeDataCollector.
- *
* @author Fabien Potencier
*/
class TimeDataCollector extends DataCollector implements LateDataCollectorInterface
@@ -77,7 +76,7 @@ public function lateCollect()
/**
* Sets the request events.
*
- * @param array $events The request events
+ * @param StopwatchEvent[] $events The request events
*/
public function setEvents(array $events)
{
@@ -91,7 +90,7 @@ public function setEvents(array $events)
/**
* Gets the request events.
*
- * @return array The request events
+ * @return StopwatchEvent[] The request events
*/
public function getEvents()
{
diff --git a/src/Symfony/Component/Stopwatch/Section.php b/src/Symfony/Component/Stopwatch/Section.php
index 14fba8b582d33..f0c5e8b44e6d8 100644
--- a/src/Symfony/Component/Stopwatch/Section.php
+++ b/src/Symfony/Component/Stopwatch/Section.php
@@ -67,6 +67,8 @@ public function get($id)
return $child;
}
}
+
+ return null;
}
/**
@@ -110,8 +112,8 @@ public function setId($id)
/**
* Starts an event.
*
- * @param string $name The event name
- * @param string $category The event category
+ * @param string $name The event name
+ * @param string|null $category The event category
*
* @return StopwatchEvent The event
*/
From 8718cd1b1584c7e4b072af1a0951ff9ce5531c84 Mon Sep 17 00:00:00 2001
From: Tobias Schultze
Date: Mon, 29 Jul 2019 16:24:16 +0200
Subject: [PATCH 007/147] [HttpKernel] do not stopwatch sections when profiler
is disabled
the toolbar and profiler panel disable to profiler which then does not set the X-Debug-Token. so when the header does not exist, do not call the stopwatch methods with null which violates the contract and does not make sense
---
.../HttpKernel/Debug/TraceableEventDispatcher.php | 9 +++++++++
.../Tests/Debug/TraceableEventDispatcherTest.php | 4 +---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php b/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
index ddf4fa7cecf05..c265b6010dacf 100644
--- a/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
+++ b/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
@@ -42,6 +42,9 @@ protected function preDispatch($eventName, Event $event)
break;
case KernelEvents::TERMINATE:
$token = $event->getResponse()->headers->get('X-Debug-Token');
+ if (null === $token) {
+ break;
+ }
// There is a very special case when using built-in AppCache class as kernel wrapper, in the case
// of an ESI request leading to a `stale` response [B] inside a `fresh` cached response [A].
// In this case, `$token` contains the [B] debug token, but the open `stopwatch` section ID
@@ -66,12 +69,18 @@ protected function postDispatch($eventName, Event $event)
break;
case KernelEvents::RESPONSE:
$token = $event->getResponse()->headers->get('X-Debug-Token');
+ if (null === $token) {
+ break;
+ }
$this->stopwatch->stopSection($token);
break;
case KernelEvents::TERMINATE:
// In the special case described in the `preDispatch` method above, the `$token` section
// does not exist, then closing it throws an exception which must be caught.
$token = $event->getResponse()->headers->get('X-Debug-Token');
+ if (null === $token) {
+ break;
+ }
try {
$this->stopwatch->stopSection($token);
} catch (\LogicException $e) {
diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
index c66732a37ccd3..30c5ab5aaa50b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
@@ -61,15 +61,13 @@ public function testStopwatchCheckControllerOnRequestEvent()
public function testStopwatchStopControllerOnRequestEvent()
{
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')
- ->setMethods(['isStarted', 'stop', 'stopSection'])
+ ->setMethods(['isStarted', 'stop'])
->getMock();
$stopwatch->expects($this->once())
->method('isStarted')
->willReturn(true);
$stopwatch->expects($this->once())
->method('stop');
- $stopwatch->expects($this->once())
- ->method('stopSection');
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch);
From a37f3e08078d32da90ed5fece75c5e30cd5620bd Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 6 Feb 2019 19:04:48 +0100
Subject: [PATCH 008/147] [DI] Fix dumping Doctrine-like service graphs (bis)
---
.../Compiler/AnalyzeServiceReferencesPass.php | 2 +-
.../DependencyInjection/Dumper/PhpDumper.php | 112 +++++++++++-------
.../php/services_almost_circular_private.php | 16 ++-
.../php/services_almost_circular_public.php | 16 ++-
4 files changed, 98 insertions(+), 48 deletions(-)
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
index fc4047f902e13..8070920ff7ffe 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
@@ -122,7 +122,7 @@ protected function processValue($value, $isRoot = false)
$this->lazy = false;
$byConstructor = $this->byConstructor;
- $this->byConstructor = true;
+ $this->byConstructor = $isRoot || $byConstructor;
$this->processValue($value->getFactory());
$this->processValue($value->getArguments());
$this->byConstructor = $byConstructor;
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 73c868f1e54c9..a18d1665c5391 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -302,10 +302,10 @@ private function getProxyDumper()
return $this->proxyDumper;
}
- private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = [])
+ private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = [], $byConstructor = true)
{
$checkedNodes[$sourceId] = true;
- $currentPath[$sourceId] = $sourceId;
+ $currentPath[$sourceId] = $byConstructor;
foreach ($edges as $edge) {
$node = $edge->getDestNode();
@@ -314,44 +314,52 @@ private function analyzeCircularReferences($sourceId, array $edges, &$checkedNod
if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) {
// no-op
} elseif (isset($currentPath[$id])) {
- $currentId = $id;
- foreach (array_reverse($currentPath) as $parentId) {
- $this->circularReferences[$parentId][$currentId] = $currentId;
- if ($parentId === $id) {
- break;
- }
- $currentId = $parentId;
- }
+ $this->addCircularReferences($id, $currentPath, $edge->isReferencedByConstructor());
} elseif (!isset($checkedNodes[$id])) {
- $this->analyzeCircularReferences($id, $node->getOutEdges(), $checkedNodes, $currentPath);
+ $this->analyzeCircularReferences($id, $node->getOutEdges(), $checkedNodes, $currentPath, $edge->isReferencedByConstructor());
} elseif (isset($this->circularReferences[$id])) {
- $this->connectCircularReferences($id, $currentPath);
+ $this->connectCircularReferences($id, $currentPath, $edge->isReferencedByConstructor());
}
}
unset($currentPath[$sourceId]);
}
- private function connectCircularReferences($sourceId, &$currentPath, &$subPath = [])
+ private function connectCircularReferences($sourceId, &$currentPath, $byConstructor, &$subPath = [])
{
- $subPath[$sourceId] = $sourceId;
- $currentPath[$sourceId] = $sourceId;
+ $currentPath[$sourceId] = $subPath[$sourceId] = $byConstructor;
- foreach ($this->circularReferences[$sourceId] as $id) {
+ foreach ($this->circularReferences[$sourceId] as $id => $byConstructor) {
if (isset($currentPath[$id])) {
- $currentId = $id;
- foreach (array_reverse($currentPath) as $parentId) {
- $this->circularReferences[$parentId][$currentId] = $currentId;
- if ($parentId === $id) {
- break;
- }
- $currentId = $parentId;
- }
+ $this->addCircularReferences($id, $currentPath, $byConstructor);
} elseif (!isset($subPath[$id]) && isset($this->circularReferences[$id])) {
- $this->connectCircularReferences($id, $currentPath, $subPath);
+ $this->connectCircularReferences($id, $currentPath, $byConstructor, $subPath);
}
}
- unset($currentPath[$sourceId]);
- unset($subPath[$sourceId]);
+ unset($currentPath[$sourceId], $subPath[$sourceId]);
+ }
+
+ private function addCircularReferences($id, $currentPath, $byConstructor)
+ {
+ $currentPath[$id] = $byConstructor;
+ $circularRefs = [];
+
+ foreach (array_reverse($currentPath) as $parentId => $v) {
+ $byConstructor = $byConstructor && $v;
+ $circularRefs[] = $parentId;
+
+ if ($parentId === $id) {
+ break;
+ }
+ }
+
+ $currentId = $id;
+ foreach ($circularRefs as $parentId) {
+ if (empty($this->circularReferences[$parentId][$currentId])) {
+ $this->circularReferences[$parentId][$currentId] = $byConstructor;
+ }
+
+ $currentId = $parentId;
+ }
}
private function collectLineage($class, array &$lineage)
@@ -661,7 +669,6 @@ private function addService($id, Definition $definition, &$file = null)
$autowired = $definition->isAutowired() ? ' autowired' : '';
if ($definition->isLazy()) {
- unset($this->circularReferences[$id]);
$lazyInitialization = '$lazyLoad = true';
} else {
$lazyInitialization = '';
@@ -736,12 +743,12 @@ private function addInlineVariables($id, Definition $definition, array $argument
private function addInlineReference($id, Definition $definition, $targetId, $forConstructor)
{
- list($callCount, $behavior) = $this->serviceCalls[$targetId];
-
while ($this->container->hasAlias($targetId)) {
$targetId = (string) $this->container->getAlias($targetId);
}
+ list($callCount, $behavior) = $this->serviceCalls[$targetId];
+
if ($id === $targetId) {
return $this->addInlineService($id, $definition, $definition);
}
@@ -750,9 +757,13 @@ private function addInlineReference($id, Definition $definition, $targetId, $for
return '';
}
- $hasSelfRef = isset($this->circularReferences[$id][$targetId]);
- $forConstructor = $forConstructor && !isset($this->definitionVariables[$definition]);
- $code = $hasSelfRef && !$forConstructor ? $this->addInlineService($id, $definition, $definition) : '';
+ $hasSelfRef = isset($this->circularReferences[$id][$targetId]) && !isset($this->definitionVariables[$definition]);
+
+ if ($hasSelfRef && !$forConstructor && !$forConstructor = !$this->circularReferences[$id][$targetId]) {
+ $code = $this->addInlineService($id, $definition, $definition);
+ } else {
+ $code = '';
+ }
if (isset($this->referenceVariables[$targetId]) || (2 > $callCount && (!$hasSelfRef || !$forConstructor))) {
return $code;
@@ -785,15 +796,23 @@ private function addInlineReference($id, Definition $definition, $targetId, $for
private function addInlineService($id, Definition $definition, Definition $inlineDef = null, $forConstructor = true)
{
- $isSimpleInstance = $isRootInstance = null === $inlineDef;
+ $code = '';
+
+ if ($isSimpleInstance = $isRootInstance = null === $inlineDef) {
+ foreach ($this->serviceCalls as $targetId => list($callCount, $behavior, $byConstructor)) {
+ if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && !$this->circularReferences[$id][$targetId]) {
+ $code .= $this->addInlineReference($id, $definition, $targetId, $forConstructor);
+ }
+ }
+ }
if (isset($this->definitionVariables[$inlineDef = $inlineDef ?: $definition])) {
- return '';
+ return $code;
}
$arguments = [$inlineDef->getArguments(), $inlineDef->getFactory()];
- $code = $this->addInlineVariables($id, $definition, $arguments, $forConstructor);
+ $code .= $this->addInlineVariables($id, $definition, $arguments, $forConstructor);
if ($arguments = array_filter([$inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()])) {
$isSimpleInstance = false;
@@ -1550,7 +1569,7 @@ private function getServiceConditionals($value)
return implode(' && ', $conditions);
}
- private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [])
+ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [], $byConstructor = null)
{
if (null === $definitions) {
$definitions = new \SplObjectStorage();
@@ -1558,12 +1577,16 @@ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage
foreach ($arguments as $argument) {
if (\is_array($argument)) {
- $this->getDefinitionsFromArguments($argument, $definitions, $calls);
+ $this->getDefinitionsFromArguments($argument, $definitions, $calls, $byConstructor);
} elseif ($argument instanceof Reference) {
$id = $this->container->normalizeId($argument);
+ while ($this->container->hasAlias($id)) {
+ $id = (string) $this->container->getAlias($id);
+ }
+
if (!isset($calls[$id])) {
- $calls[$id] = [0, $argument->getInvalidBehavior()];
+ $calls[$id] = [0, $argument->getInvalidBehavior(), $byConstructor];
} else {
$calls[$id][1] = min($calls[$id][1], $argument->getInvalidBehavior());
}
@@ -1575,8 +1598,10 @@ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage
$definitions[$argument] = 1 + $definitions[$argument];
} else {
$definitions[$argument] = 1;
- $arguments = [$argument->getArguments(), $argument->getFactory(), $argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator()];
- $this->getDefinitionsFromArguments($arguments, $definitions, $calls);
+ $arguments = [$argument->getArguments(), $argument->getFactory()];
+ $this->getDefinitionsFromArguments($arguments, $definitions, $calls, null === $byConstructor || $byConstructor);
+ $arguments = [$argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator()];
+ $this->getDefinitionsFromArguments($arguments, $definitions, $calls, null !== $byConstructor && $byConstructor);
}
}
@@ -1717,6 +1742,11 @@ private function dumpValue($value, $interpolate = true)
return '$'.$value;
} elseif ($value instanceof Reference) {
$id = $this->container->normalizeId($value);
+
+ while ($this->container->hasAlias($id)) {
+ $id = (string) $this->container->getAlias($id);
+ }
+
if (null !== $this->referenceVariables && isset($this->referenceVariables[$id])) {
return $this->dumpValue($this->referenceVariables[$id], $interpolate);
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
index 55ddf616c1d9d..5f9bf8cee630f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
@@ -369,10 +369,15 @@ protected function getManager2Service()
*/
protected function getManager3Service($lazyLoad = true)
{
- $a = new \stdClass();
- $a->listener = [0 => ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && false ?: '_'}];
+ $a = ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && false ?: '_'};
+
+ if (isset($this->services['manager3'])) {
+ return $this->services['manager3'];
+ }
+ $b = new \stdClass();
+ $b->listener = [0 => $a];
- return $this->services['manager3'] = new \stdClass($a);
+ return $this->services['manager3'] = new \stdClass($b);
}
/**
@@ -489,9 +494,12 @@ protected function getLevel6Service()
protected function getManager4Service($lazyLoad = true)
{
$a = new \stdClass();
+
+ $this->services['manager4'] = $instance = new \stdClass($a);
+
$a->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && false ?: '_'}];
- return $this->services['manager4'] = new \stdClass($a);
+ return $instance;
}
/**
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
index 09ca4591bf80c..f41f831b3c5d8 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
@@ -497,7 +497,13 @@ protected function getManager2Service()
*/
protected function getManager3Service($lazyLoad = true)
{
- return $this->services['manager3'] = new \stdClass(${($_ = isset($this->services['connection3']) ? $this->services['connection3'] : $this->getConnection3Service()) && false ?: '_'});
+ $a = ${($_ = isset($this->services['connection3']) ? $this->services['connection3'] : $this->getConnection3Service()) && false ?: '_'};
+
+ if (isset($this->services['manager3'])) {
+ return $this->services['manager3'];
+ }
+
+ return $this->services['manager3'] = new \stdClass($a);
}
/**
@@ -613,7 +619,13 @@ protected function getLevel6Service()
*/
protected function getManager4Service($lazyLoad = true)
{
- return $this->services['manager4'] = new \stdClass(${($_ = isset($this->services['connection4']) ? $this->services['connection4'] : $this->getConnection4Service()) && false ?: '_'});
+ $a = ${($_ = isset($this->services['connection4']) ? $this->services['connection4'] : $this->getConnection4Service()) && false ?: '_'};
+
+ if (isset($this->services['manager4'])) {
+ return $this->services['manager4'];
+ }
+
+ return $this->services['manager4'] = new \stdClass($a);
}
/**
From dd945e375c5c1e95e1dcbc8d423568ca595e019b Mon Sep 17 00:00:00 2001
From: Soufian EZ ZANTAR
Date: Sat, 27 Jul 2019 00:20:27 +0200
Subject: [PATCH 009/147] fix(yml): fix comment in milti line value
---
src/Symfony/Component/Yaml/Parser.php | 3 +++
src/Symfony/Component/Yaml/Tests/ParserTest.php | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index cc094085c62b9..4f5c30e16836d 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -436,6 +436,9 @@ private function doParse($value, $flags)
$value = '';
foreach ($this->lines as $line) {
+ if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
+ continue;
+ }
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index 0f25732ab4420..4b5073fb4edea 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -2292,6 +2292,18 @@ public function indentedMappingData()
return $tests;
}
+
+ public function testMultiLineComment()
+ {
+ $yaml = <<assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
+ }
}
class B
From a80e56c460aa70706ed8773c0422497c4f80edf7 Mon Sep 17 00:00:00 2001
From: Arjen van der Meijden
Date: Tue, 30 Jul 2019 11:09:02 +0200
Subject: [PATCH 010/147] Don't add value of (default/static) objects to the
signature
---
.../Config/Resource/ReflectionClassResource.php | 2 +-
.../Tests/Resource/ReflectionClassResourceTest.php | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php
index f05042f8d32fa..d5e6b829cfeca 100644
--- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php
+++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php
@@ -140,7 +140,7 @@ private function generateSignature(\ReflectionClass $class)
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
yield $p->getDocComment().$p;
- yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true);
+ yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
}
}
diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
index 1f0bcb17b4f5e..76cad1433bb20 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
@@ -170,6 +170,15 @@ public function testServiceSubscriber()
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceSubscriber::class));
$this->assertTrue($res->isFresh(0));
}
+
+ public function testIgnoresObjectsInSignature()
+ {
+ $res = new ReflectionClassResource(new \ReflectionClass(TestServiceWithStaticProperty::class));
+ $this->assertTrue($res->isFresh(0));
+
+ TestServiceWithStaticProperty::$initializedObject = new TestServiceWithStaticProperty();
+ $this->assertTrue($res->isFresh(0));
+ }
}
interface DummyInterface
@@ -195,3 +204,8 @@ public static function getSubscribedServices()
return self::$subscribedServices;
}
}
+
+class TestServiceWithStaticProperty
+{
+ public static $initializedObject;
+}
From 5f451e6f7074976aae60a65ba144fff684b7b48c Mon Sep 17 00:00:00 2001
From: Babichev Maxim
Date: Tue, 30 Jul 2019 10:49:10 +0300
Subject: [PATCH 011/147] [Console] fix warning on PHP 7.4
---
src/Symfony/Component/Console/Input/ArrayInput.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php
index 44c2f0d5c66aa..9f8f93a65ef88 100644
--- a/src/Symfony/Component/Console/Input/ArrayInput.php
+++ b/src/Symfony/Component/Console/Input/ArrayInput.php
@@ -132,7 +132,7 @@ protected function parse()
}
if (0 === strpos($key, '--')) {
$this->addLongOption(substr($key, 2), $value);
- } elseif ('-' === $key[0]) {
+ } elseif (0 === strpos($key, '-')) {
$this->addShortOption(substr($key, 1), $value);
} else {
$this->addArgument($key, $value);
From 3324505b51ff85210a131fa7ec0d506e0489f6b9 Mon Sep 17 00:00:00 2001
From: Julien Pauli
Date: Mon, 29 Jul 2019 13:33:17 +0200
Subject: [PATCH 012/147] [Cache] fix warning on PHP 7.4
---
src/Symfony/Component/Cache/Adapter/AbstractAdapter.php | 4 ++--
src/Symfony/Component/Cache/Adapter/ArrayAdapter.php | 2 +-
src/Symfony/Component/Cache/Adapter/ChainAdapter.php | 2 +-
src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php | 2 +-
src/Symfony/Component/Cache/Adapter/ProxyAdapter.php | 2 +-
src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php | 8 ++++----
src/Symfony/Component/Cache/Simple/Psr6Cache.php | 2 +-
.../ExpressionLanguage/ParserCache/ParserCacheAdapter.php | 2 +-
src/Symfony/Component/Routing/Loader/PhpFileLoader.php | 2 +-
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
index 0868c16d47cf8..b543371159dfc 100644
--- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
@@ -49,7 +49,7 @@ protected function __construct($namespace = '', $defaultLifetime = 0)
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
}
$this->createCacheItem = \Closure::bind(
- function ($key, $value, $isHit) use ($defaultLifetime) {
+ static function ($key, $value, $isHit) use ($defaultLifetime) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
@@ -63,7 +63,7 @@ function ($key, $value, $isHit) use ($defaultLifetime) {
);
$getId = function ($key) { return $this->getId((string) $key); };
$this->mergeByLifetime = \Closure::bind(
- function ($deferred, $namespace, &$expiredIds) use ($getId) {
+ static function ($deferred, $namespace, &$expiredIds) use ($getId) {
$byLifetime = [];
$now = time();
$expiredIds = [];
diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
index 858a47e9ab1a6..4c6695e267def 100644
--- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
@@ -34,7 +34,7 @@ public function __construct($defaultLifetime = 0, $storeSerialized = true)
{
$this->storeSerialized = $storeSerialized;
$this->createCacheItem = \Closure::bind(
- function ($key, $value, $isHit) use ($defaultLifetime) {
+ static function ($key, $value, $isHit) use ($defaultLifetime) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
index 1f4d319e4f9a8..0080db711bce7 100644
--- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
@@ -56,7 +56,7 @@ public function __construct(array $adapters, $defaultLifetime = 0)
$this->adapterCount = \count($this->adapters);
$this->syncItem = \Closure::bind(
- function ($sourceItem, $item) use ($defaultLifetime) {
+ static function ($sourceItem, $item) use ($defaultLifetime) {
$item->value = $sourceItem->value;
$item->expiry = $sourceItem->expiry;
$item->isHit = $sourceItem->isHit;
diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
index 42a4142099385..59994ea4b6a2d 100644
--- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
@@ -42,7 +42,7 @@ public function __construct($file, AdapterInterface $fallbackPool)
$this->pool = $fallbackPool;
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN);
$this->createCacheItem = \Closure::bind(
- function ($key, $value, $isHit) {
+ static function ($key, $value, $isHit) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
index 0b7918287e90a..009e92fb88e02 100644
--- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
@@ -42,7 +42,7 @@ public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defa
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
$this->namespaceLen = \strlen($namespace);
$this->createCacheItem = \Closure::bind(
- function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
+ static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
$item = new CacheItem();
$item->key = $key;
$item->defaultLifetime = $defaultLifetime;
diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
index 362aceed0eb18..433d4eb132b1f 100644
--- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
@@ -42,7 +42,7 @@ public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsP
$this->tags = $tagsPool ?: $itemsPool;
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
$this->createCacheItem = \Closure::bind(
- function ($key, $value, CacheItem $protoItem) {
+ static function ($key, $value, CacheItem $protoItem) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
@@ -56,7 +56,7 @@ function ($key, $value, CacheItem $protoItem) {
CacheItem::class
);
$this->setCacheItemTags = \Closure::bind(
- function (CacheItem $item, $key, array &$itemTags) {
+ static function (CacheItem $item, $key, array &$itemTags) {
if (!$item->isHit) {
return $item;
}
@@ -76,7 +76,7 @@ function (CacheItem $item, $key, array &$itemTags) {
CacheItem::class
);
$this->getTagsByKey = \Closure::bind(
- function ($deferred) {
+ static function ($deferred) {
$tagsByKey = [];
foreach ($deferred as $key => $item) {
$tagsByKey[$key] = $item->tags;
@@ -88,7 +88,7 @@ function ($deferred) {
CacheItem::class
);
$this->invalidateTags = \Closure::bind(
- function (AdapterInterface $tagsAdapter, array $tags) {
+ static function (AdapterInterface $tagsAdapter, array $tags) {
foreach ($tags as $v) {
$v->defaultLifetime = 0;
$v->expiry = null;
diff --git a/src/Symfony/Component/Cache/Simple/Psr6Cache.php b/src/Symfony/Component/Cache/Simple/Psr6Cache.php
index 85d75becbe588..aab41f722db0c 100644
--- a/src/Symfony/Component/Cache/Simple/Psr6Cache.php
+++ b/src/Symfony/Component/Cache/Simple/Psr6Cache.php
@@ -41,7 +41,7 @@ public function __construct(CacheItemPoolInterface $pool)
}
$cacheItemPrototype = &$this->cacheItemPrototype;
$createCacheItem = \Closure::bind(
- function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
+ static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
$item = clone $cacheItemPrototype;
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
$item->value = $value;
diff --git a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php
index 30d9f8425b988..38ce6590b94b4 100644
--- a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php
+++ b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php
@@ -30,7 +30,7 @@ public function __construct(ParserCacheInterface $pool)
$this->pool = $pool;
$this->createCacheItem = \Closure::bind(
- function ($key, $value, $isHit) {
+ static function ($key, $value, $isHit) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
diff --git a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php
index d81e7e82e7dbc..d9ba59d51e03b 100644
--- a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php
@@ -40,7 +40,7 @@ public function load($file, $type = null)
// the closure forbids access to the private scope in the included file
$loader = $this;
- $load = \Closure::bind(function ($file) use ($loader) {
+ $load = \Closure::bind(static function ($file) use ($loader) {
return include $file;
}, null, ProtectedPhpFileLoader::class);
From 54107bac33afe156424c2280187fdd663a1b8b70 Mon Sep 17 00:00:00 2001
From: Benny Born
Date: Sun, 28 Jul 2019 12:33:26 +0200
Subject: [PATCH 013/147] [HttpFoundation] Fix `getMaxFilesize`
---
.../HttpFoundation/File/UploadedFile.php | 23 +++++++++++++++----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
index a44c664b4c6ef..093aaf8326031 100644
--- a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
+++ b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
@@ -214,13 +214,26 @@ public function move($directory, $name = null)
*/
public static function getMaxFilesize()
{
- $iniMax = strtolower(ini_get('upload_max_filesize'));
+ $sizePostMax = self::parseFilesize(ini_get('post_max_size'));
+ $sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
- if ('' === $iniMax) {
- return PHP_INT_MAX;
+ return min([$sizePostMax, $sizeUploadMax]);
+ }
+
+ /**
+ * Returns the given size from an ini value in bytes.
+ *
+ * @return int The given size in bytes
+ */
+ private static function parseFilesize($size)
+ {
+ if ('' === $size) {
+ return 0;
}
- $max = ltrim($iniMax, '+');
+ $size = strtolower($size);
+
+ $max = ltrim($size, '+');
if (0 === strpos($max, '0x')) {
$max = \intval($max, 16);
} elseif (0 === strpos($max, '0')) {
@@ -229,7 +242,7 @@ public static function getMaxFilesize()
$max = (int) $max;
}
- switch (substr($iniMax, -1)) {
+ switch (substr($size, -1)) {
case 't': $max *= 1024;
// no break
case 'g': $max *= 1024;
From 8b2d67bb3dd16586e8f75a3cba800f379cbe2e00 Mon Sep 17 00:00:00 2001
From: Tobias Weichart
Date: Wed, 31 Jul 2019 08:13:25 +0100
Subject: [PATCH 014/147] minor fix for wrong case
---
src/Symfony/Component/Debug/Exception/SilencedErrorContext.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Debug/Exception/SilencedErrorContext.php b/src/Symfony/Component/Debug/Exception/SilencedErrorContext.php
index f862b74f45d7f..2bacfd5c9b0df 100644
--- a/src/Symfony/Component/Debug/Exception/SilencedErrorContext.php
+++ b/src/Symfony/Component/Debug/Exception/SilencedErrorContext.php
@@ -54,7 +54,7 @@ public function getTrace()
return $this->trace;
}
- public function JsonSerialize()
+ public function jsonSerialize()
{
return [
'severity' => $this->severity,
From 6d4dcadd660f6318abed7389423bc2fdbde38a0d Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 31 Jul 2019 13:39:02 +0200
Subject: [PATCH 015/147] [Form] update type of form $name arguments
---
src/Symfony/Component/Form/ButtonBuilder.php | 5 ++---
src/Symfony/Component/Form/Form.php | 2 +-
src/Symfony/Component/Form/FormBuilder.php | 2 +-
.../Component/Form/FormBuilderInterface.php | 10 ++++------
src/Symfony/Component/Form/FormConfigBuilder.php | 10 ++++------
.../Component/Form/FormFactoryInterface.php | 14 ++++++--------
src/Symfony/Component/Form/FormInterface.php | 6 +++---
7 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php
index 598749eeac27d..9aa0935ed5ec9 100644
--- a/src/Symfony/Component/Form/ButtonBuilder.php
+++ b/src/Symfony/Component/Form/ButtonBuilder.php
@@ -71,9 +71,8 @@ public function __construct($name, array $options = [])
*
* This method should not be invoked.
*
- * @param string|int|FormBuilderInterface $child
- * @param string|FormTypeInterface $type
- * @param array $options
+ * @param string|FormBuilderInterface $child
+ * @param string|FormTypeInterface $type
*
* @throws BadMethodCallException
*/
diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php
index 63ef109e67624..dc82afb10309c 100644
--- a/src/Symfony/Component/Form/Form.php
+++ b/src/Symfony/Component/Form/Form.php
@@ -819,7 +819,7 @@ public function add($child, $type = null, array $options = [])
if (!$child instanceof FormInterface) {
if (!\is_string($child) && !\is_int($child)) {
- throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormInterface');
+ throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormInterface');
}
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php
index 13b1ea3b36420..f4388edd69ab5 100644
--- a/src/Symfony/Component/Form/FormBuilder.php
+++ b/src/Symfony/Component/Form/FormBuilder.php
@@ -70,7 +70,7 @@ public function add($child, $type = null, array $options = [])
}
if (!\is_string($child) && !\is_int($child)) {
- throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilderInterface');
+ throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormBuilderInterface');
}
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
diff --git a/src/Symfony/Component/Form/FormBuilderInterface.php b/src/Symfony/Component/Form/FormBuilderInterface.php
index 1ed695ed044d8..902fa0f9505e5 100644
--- a/src/Symfony/Component/Form/FormBuilderInterface.php
+++ b/src/Symfony/Component/Form/FormBuilderInterface.php
@@ -23,9 +23,8 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
* If you add a nested group, this group should also be represented in the
* object hierarchy.
*
- * @param string|int|FormBuilderInterface $child
- * @param string|null $type
- * @param array $options
+ * @param string|FormBuilderInterface $child
+ * @param string|null $type
*
* @return self
*/
@@ -34,9 +33,8 @@ public function add($child, $type = null, array $options = []);
/**
* Creates a form builder.
*
- * @param string $name The name of the form or the name of the property
- * @param string|null $type The type of the form or null if name is a property
- * @param array $options The options
+ * @param string $name The name of the form or the name of the property
+ * @param string|null $type The type of the form or null if name is a property
*
* @return self
*/
diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php
index fea1d70cd8ee4..eb5d2f65a245d 100644
--- a/src/Symfony/Component/Form/FormConfigBuilder.php
+++ b/src/Symfony/Component/Form/FormConfigBuilder.php
@@ -121,10 +121,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
/**
* Creates an empty form configuration.
*
- * @param string|int $name The form name
- * @param string|null $dataClass The class of the form's data
- * @param EventDispatcherInterface $dispatcher The event dispatcher
- * @param array $options The form options
+ * @param string $name The form name
+ * @param string|null $dataClass The class of the form's data
*
* @throws InvalidArgumentException if the data class is not a valid class or if
* the name contains invalid characters
@@ -787,7 +785,7 @@ public function getFormConfig()
/**
* Validates whether the given variable is a valid form name.
*
- * @param string|int|null $name The tested form name
+ * @param string|null $name The tested form name
*
* @throws UnexpectedTypeException if the name is not a string or an integer
* @throws InvalidArgumentException if the name contains invalid characters
@@ -795,7 +793,7 @@ public function getFormConfig()
public static function validateName($name)
{
if (null !== $name && !\is_string($name) && !\is_int($name)) {
- throw new UnexpectedTypeException($name, 'string, integer or null');
+ throw new UnexpectedTypeException($name, 'string or null');
}
if (!self::isValidName($name)) {
diff --git a/src/Symfony/Component/Form/FormFactoryInterface.php b/src/Symfony/Component/Form/FormFactoryInterface.php
index 597537ad88c1c..6214240c592c4 100644
--- a/src/Symfony/Component/Form/FormFactoryInterface.php
+++ b/src/Symfony/Component/Form/FormFactoryInterface.php
@@ -36,10 +36,9 @@ public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormT
*
* @see createNamedBuilder()
*
- * @param string|int $name The name of the form
- * @param string $type The type of the form
- * @param mixed $data The initial data
- * @param array $options The options
+ * @param string $name The name of the form
+ * @param string $type The type of the form
+ * @param mixed $data The initial data
*
* @return FormInterface The form
*
@@ -79,10 +78,9 @@ public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Typ
/**
* Returns a form builder.
*
- * @param string|int $name The name of the form
- * @param string $type The type of the form
- * @param mixed $data The initial data
- * @param array $options The options
+ * @param string $name The name of the form
+ * @param string $type The type of the form
+ * @param mixed $data The initial data
*
* @return FormBuilderInterface The form builder
*
diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php
index 5455e1afc44f2..25dff2aa9794f 100644
--- a/src/Symfony/Component/Form/FormInterface.php
+++ b/src/Symfony/Component/Form/FormInterface.php
@@ -43,9 +43,9 @@ public function getParent();
/**
* Adds or replaces a child to the form.
*
- * @param FormInterface|string|int $child The FormInterface instance or the name of the child
- * @param string|null $type The child's type, if a name was passed
- * @param array $options The child's options, if a name was passed
+ * @param FormInterface|string $child The FormInterface instance or the name of the child
+ * @param string|null $type The child's type, if a name was passed
+ * @param array $options The child's options, if a name was passed
*
* @return $this
*
From dfce45bf2e347bca3a8066fa034855314a81f31e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 31 Jul 2019 14:40:56 +0200
Subject: [PATCH 016/147] Fix travis script
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 12d031f64be20..26f2ef810d178 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -199,7 +199,7 @@ install:
export SYMFONY_DEPRECATIONS_HELPER=weak &&
cp composer.json composer.json.orig &&
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
- php .github/build-packages.php HEAD^ $COMPONENTS &&
+ php .github/build-packages.php HEAD^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n') &&
mv composer.json composer.json.phpunit &&
mv composer.json.orig composer.json
fi
From 1ca61d3aec22d9513b6c58282cf5bf3bafa909e4 Mon Sep 17 00:00:00 2001
From: Javier Spagnoletti
Date: Sat, 29 Jun 2019 20:18:26 -0300
Subject: [PATCH 017/147] Allow Travis CI to build on PHP 7.4
---
.travis.yml | 5 ++++-
phpunit | 8 ++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 26f2ef810d178..c1e2cfd8b566f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,9 @@ matrix:
env: deps=high
- php: 7.3
env: deps=low
+ - php: 7.4snapshot
+ allow_failures:
+ - php: 7.4snapshot
fast_finish: true
cache:
@@ -178,7 +181,7 @@ before_install:
[[ -e $ext_cache ]] || (tfold ext.symfony_debug "cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && mv modules/symfony_debug.so $ext_cache && phpize --clean")
echo extension = $ext_cache >> $INI
elif [[ $PHP = 7.* ]]; then
- tfold ext.apcu tpecl apcu-5.1.16 apcu.so $INI
+ tfold ext.apcu tpecl apcu-5.1.17 apcu.so $INI
tfold ext.mongodb tpecl mongodb-1.6.0alpha1 mongodb.so $INI
fi
done
diff --git a/phpunit b/phpunit
index 6d5bdc279bcd7..f2718fadcf68f 100755
--- a/phpunit
+++ b/phpunit
@@ -7,8 +7,12 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
exit(1);
}
-if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
- putenv('SYMFONY_PHPUNIT_VERSION=6.5');
+if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
+ if (\PHP_VERSION_ID >= 70400) {
+ putenv('SYMFONY_PHPUNIT_VERSION=8.2');
+ } elseif (\PHP_VERSION_ID >= 70000) {
+ putenv('SYMFONY_PHPUNIT_VERSION=6.5');
+ }
}
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
From 81af97f398e7f325ddc9409bd943211cbc33714f Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 31 Jul 2019 21:19:25 +0200
Subject: [PATCH 018/147] Make tests support phpunit 8
---
.../Tests/ContainerAwareEventManagerTest.php | 5 +-
.../DoctrineExtensionTest.php | 5 +-
.../ChoiceList/DoctrineChoiceLoaderTest.php | 5 +-
.../CollectionToArrayTransformerTest.php | 5 +-
.../MergeDoctrineCollectionListenerTest.php | 7 +-
.../Form/Type/EntityTypePerformanceTest.php | 5 +-
.../Tests/Form/Type/EntityTypeTest.php | 7 +-
.../Doctrine/Tests/ManagerRegistryTest.php | 5 +-
.../PropertyInfo/DoctrineExtractorTest.php | 5 +-
.../Constraints/UniqueEntityValidatorTest.php | 5 +-
.../Bridge/PhpUnit/ForwardCompatTestTrait.php | 28 +++++++
.../Legacy/ForwardCompatTestTraitForV5.php | 82 +++++++++++++++++++
.../Legacy/ForwardCompatTestTraitForV8.php | 58 +++++++++++++
.../Bridge/PhpUnit/Tests/ClockMockTest.php | 7 +-
.../Bridge/PhpUnit/Tests/DnsMockTest.php | 5 +-
.../Instantiator/RuntimeInstantiatorTest.php | 5 +-
.../LazyProxy/PhpDumper/ProxyDumperTest.php | 5 +-
.../Bridge/Twig/Tests/AppVariableTest.php | 5 +-
.../Twig/Tests/Command/LintCommandTest.php | 7 +-
...xtensionBootstrap3HorizontalLayoutTest.php | 5 +-
.../FormExtensionBootstrap3LayoutTest.php | 4 +-
...xtensionBootstrap4HorizontalLayoutTest.php | 4 +-
.../FormExtensionBootstrap4LayoutTest.php | 4 +-
.../Extension/FormExtensionDivLayoutTest.php | 4 +-
.../FormExtensionTableLayoutTest.php | 4 +-
.../Tests/Extension/WebLinkExtensionTest.php | 5 +-
.../Tests/Extension/WorkflowExtensionTest.php | 5 +-
...wnTrait.php => ForwardCompatTestTrait.php} | 45 ++++++++--
.../FrameworkBundle/Test/KernelTestCase.php | 7 +-
.../AnnotationsCacheWarmerTest.php | 7 +-
.../TemplatePathsCacheWarmerTest.php | 7 +-
.../CacheClearCommandTest.php | 7 +-
.../Command/TranslationDebugCommandTest.php | 7 +-
.../Command/TranslationUpdateCommandTest.php | 7 +-
.../Tests/Command/YamlLintCommandTest.php | 7 +-
.../Console/Descriptor/TextDescriptorTest.php | 7 +-
.../Controller/ControllerNameParserTest.php | 7 +-
.../Compiler/CachePoolPassTest.php | 5 +-
.../DataCollectorTranslatorPassTest.php | 5 +-
.../WorkflowGuardListenerPassTest.php | 5 +-
.../Tests/Functional/AbstractWebTestCase.php | 7 +-
.../Functional/CachePoolClearCommandTest.php | 5 +-
.../Functional/ConfigDebugCommandTest.php | 5 +-
.../ConfigDumpReferenceCommandTest.php | 5 +-
.../Tests/Templating/GlobalVariablesTest.php | 5 +-
.../Templating/Helper/AssetsHelperTest.php | 5 +-
.../Helper/FormHelperDivLayoutTest.php | 5 +-
.../Helper/FormHelperTableLayoutTest.php | 5 +-
.../Templating/Helper/RequestHelperTest.php | 5 +-
.../Templating/Helper/SessionHelperTest.php | 7 +-
.../Templating/TemplateFilenameParserTest.php | 7 +-
.../Templating/TemplateNameParserTest.php | 7 +-
.../Tests/Translation/TranslatorTest.php | 7 +-
.../Tests/Functional/AbstractWebTestCase.php | 7 +-
.../UserPasswordEncoderCommandTest.php | 7 +-
.../Compiler/TwigLoaderPassTest.php | 5 +-
.../Tests/Functional/CacheWarmingTest.php | 7 +-
.../Functional/NoTemplatingEntryTest.php | 7 +-
.../WebProfilerExtensionTest.php | 7 +-
.../Tests/Profiler/TemplateManagerTest.php | 5 +-
.../Adapter/AbstractRedisAdapterTest.php | 7 +-
.../Cache/Tests/Adapter/AdapterTestCase.php | 5 +-
.../Tests/Adapter/FilesystemAdapterTest.php | 5 +-
.../Tests/Adapter/MemcachedAdapterTest.php | 5 +-
.../Cache/Tests/Adapter/PdoAdapterTest.php | 6 +-
.../Tests/Adapter/PdoDbalAdapterTest.php | 6 +-
.../Tests/Adapter/PhpArrayAdapterTest.php | 7 +-
.../PhpArrayAdapterWithFallbackTest.php | 7 +-
.../Tests/Adapter/PhpFilesAdapterTest.php | 5 +-
.../Cache/Tests/Adapter/PredisAdapterTest.php | 5 +-
.../Adapter/PredisClusterAdapterTest.php | 8 +-
.../Adapter/PredisRedisClusterAdapterTest.php | 8 +-
.../Cache/Tests/Adapter/RedisAdapterTest.php | 5 +-
.../Tests/Adapter/RedisArrayAdapterTest.php | 6 +-
.../Tests/Adapter/RedisClusterAdapterTest.php | 6 +-
.../Tests/Adapter/TagAwareAdapterTest.php | 5 +-
.../Tests/Simple/AbstractRedisCacheTest.php | 7 +-
.../Cache/Tests/Simple/CacheTestCase.php | 5 +-
.../Cache/Tests/Simple/MemcachedCacheTest.php | 5 +-
.../Cache/Tests/Simple/PdoCacheTest.php | 6 +-
.../Cache/Tests/Simple/PdoDbalCacheTest.php | 6 +-
.../Cache/Tests/Simple/PhpArrayCacheTest.php | 7 +-
.../Simple/PhpArrayCacheWithFallbackTest.php | 7 +-
.../Tests/Simple/RedisArrayCacheTest.php | 6 +-
.../Cache/Tests/Simple/RedisCacheTest.php | 5 +-
.../Tests/Simple/RedisClusterCacheTest.php | 6 +-
.../ClassLoader/Tests/ApcClassLoaderTest.php | 7 +-
.../Config/Tests/ConfigCacheTest.php | 7 +-
.../Tests/Resource/DirectoryResourceTest.php | 7 +-
.../Resource/FileExistenceResourceTest.php | 7 +-
.../Tests/Resource/FileResourceTest.php | 7 +-
.../Tests/Resource/GlobResourceTest.php | 5 +-
.../Tests/ResourceCheckerConfigCacheTest.php | 7 +-
.../Console/Tests/ApplicationTest.php | 9 +-
.../Console/Tests/Command/CommandTest.php | 5 +-
.../Tests/Command/LockableTraitTest.php | 5 +-
.../Console/Tests/Helper/ProgressBarTest.php | 7 +-
.../Console/Tests/Helper/TableTest.php | 7 +-
.../Tests/Input/InputDefinitionTest.php | 5 +-
.../Console/Tests/Output/StreamOutputTest.php | 7 +-
.../Console/Tests/Style/SymfonyStyleTest.php | 7 +-
.../Component/Console/Tests/TerminalTest.php | 7 +-
.../Tests/Tester/ApplicationTesterTest.php | 7 +-
.../Tests/Tester/CommandTesterTest.php | 7 +-
.../Debug/Tests/DebugClassLoaderTest.php | 7 +-
.../Debug/Tests/ExceptionHandlerTest.php | 7 +-
.../ClassNotFoundFatalErrorHandlerTest.php | 5 +-
.../Compiler/ExtensionCompilerPassTest.php | 5 +-
.../ResolveParameterPlaceHoldersPassTest.php | 5 +-
.../Config/AutowireServiceResourceTest.php | 7 +-
...ContainerParametersResourceCheckerTest.php | 5 +-
.../ContainerParametersResourceTest.php | 5 +-
.../Tests/CrossCheckTest.php | 5 +-
.../Tests/Dumper/GraphvizDumperTest.php | 5 +-
.../Tests/Dumper/PhpDumperTest.php | 5 +-
.../Tests/Dumper/XmlDumperTest.php | 5 +-
.../Tests/Dumper/YamlDumperTest.php | 5 +-
.../Tests/Loader/DirectoryLoaderTest.php | 7 +-
.../Tests/Loader/FileLoaderTest.php | 5 +-
.../Tests/Loader/IniFileLoaderTest.php | 5 +-
.../Tests/Loader/LoaderResolverTest.php | 5 +-
.../Tests/Loader/XmlFileLoaderTest.php | 5 +-
.../Tests/Loader/YamlFileLoaderTest.php | 5 +-
.../Component/DomCrawler/Tests/FormTest.php | 5 +-
.../Tests/AbstractEventDispatcherTest.php | 7 +-
.../EventDispatcher/Tests/EventTest.php | 7 +-
.../Tests/GenericEventTest.php | 7 +-
.../Tests/ImmutableEventDispatcherTest.php | 5 +-
.../ExpressionLanguage/Tests/LexerTest.php | 5 +-
.../Filesystem/Tests/FilesystemTestCase.php | 9 +-
.../Tests/Iterator/RealIteratorTestCase.php | 8 +-
.../Component/Form/FormErrorIterator.php | 2 +-
.../Form/Test/FormIntegrationTestCase.php | 2 +-
...wnTrait.php => ForwardCompatTestTrait.php} | 4 +-
.../Component/Form/Test/TypeTestCase.php | 2 +-
.../Component/Form/Tests/AbstractFormTest.php | 7 +-
.../Form/Tests/AbstractLayoutTest.php | 6 +-
.../Form/Tests/AbstractRequestHandlerTest.php | 5 +-
.../Component/Form/Tests/ButtonTest.php | 5 +-
.../ChoiceList/AbstractChoiceListTest.php | 5 +-
.../Tests/ChoiceList/ArrayChoiceListTest.php | 5 +-
.../Factory/CachingFactoryDecoratorTest.php | 5 +-
.../Factory/DefaultChoiceListFactoryTest.php | 5 +-
.../Factory/PropertyAccessDecoratorTest.php | 5 +-
.../Tests/ChoiceList/LazyChoiceListTest.php | 5 +-
.../Loader/CallbackChoiceLoaderTest.php | 7 +-
.../Console/Descriptor/JsonDescriptorTest.php | 7 +-
.../Console/Descriptor/TextDescriptorTest.php | 7 +-
.../DataMapper/PropertyPathMapperTest.php | 5 +-
.../ArrayToPartsTransformerTest.php | 7 +-
.../BooleanToStringTransformerTest.php | 7 +-
.../ChoiceToValueTransformerTest.php | 7 +-
.../ChoicesToValuesTransformerTest.php | 7 +-
...teTimeToLocalizedStringTransformerTest.php | 7 +-
.../DateTimeToRfc3339TransformerTest.php | 7 +-
...ntegerToLocalizedStringTransformerTest.php | 7 +-
.../MoneyToLocalizedStringTransformerTest.php | 7 +-
...NumberToLocalizedStringTransformerTest.php | 7 +-
...ercentToLocalizedStringTransformerTest.php | 7 +-
.../ValueToDuplicatesTransformerTest.php | 7 +-
.../MergeCollectionListenerTest.php | 7 +-
.../EventListener/ResizeFormListenerTest.php | 7 +-
.../Extension/Core/Type/ChoiceTypeTest.php | 7 +-
.../Extension/Core/Type/CountryTypeTest.php | 5 +-
.../Extension/Core/Type/CurrencyTypeTest.php | 5 +-
.../Extension/Core/Type/DateTimeTypeTest.php | 5 +-
.../Extension/Core/Type/DateTypeTest.php | 7 +-
.../Extension/Core/Type/IntegerTypeTest.php | 5 +-
.../Extension/Core/Type/LanguageTypeTest.php | 5 +-
.../Extension/Core/Type/LocaleTypeTest.php | 5 +-
.../Extension/Core/Type/MoneyTypeTest.php | 7 +-
.../Extension/Core/Type/NumberTypeTest.php | 7 +-
.../Extension/Core/Type/RepeatedTypeTest.php | 5 +-
.../CsrfValidationListenerTest.php | 7 +-
.../Csrf/Type/FormTypeCsrfExtensionTest.php | 7 +-
.../DataCollectorExtensionTest.php | 5 +-
.../DataCollector/FormDataCollectorTest.php | 5 +-
.../DataCollector/FormDataExtractorTest.php | 4 +-
.../Type/DataCollectorTypeExtensionTest.php | 5 +-
.../Constraints/FormValidatorTest.php | 5 +-
.../EventListener/ValidationListenerTest.php | 5 +-
.../Validator/ValidatorTypeGuesserTest.php | 5 +-
.../ViolationMapper/ViolationMapperTest.php | 5 +-
.../Component/Form/Tests/FormBuilderTest.php | 7 +-
.../Form/Tests/FormFactoryBuilderTest.php | 5 +-
.../Component/Form/Tests/FormFactoryTest.php | 5 +-
.../Component/Form/Tests/FormRegistryTest.php | 5 +-
.../Form/Tests/NativeRequestHandlerTest.php | 9 +-
.../Form/Tests/ResolvedFormTypeTest.php | 5 +-
.../Tests/BinaryFileResponseTest.php | 5 +-
.../Tests/File/MimeType/MimeTypeTest.php | 5 +-
.../Tests/File/UploadedFileTest.php | 5 +-
.../HttpFoundation/Tests/FileBagTest.php | 7 +-
.../HttpFoundation/Tests/JsonResponseTest.php | 5 +-
.../HttpFoundation/Tests/RequestTest.php | 5 +-
.../Tests/ResponseFunctionalTest.php | 7 +-
.../Session/Attribute/AttributeBagTest.php | 7 +-
.../Attribute/NamespacedAttributeBagTest.php | 7 +-
.../Session/Flash/AutoExpireFlashBagTest.php | 7 +-
.../Tests/Session/Flash/FlashBagTest.php | 7 +-
.../Tests/Session/SessionTest.php | 7 +-
.../Handler/AbstractSessionHandlerTest.php | 7 +-
.../Handler/MemcacheSessionHandlerTest.php | 7 +-
.../Handler/MemcachedSessionHandlerTest.php | 7 +-
.../Handler/MongoDbSessionHandlerTest.php | 5 +-
.../Storage/Handler/PdoSessionHandlerTest.php | 5 +-
.../Tests/Session/Storage/MetadataBagTest.php | 7 +-
.../Storage/MockArraySessionStorageTest.php | 7 +-
.../Storage/MockFileSessionStorageTest.php | 7 +-
.../Storage/NativeSessionStorageTest.php | 7 +-
.../Storage/PhpBridgeSessionStorageTest.php | 7 +-
.../Storage/Proxy/AbstractProxyTest.php | 7 +-
.../Storage/Proxy/SessionHandlerProxyTest.php | 7 +-
.../CacheClearer/ChainCacheClearerTest.php | 7 +-
.../CacheWarmer/CacheWarmerAggregateTest.php | 7 +-
.../Tests/CacheWarmer/CacheWarmerTest.php | 7 +-
.../Config/EnvParametersResourceTest.php | 7 +-
.../Tests/Controller/ArgumentResolverTest.php | 5 +-
.../ArgumentMetadataFactoryTest.php | 5 +-
.../DataCollector/Util/ValueExporterTest.php | 5 +-
.../ServicesResetterTest.php | 5 +-
.../AddRequestFormatsListenerTest.php | 7 +-
.../EventListener/LocaleListenerTest.php | 5 +-
.../EventListener/ResponseListenerTest.php | 7 +-
.../EventListener/RouterListenerTest.php | 5 +-
.../EventListener/TestSessionListenerTest.php | 5 +-
.../EventListener/TranslatorListenerTest.php | 5 +-
.../ValidateRequestListenerTest.php | 5 +-
.../Tests/Fragment/FragmentHandlerTest.php | 5 +-
.../Tests/HttpCache/HttpCacheTestCase.php | 7 +-
.../HttpKernel/Tests/HttpCache/StoreTest.php | 7 +-
.../Tests/HttpCache/SubRequestHandlerTest.php | 7 +-
.../Component/HttpKernel/Tests/KernelTest.php | 5 +-
.../HttpKernel/Tests/Log/LoggerTest.php | 7 +-
.../Profiler/FileProfilerStorageTest.php | 7 +-
.../Tests/Profiler/ProfilerTest.php | 7 +-
.../Collator/Verification/CollatorTest.php | 5 +-
.../Bundle/Reader/BundleEntryReaderTest.php | 5 +-
.../Bundle/Reader/IntlBundleReaderTest.php | 5 +-
.../Bundle/Reader/JsonBundleReaderTest.php | 5 +-
.../Bundle/Reader/PhpBundleReaderTest.php | 5 +-
.../Bundle/Writer/JsonBundleWriterTest.php | 7 +-
.../Bundle/Writer/PhpBundleWriterTest.php | 7 +-
.../Bundle/Writer/TextBundleWriterTest.php | 7 +-
.../AbstractCurrencyDataProviderTest.php | 5 +-
.../Provider/AbstractDataProviderTest.php | 5 +-
.../AbstractLanguageDataProviderTest.php | 5 +-
.../AbstractLocaleDataProviderTest.php | 5 +-
.../AbstractRegionDataProviderTest.php | 5 +-
.../AbstractScriptDataProviderTest.php | 5 +-
.../Tests/Data/Util/LocaleScannerTest.php | 7 +-
.../Intl/Tests/Data/Util/RingBufferTest.php | 5 +-
.../AbstractIntlDateFormatterTest.php | 5 +-
.../Verification/IntlDateFormatterTest.php | 5 +-
.../Globals/Verification/IntlGlobalsTest.php | 5 +-
.../Tests/Locale/Verification/LocaleTest.php | 5 +-
.../Verification/NumberFormatterTest.php | 5 +-
.../Tests/Adapter/ExtLdap/LdapManagerTest.php | 5 +-
.../Component/Ldap/Tests/LdapClientTest.php | 5 +-
src/Symfony/Component/Ldap/Tests/LdapTest.php | 5 +-
.../Lock/Tests/Store/CombinedStoreTest.php | 4 +-
.../Lock/Tests/Store/MemcachedStoreTest.php | 4 +-
.../Lock/Tests/Store/PredisStoreTest.php | 6 +-
.../Lock/Tests/Store/RedisArrayStoreTest.php | 6 +-
.../Tests/Store/RedisClusterStoreTest.php | 6 +-
.../Lock/Tests/Store/RedisStoreTest.php | 6 +-
.../Tests/Strategy/ConsensusStrategyTest.php | 5 +-
.../Tests/Strategy/UnanimousStrategyTest.php | 5 +-
.../Tests/OptionsResolverTest.php | 5 +-
.../Process/Tests/ExecutableFinderTest.php | 5 +-
.../Component/Process/Tests/ProcessTest.php | 7 +-
.../Tests/PropertyAccessorArrayAccessTest.php | 5 +-
.../Tests/PropertyAccessorBuilderTest.php | 7 +-
.../Tests/PropertyAccessorTest.php | 5 +-
.../Tests/PropertyPathBuilderTest.php | 5 +-
.../AbstractPropertyInfoExtractorTest.php | 5 +-
.../Tests/Extractor/PhpDocExtractorTest.php | 5 +-
.../Extractor/ReflectionExtractorTest.php | 5 +-
.../Extractor/SerializerExtractorTest.php | 5 +-
.../Tests/PropertyInfoCacheExtractorTest.php | 5 +-
.../Dumper/PhpGeneratorDumperTest.php | 7 +-
.../Loader/AnnotationClassLoaderTest.php | 5 +-
.../Loader/AnnotationDirectoryLoaderTest.php | 5 +-
.../Tests/Loader/AnnotationFileLoaderTest.php | 5 +-
.../Tests/Loader/DirectoryLoaderTest.php | 5 +-
.../Matcher/Dumper/PhpMatcherDumperTest.php | 7 +-
.../Component/Routing/Tests/RouterTest.php | 5 +-
.../AuthorizationCheckerTest.php | 5 +-
.../Tests/Authorization/Voter/VoterTest.php | 5 +-
.../Encoder/Argon2iPasswordEncoderTest.php | 5 +-
.../Constraints/UserPasswordValidatorTest.php | 5 +-
.../Csrf/Tests/CsrfTokenManagerTest.php | 7 +-
.../UriSafeTokenGeneratorTest.php | 9 +-
.../NativeSessionTokenStorageTest.php | 5 +-
.../TokenStorage/SessionTokenStorageTest.php | 5 +-
.../FormLoginAuthenticatorTest.php | 5 +-
.../GuardAuthenticationListenerTest.php | 7 +-
.../Tests/GuardAuthenticatorHandlerTest.php | 7 +-
.../GuardAuthenticationProviderTest.php | 7 +-
...efaultAuthenticationFailureHandlerTest.php | 5 +-
.../SimpleAuthenticationHandlerTest.php | 5 +-
.../Http/Tests/Firewall/DigestDataTest.php | 5 +-
.../SimplePreAuthenticationListenerTest.php | 7 +-
.../Tests/Firewall/SwitchUserListenerTest.php | 5 +-
.../CsrfTokenClearingLogoutHandlerTest.php | 5 +-
.../Tests/Logout/LogoutUrlGeneratorTest.php | 5 +-
...istentTokenBasedRememberMeServicesTest.php | 5 +-
.../Tests/Encoder/ChainDecoderTest.php | 5 +-
.../Tests/Encoder/ChainEncoderTest.php | 5 +-
.../Tests/Encoder/CsvEncoderTest.php | 5 +-
.../Tests/Encoder/JsonDecodeTest.php | 5 +-
.../Tests/Encoder/JsonEncodeTest.php | 5 +-
.../Tests/Encoder/JsonEncoderTest.php | 5 +-
.../Tests/Encoder/XmlEncoderTest.php | 5 +-
.../Mapping/Loader/AnnotationLoaderTest.php | 5 +-
.../Mapping/Loader/XmlFileLoaderTest.php | 5 +-
.../Mapping/Loader/YamlFileLoaderTest.php | 5 +-
.../Normalizer/AbstractNormalizerTest.php | 5 +-
.../Normalizer/ArrayDenormalizerTest.php | 5 +-
.../Tests/Normalizer/CustomNormalizerTest.php | 5 +-
.../Normalizer/DataUriNormalizerTest.php | 5 +-
.../Normalizer/DateIntervalNormalizerTest.php | 5 +-
.../Normalizer/DateTimeNormalizerTest.php | 5 +-
.../Normalizer/GetSetMethodNormalizerTest.php | 5 +-
.../JsonSerializableNormalizerTest.php | 5 +-
.../Tests/Normalizer/ObjectNormalizerTest.php | 5 +-
.../Normalizer/PropertyNormalizerTest.php | 5 +-
.../Tests/Loader/ChainLoaderTest.php | 5 +-
.../Tests/Loader/FilesystemLoaderTest.php | 5 +-
.../Templating/Tests/PhpEngineTest.php | 7 +-
.../Tests/TemplateNameParserTest.php | 7 +-
.../TranslationDataCollectorTest.php | 5 +-
.../Tests/Loader/LocalizedTestCase.php | 5 +-
.../Translation/Tests/TranslatorCacheTest.php | 7 +-
.../Test/ConstraintValidatorTestCase.php | 2 +-
...wnTrait.php => ForwardCompatTestTrait.php} | 4 +-
.../Tests/ConstraintViolationListTest.php | 7 +-
.../Tests/Constraints/FileValidatorTest.php | 7 +-
.../Tests/Constraints/ImageValidatorTest.php | 5 +-
.../Tests/Constraints/TypeValidatorTest.php | 5 +-
.../Tests/Mapping/Cache/DoctrineCacheTest.php | 5 +-
.../Tests/Mapping/Cache/Psr6CacheTest.php | 5 +-
.../Tests/Mapping/ClassMetadataTest.php | 7 +-
.../Mapping/Loader/StaticMethodLoaderTest.php | 7 +-
.../Tests/Mapping/MemberMetadataTest.php | 7 +-
.../Tests/Validator/AbstractTest.php | 5 +-
.../Tests/Validator/AbstractValidatorTest.php | 7 +-
.../Validator/Tests/ValidatorBuilderTest.php | 7 +-
.../Tests/Caster/ExceptionCasterTest.php | 30 +++----
.../Tests/Caster/XmlReaderCasterTest.php | 6 +-
.../Tests/HttpHeaderSerializerTest.php | 5 +-
.../Tests/Dumper/GraphvizDumperTest.php | 4 +-
.../Dumper/StateMachineGraphvizDumperTest.php | 4 +-
.../Tests/EventListener/GuardListenerTest.php | 7 +-
.../Component/Workflow/Tests/RegistryTest.php | 7 +-
.../Yaml/Tests/Command/LintCommandTest.php | 7 +-
.../Component/Yaml/Tests/DumperTest.php | 7 +-
.../Component/Yaml/Tests/InlineTest.php | 5 +-
.../Component/Yaml/Tests/ParserTest.php | 3 +
359 files changed, 1765 insertions(+), 519 deletions(-)
create mode 100644 src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
create mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
create mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php
rename src/Symfony/Bundle/FrameworkBundle/Test/{KernelShutdownOnTearDownTrait.php => ForwardCompatTestTrait.php} (54%)
rename src/Symfony/Component/Form/Test/{TestCaseSetUpTearDownTrait.php => ForwardCompatTestTrait.php} (95%)
rename src/Symfony/Component/Validator/Test/{TestCaseSetUpTearDownTrait.php => ForwardCompatTestTrait.php} (95%)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php
index b3fb8bc3ac94e..060a8b6af7d1f 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php
@@ -13,14 +13,17 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\ContainerAwareEventManager;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
class ContainerAwareEventManagerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $container;
private $evm;
- protected function setUp()
+ private function doSetUp()
{
$this->container = new Container();
$this->evm = new ContainerAwareEventManager($this->container);
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
index fb9becd072943..c93d8f8d7278e 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -21,12 +22,14 @@
*/
class DoctrineExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension
*/
private $extension;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
index 325ef31e2b933..cdd0375ebd1b2 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
@@ -18,6 +18,7 @@
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
@@ -26,6 +27,8 @@
*/
class DoctrineChoiceLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ChoiceListFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -71,7 +74,7 @@ class DoctrineChoiceLoaderTest extends TestCase
*/
private $obj3;
- protected function setUp()
+ private function doSetUp()
{
$this->factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
index e6e85f4d3f7df..113e07e29562c 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
@@ -14,18 +14,21 @@
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Form\DataTransformer\CollectionToArrayTransformer;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Bernhard Schussek
*/
class CollectionToArrayTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var CollectionToArrayTransformer
*/
private $transformer;
- protected function setUp()
+ private function doSetUp()
{
$this->transformer = new CollectionToArrayTransformer();
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php
index c70bc3d0372a7..a9eb4d76a0deb 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php
@@ -14,6 +14,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Form\EventListener\MergeDoctrineCollectionListener;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormEvent;
@@ -21,6 +22,8 @@
class MergeDoctrineCollectionListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var \Doctrine\Common\Collections\ArrayCollection */
private $collection;
/** @var \Symfony\Component\EventDispatcher\EventDispatcher */
@@ -28,7 +31,7 @@ class MergeDoctrineCollectionListenerTest extends TestCase
private $factory;
private $form;
- protected function setUp()
+ private function doSetUp()
{
$this->collection = new ArrayCollection(['test']);
$this->dispatcher = new EventDispatcher();
@@ -37,7 +40,7 @@ protected function setUp()
->getForm();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->collection = null;
$this->dispatcher = null;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
index 5dc184fb91009..225a1ade00dfc 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
@@ -15,6 +15,7 @@
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Symfony\Component\Form\Test\FormPerformanceTestCase;
@@ -23,6 +24,8 @@
*/
class EntityTypePerformanceTest extends FormPerformanceTestCase
{
+ use ForwardCompatTestTrait;
+
const ENTITY_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity';
/**
@@ -50,7 +53,7 @@ protected function getExtensions()
];
}
- protected function setUp()
+ private function doSetUp()
{
$this->em = DoctrineTestHelper::createTestEntityManager();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index 83cbbd1426c79..0bbc2b1d14ad6 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -28,6 +28,7 @@
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringCastableIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Forms;
@@ -36,6 +37,8 @@
class EntityTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Bridge\Doctrine\Form\Type\EntityType';
const ITEM_GROUP_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity';
@@ -59,7 +62,7 @@ class EntityTypeTest extends BaseTypeTest
protected static $supportedFeatureSetVersion = 304;
- protected function setUp()
+ private function doSetUp()
{
$this->em = DoctrineTestHelper::createTestEntityManager();
$this->emRegistry = $this->createRegistryMock('default', $this->em);
@@ -89,7 +92,7 @@ protected function setUp()
}
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
index e5ebeeacf813a..d909292d49c06 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
@@ -13,11 +13,14 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\ManagerRegistry;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper\PhpDumperTest;
class ManagerRegistryTest extends TestCase
{
- public static function setUpBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!class_exists('PHPUnit_Framework_TestCase')) {
self::markTestSkipped('proxy-manager-bridge is not yet compatible with namespaced phpunit versions.');
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
index cad2dfeaac89e..eb0dea017e8bc 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
@@ -16,6 +16,7 @@
use Doctrine\ORM\Tools\Setup;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Type;
/**
@@ -23,12 +24,14 @@
*/
class DoctrineExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var DoctrineExtractor
*/
private $extractor;
- protected function setUp()
+ private function doSetUp()
{
$config = Setup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true);
$entityManager = EntityManager::create(['driver' => 'pdo_sqlite'], $config);
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
index 24a7f555f4f67..e5eaf0138ec58 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
@@ -32,6 +32,7 @@
use Symfony\Bridge\Doctrine\Tests\Fixtures\Type\StringWrapper;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
@@ -39,6 +40,8 @@
*/
class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
const EM_NAME = 'foo';
/**
@@ -58,7 +61,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
protected $repositoryFactory;
- protected function setUp()
+ private function doSetUp()
{
$this->repositoryFactory = new TestRepositoryFactory();
diff --git a/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php b/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
new file mode 100644
index 0000000000000..bdff8c18829ba
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit;
+
+use PHPUnit\Framework\TestCase;
+
+// A trait to provide forward compatibility with newest PHPUnit versions
+
+if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
+ trait ForwardCompatTestTrait
+ {
+ use Legacy\ForwardCompatTestTraitForV8;
+ }
+} else {
+ trait ForwardCompatTestTrait
+ {
+ use Legacy\ForwardCompatTestTraitForV5;
+ }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
new file mode 100644
index 0000000000000..5b35e8018290b
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
@@ -0,0 +1,82 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+/**
+ * @internal
+ */
+trait ForwardCompatTestTraitForV5
+{
+ /**
+ * @return void
+ */
+ public static function setUpBeforeClass()
+ {
+ self::doSetUpBeforeClass();
+ }
+
+ /**
+ * @return void
+ */
+ public static function tearDownAfterClass()
+ {
+ self::doTearDownAfterClass();
+ }
+
+ /**
+ * @return void
+ */
+ protected function setUp()
+ {
+ self::doSetUp();
+ }
+
+ /**
+ * @return void
+ */
+ protected function tearDown()
+ {
+ self::doTearDown();
+ }
+
+ /**
+ * @return void
+ */
+ private static function doSetUpBeforeClass()
+ {
+ parent::setUpBeforeClass();
+ }
+
+ /**
+ * @return void
+ */
+ private static function doTearDownAfterClass()
+ {
+ parent::tearDownAfterClass();
+ }
+
+ /**
+ * @return void
+ */
+ private function doSetUp()
+ {
+ parent::setUp();
+ }
+
+ /**
+ * @return void
+ */
+ private function doTearDown()
+ {
+ parent::tearDown();
+ }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php
new file mode 100644
index 0000000000000..4963ed9e0c38a
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+/**
+ * @internal
+ */
+trait ForwardCompatTestTraitForV8
+{
+ public static function setUpBeforeClass(): void
+ {
+ self::doSetUpBeforeClass();
+ }
+
+ public static function tearDownAfterClass(): void
+ {
+ self::doTearDownAfterClass();
+ }
+
+ protected function setUp(): void
+ {
+ self::doSetUp();
+ }
+
+ protected function tearDown(): void
+ {
+ self::doTearDown();
+ }
+
+ private static function doSetUpBeforeClass(): void
+ {
+ parent::setUpBeforeClass();
+ }
+
+ private static function doTearDownAfterClass(): void
+ {
+ parent::tearDownAfterClass();
+ }
+
+ private function doSetUp(): void
+ {
+ parent::setUp();
+ }
+
+ private function doTearDown(): void
+ {
+ parent::tearDown();
+ }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
index 82cfb6f566d9e..75a494dbb18ee 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClockMock;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Dominic Tubach
@@ -21,12 +22,14 @@
*/
class ClockMockTest extends TestCase
{
- public static function setUpBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
ClockMock::register(__CLASS__);
}
- protected function setUp()
+ private function doSetUp()
{
ClockMock::withClockMock(1234567890.125);
}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
index a178ac7e898c7..4ef2d75b805e3 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
@@ -13,10 +13,13 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DnsMock;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class DnsMockTest extends TestCase
{
- protected function tearDown()
+ use ForwardCompatTestTrait;
+
+ private function doTearDown()
{
DnsMock::withMockedHosts(array());
}
diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php
index e58b7d6356161..9ea6791fd3386 100644
--- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php
+++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Instantiator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
use Symfony\Component\DependencyInjection\Definition;
@@ -22,6 +23,8 @@
*/
class RuntimeInstantiatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var RuntimeInstantiator
*/
@@ -30,7 +33,7 @@ class RuntimeInstantiatorTest extends TestCase
/**
* {@inheritdoc}
*/
- protected function setUp()
+ private function doSetUp()
{
$this->instantiator = new RuntimeInstantiator();
}
diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
index 5328c9ae1227d..6b97cf48ef476 100644
--- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -24,6 +25,8 @@
*/
class ProxyDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ProxyDumper
*/
@@ -32,7 +35,7 @@ class ProxyDumperTest extends TestCase
/**
* {@inheritdoc}
*/
- protected function setUp()
+ private function doSetUp()
{
$this->dumper = new ProxyDumper();
}
diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
index 0502a64ce1da9..e6484f634e1c6 100644
--- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Bridge\Twig\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\AppVariable;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
@@ -10,12 +11,14 @@
class AppVariableTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var AppVariable
*/
protected $appVariable;
- protected function setUp()
+ private function doSetUp()
{
$this->appVariable = new AppVariable();
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
index e50a555e7f43f..a52ad549f80eb 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Command\LintCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\OutputInterface;
@@ -21,6 +22,8 @@
class LintCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $files;
public function testLintCorrectFile()
@@ -113,12 +116,12 @@ private function createFile($content)
return $filename;
}
- protected function setUp()
+ private function doSetUp()
{
$this->files = [];
}
- protected function tearDown()
+ private function doTearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
index 02f6ac9b1e269..11d42626ca8ad 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -22,6 +23,8 @@
class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3HorizontalLayoutTest
{
+ use ForwardCompatTestTrait;
+
use RuntimeLoaderProvider;
protected $testableFeatures = [
@@ -33,7 +36,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
*/
private $renderer;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
index 0c2ef171b254b..590ee7658e653 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -22,6 +23,7 @@
class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
{
+ use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
@@ -29,7 +31,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
*/
private $renderer;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
index 319c0e57308a2..658f069019cd4 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -27,6 +28,7 @@
*/
class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4HorizontalLayoutTest
{
+ use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
protected $testableFeatures = [
@@ -35,7 +37,7 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori
private $renderer;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
index ea36552d85b71..1f9808eb76cd1 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -27,13 +28,14 @@
*/
class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
{
+ use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
* @var FormRenderer
*/
private $renderer;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
index 214df3c7f6b18..b5780b96fd856 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -24,6 +25,7 @@
class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
{
+ use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
@@ -33,7 +35,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
protected static $supportedFeatureSetVersion = 304;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
index f956767363a97..2b02970963510 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -23,6 +24,7 @@
class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
{
+ use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
@@ -32,7 +34,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
protected static $supportedFeatureSetVersion = 304;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php
index f49eea396d0d8..e9a4ce166736b 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php
@@ -13,6 +13,7 @@
use Fig\Link\Link;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\WebLinkExtension;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -22,6 +23,8 @@
*/
class WebLinkExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var Request
*/
@@ -32,7 +35,7 @@ class WebLinkExtensionTest extends TestCase
*/
private $extension;
- protected function setUp()
+ private function doSetUp()
{
$this->request = new Request();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php
index 20d78bfe3986c..e608e450736a2 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\WorkflowExtension;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Registry;
@@ -21,9 +22,11 @@
class WorkflowExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $extension;
- protected function setUp()
+ private function doSetUp()
{
$places = ['ordered', 'waiting_for_payment', 'processed'];
$transitions = [
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php b/src/Symfony/Bundle/FrameworkBundle/Test/ForwardCompatTestTrait.php
similarity index 54%
rename from src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php
rename to src/Symfony/Bundle/FrameworkBundle/Test/ForwardCompatTestTrait.php
index b01dbb0494340..6fb7479e2ceab 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Test/ForwardCompatTestTrait.php
@@ -13,7 +13,7 @@
use PHPUnit\Framework\TestCase;
-// Auto-adapt to PHPUnit 8 that added a `void` return-type to the tearDown method
+// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
eval('
@@ -22,11 +22,24 @@
/**
* @internal
*/
- trait KernelShutdownOnTearDownTrait
+ trait ForwardCompatTestTrait
{
+ private function doSetUp(): void
+ {
+ }
+
+ private function doTearDown(): void
+ {
+ }
+
+ protected function setUp(): void
+ {
+ $this->doSetUp();
+ }
+
protected function tearDown(): void
{
- static::ensureKernelShutdown();
+ $this->doTearDown();
}
}
');
@@ -34,14 +47,36 @@ protected function tearDown(): void
/**
* @internal
*/
- trait KernelShutdownOnTearDownTrait
+ trait ForwardCompatTestTrait
{
+ /**
+ * @return void
+ */
+ private function doSetUp()
+ {
+ }
+
+ /**
+ * @return void
+ */
+ private function doTearDown()
+ {
+ }
+
+ /**
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->doSetUp();
+ }
+
/**
* @return void
*/
protected function tearDown()
{
- static::ensureKernelShutdown();
+ $this->doTearDown();
}
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
index 978f65863220c..f81a1c740a7ee 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
@@ -23,7 +23,7 @@
*/
abstract class KernelTestCase extends TestCase
{
- use KernelShutdownOnTearDownTrait;
+ use ForwardCompatTestTrait;
protected static $class;
@@ -32,6 +32,11 @@ abstract class KernelTestCase extends TestCase
*/
protected static $kernel;
+ private function doTearDown()
+ {
+ static::ensureKernelShutdown();
+ }
+
/**
* Finds the directory where the phpunit.xml(.dist) is stored.
*
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
index 9cc3bfa2d2f91..b5c8c4c171695 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
@@ -5,6 +5,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Annotations\Reader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -15,9 +16,11 @@
class AnnotationsCacheWarmerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $cacheDir;
- protected function setUp()
+ private function doSetUp()
{
$this->cacheDir = sys_get_temp_dir().'/'.uniqid();
$fs = new Filesystem();
@@ -25,7 +28,7 @@ protected function setUp()
parent::setUp();
}
- protected function tearDown()
+ private function doTearDown()
{
$fs = new Filesystem();
$fs->remove($this->cacheDir);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
index b63c746eb60ca..68fb05bdc8ae9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;
@@ -21,6 +22,8 @@
class TemplatePathsCacheWarmerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var Filesystem */
private $filesystem;
@@ -35,7 +38,7 @@ class TemplatePathsCacheWarmerTest extends TestCase
private $tmpDir;
- protected function setUp()
+ private function doSetUp()
{
$this->templateFinder = $this
->getMockBuilder(TemplateFinderInterface::class)
@@ -56,7 +59,7 @@ protected function setUp()
$this->filesystem->mkdir($this->tmpDir);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->filesystem->remove($this->tmpDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
index c2cded7ab0966..c811fdadea577 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture\TestAppKernel;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -23,13 +24,15 @@
class CacheClearCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var TestAppKernel */
private $kernel;
/** @var Filesystem */
private $fs;
private $rootDir;
- protected function setUp()
+ private function doSetUp()
{
$this->fs = new Filesystem();
$this->kernel = new TestAppKernel('test', true);
@@ -38,7 +41,7 @@ protected function setUp()
$this->fs->mkdir($this->rootDir);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->fs->remove($this->rootDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index cfa6e3b8a877e..f5f6001ecd17e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -20,6 +21,8 @@
class TranslationDebugCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $fs;
private $translationDir;
@@ -109,7 +112,7 @@ public function testDebugInvalidDirectory()
$tester->execute(['locale' => 'en', 'bundle' => 'dir']);
}
- protected function setUp()
+ private function doSetUp()
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation', true);
@@ -119,7 +122,7 @@ protected function setUp()
$this->fs->mkdir($this->translationDir.'/templates');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->fs->remove($this->translationDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index 7e487ff527113..cd691df5972aa 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -20,6 +21,8 @@
class TranslationUpdateCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $fs;
private $translationDir;
@@ -87,7 +90,7 @@ public function testWriteMessagesForSpecificDomain()
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
}
- protected function setUp()
+ private function doSetUp()
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation', true);
@@ -97,7 +100,7 @@ protected function setUp()
$this->fs->mkdir($this->translationDir.'/templates');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->fs->remove($this->translationDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
index a71fb824d57c4..6c3c0aa74a510 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Application as BaseApplication;
@@ -28,6 +29,8 @@
*/
class YamlLintCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $files;
public function testLintCorrectFile()
@@ -183,13 +186,13 @@ private function getKernelAwareApplicationMock()
return $application;
}
- protected function setUp()
+ private function doSetUp()
{
@mkdir(sys_get_temp_dir().'/yml-lint-test');
$this->files = [];
}
- protected function tearDown()
+ private function doTearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
index e775ac7cf199a..1b9d91df1c2b4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
@@ -11,16 +11,19 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Descriptor\TextDescriptor;
class TextDescriptorTest extends AbstractDescriptorTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
putenv('COLUMNS=121');
}
- protected function tearDown()
+ private function doTearDown()
{
putenv('COLUMNS');
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
index 91a72821e9539..f6a6590396de9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
use Composer\Autoload\ClassLoader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\HttpKernel\Kernel;
class ControllerNameParserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $loader;
- protected function setUp()
+ private function doSetUp()
{
$this->loader = new ClassLoader();
$this->loader->add('TestBundle', __DIR__.'/../Fixtures');
@@ -28,7 +31,7 @@ protected function setUp()
$this->loader->register();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->loader->unregister();
$this->loader = null;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
index 1e7dc416cb47f..ef29ae8bca85e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\DependencyInjection\ChildDefinition;
@@ -21,9 +22,11 @@
class CachePoolPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $cachePoolPass;
- protected function setUp()
+ private function doSetUp()
{
$this->cachePoolPass = new CachePoolPass();
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
index 8748d1e9c7300..580b81aec0741 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -19,10 +20,12 @@
class DataCollectorTranslatorPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $container;
private $dataCollectorTranslatorPass;
- protected function setUp()
+ private function doSetUp()
{
$this->container = new ContainerBuilder();
$this->dataCollectorTranslatorPass = new DataCollectorTranslatorPass();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
index 44c87b188fa17..c20660820b006 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\WorkflowGuardListenerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
@@ -22,10 +23,12 @@
class WorkflowGuardListenerPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $container;
private $compilerPass;
- protected function setUp()
+ private function doSetUp()
{
$this->container = new ContainerBuilder();
$this->compilerPass = new WorkflowGuardListenerPass();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
index 03c6bdcbd7e11..c7c13eb05f3b8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
@@ -11,23 +11,26 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
abstract class AbstractWebTestCase extends BaseWebTestCase
{
+ use ForwardCompatTestTrait;
+
public static function assertRedirect($response, $location)
{
self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.$response->getStatusCode());
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
}
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
static::deleteTmpDir();
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
static::deleteTmpDir();
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
index e30a0e1eeafb1..7ae8258c60911 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -20,7 +21,9 @@
*/
class CachePoolClearCommandTest extends AbstractWebTestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
static::bootKernel(['test_case' => 'CachePoolClear', 'root_config' => 'config.yml']);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
index c10750eaa9352..11048a4605e92 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
@@ -21,9 +22,11 @@
*/
class ConfigDebugCommandTest extends AbstractWebTestCase
{
+ use ForwardCompatTestTrait;
+
private $application;
- protected function setUp()
+ private function doSetUp()
{
$kernel = static::createKernel(['test_case' => 'ConfigDump', 'root_config' => 'config.yml']);
$this->application = new Application($kernel);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
index b8ac6645f6fac..f402af5c3717c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
@@ -21,9 +22,11 @@
*/
class ConfigDumpReferenceCommandTest extends AbstractWebTestCase
{
+ use ForwardCompatTestTrait;
+
private $application;
- protected function setUp()
+ private function doSetUp()
{
$kernel = static::createKernel(['test_case' => 'ConfigDump', 'root_config' => 'config.yml']);
$this->application = new Application($kernel);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
index 46a581b9442e4..5e15b25d63177 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
@@ -11,16 +11,19 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
class GlobalVariablesTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $container;
private $globals;
- protected function setUp()
+ private function doSetUp()
{
$this->container = new Container();
$this->globals = new GlobalVariables($this->container);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php
index 83df0640bfaee..e86b647cf175f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper;
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\Packages;
@@ -19,9 +20,11 @@
class AssetsHelperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $helper;
- protected function setUp()
+ private function doSetUp()
{
$fooPackage = new Package(new StaticVersionStrategy('42', '%s?v=%s'));
$barPackage = new Package(new StaticVersionStrategy('22', '%s?%s'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
index 03b2ed6961b7d..edd3ae6b9cc38 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTranslator;
@@ -22,6 +23,8 @@
class FormHelperDivLayoutTest extends AbstractDivLayoutTest
{
+ use ForwardCompatTestTrait;
+
/**
* @var PhpEngine
*/
@@ -52,7 +55,7 @@ protected function getExtensions()
]);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->engine = null;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
index bd088078c32d1..72b6aeda061eb 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTranslator;
@@ -22,6 +23,8 @@
class FormHelperTableLayoutTest extends AbstractTableLayoutTest
{
+ use ForwardCompatTestTrait;
+
/**
* @var PhpEngine
*/
@@ -77,7 +80,7 @@ protected function getExtensions()
]);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->engine = null;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php
index a2068ae757741..3cf9a3f103083 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
class RequestHelperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $requestStack;
- protected function setUp()
+ private function doSetUp()
{
$this->requestStack = new RequestStack();
$request = new Request();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
index 06984095f1a4b..0265a77f8e3cd 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -20,9 +21,11 @@
class SessionHelperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $requestStack;
- protected function setUp()
+ private function doSetUp()
{
$request = new Request();
@@ -36,7 +39,7 @@ protected function setUp()
$this->requestStack->push($request);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->requestStack = null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php
index 3c44612b87631..1224d62ec8d61 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php
@@ -11,20 +11,23 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
class TemplateFilenameParserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $parser;
- protected function setUp()
+ private function doSetUp()
{
$this->parser = new TemplateFilenameParser();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->parser = null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
index 4460d2ac2b525..0866c6ba65031 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -18,9 +19,11 @@
class TemplateNameParserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $parser;
- protected function setUp()
+ private function doSetUp()
{
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel
@@ -37,7 +40,7 @@ protected function setUp()
$this->parser = new TemplateNameParser($kernel);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->parser = null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
index 9dfd861dbeac0..0ca3216a2b572 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Translation\Formatter\MessageFormatter;
@@ -20,15 +21,17 @@
class TranslatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $tmpDir;
- protected function setUp()
+ private function doSetUp()
{
$this->tmpDir = sys_get_temp_dir().'/sf2_translation';
$this->deleteTmpDir();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->deleteTmpDir();
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
index 72a67a9a48763..5d8d3516f4fad 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
@@ -11,23 +11,26 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
class AbstractWebTestCase extends BaseWebTestCase
{
+ use ForwardCompatTestTrait;
+
public static function assertRedirect($response, $location)
{
self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.substr($response, 0, 2000));
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
}
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
static::deleteTmpDir();
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
static::deleteTmpDir();
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
index 3533f554baa1e..05413b805b0e9 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand;
use Symfony\Component\Console\Application as ConsoleApplication;
@@ -27,6 +28,8 @@
*/
class UserPasswordEncoderCommandTest extends AbstractWebTestCase
{
+ use ForwardCompatTestTrait;
+
/** @var CommandTester */
private $passwordEncoderCommandTester;
@@ -249,7 +252,7 @@ public function testLegacy()
$this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $tester->getDisplay());
}
- protected function setUp()
+ private function doSetUp()
{
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
$kernel = $this->createKernel(['test_case' => 'PasswordEncode']);
@@ -262,7 +265,7 @@ protected function setUp()
$this->passwordEncoderCommandTester = new CommandTester($passwordEncoderCommand);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->passwordEncoderCommandTester = null;
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
index 3b65273d6d731..a65aa03c57d3e 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class TwigLoaderPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ContainerBuilder
*/
@@ -31,7 +34,7 @@ class TwigLoaderPassTest extends TestCase
*/
private $pass;
- protected function setUp()
+ private function doSetUp()
{
$this->builder = new ContainerBuilder();
$this->builder->register('twig');
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
index 63710a8e16eab..90d9010442d8f 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
@@ -20,6 +21,8 @@
class CacheWarmingTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCacheIsProperlyWarmedWhenTemplatingIsAvailable()
{
$kernel = new CacheWarmingKernel(true);
@@ -44,12 +47,12 @@ public function testCacheIsProperlyWarmedWhenTemplatingIsDisabled()
$this->assertFileExists($kernel->getCacheDir().'/twig');
}
- protected function setUp()
+ private function doSetUp()
{
$this->deleteTempDir();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->deleteTempDir();
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
index dddfff76efcb7..be93a3225b3ef 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
@@ -20,6 +21,8 @@
class NoTemplatingEntryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function test()
{
$kernel = new NoTemplatingEntryKernel('dev', true);
@@ -30,12 +33,12 @@ public function test()
$this->assertContains('{ a: b }', $content);
}
- protected function setUp()
+ private function doSetUp()
{
$this->deleteTempDir();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->deleteTempDir();
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
index 7ec5f7dc2d550..5c81319b3a8ed 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\WebProfilerBundle\Tests\DependencyInjection;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\WebProfilerBundle\DependencyInjection\WebProfilerExtension;
use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
@@ -22,6 +23,8 @@
class WebProfilerExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $kernel;
/**
* @var \Symfony\Component\DependencyInjection\Container
@@ -46,7 +49,7 @@ public static function assertSaneContainer(Container $container, $message = '',
self::assertEquals([], $errors, $message);
}
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -73,7 +76,7 @@ protected function setUp()
$this->container->addCompilerPass(new RegisterListenersPass());
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
index c6bc1cdba36ed..387fefa981585 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\WebProfilerBundle\Tests\Profiler;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symfony\Component\HttpKernel\Profiler\Profile;
@@ -23,6 +24,8 @@
*/
class TemplateManagerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var Environment
*/
@@ -38,7 +41,7 @@ class TemplateManagerTest extends TestCase
*/
protected $templateManager;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php
index 5fcec9a26311b..b4beee075c429 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php
@@ -11,10 +11,13 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\RedisAdapter;
abstract class AbstractRedisAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testExpiration' => 'Testing expiration slows down the test suite',
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
@@ -28,7 +31,7 @@ public function createCachePool($defaultLifetime = 0)
return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!\extension_loaded('redis')) {
self::markTestSkipped('Extension redis required.');
@@ -39,7 +42,7 @@ public static function setupBeforeClass()
}
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
index 5758a28618e27..15341bc8dde66 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
@@ -13,11 +13,14 @@
use Cache\IntegrationTests\CachePoolTest;
use Psr\Cache\CacheItemPoolInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\PruneableInterface;
abstract class AdapterTestCase extends CachePoolTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
index fa8306826e5d8..0beb73666b85c 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemPoolInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
/**
@@ -19,12 +20,14 @@
*/
class FilesystemAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
public function createCachePool($defaultLifetime = 0)
{
return new FilesystemAdapter('', $defaultLifetime);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
self::rmdir(sys_get_temp_dir().'/symfony-cache');
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
index 2a88fea18bbe8..a69a922089706 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
class MemcachedAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
@@ -23,7 +26,7 @@ class MemcachedAdapterTest extends AdapterTestCase
protected static $client;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!MemcachedAdapter::isSupported()) {
self::markTestSkipped('Extension memcached >=2.2.0 required.');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
index b587cf6d62d99..761ab8d88a800 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\PdoAdapter;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -19,11 +20,12 @@
*/
class PdoAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -35,7 +37,7 @@ public static function setupBeforeClass()
$pool->createTable();
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
index d0699f1e3443f..4c45b27bad404 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Doctrine\DBAL\DriverManager;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\PdoAdapter;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -20,11 +21,12 @@
*/
class PdoDbalAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -36,7 +38,7 @@ public static function setupBeforeClass()
$pool->createTable();
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
index a227adffa02b4..89d9b2d9dac13 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
@@ -20,6 +21,8 @@
*/
class PhpArrayAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testBasicUsage' => 'PhpArrayAdapter is read-only.',
'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.',
@@ -55,12 +58,12 @@ class PhpArrayAdapterTest extends AdapterTestCase
protected static $file;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- protected function tearDown()
+ private function doTearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php
index a7feced4ea167..4984656b108d6 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
@@ -19,6 +20,8 @@
*/
class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
@@ -30,12 +33,12 @@ class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
protected static $file;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- protected function tearDown()
+ private function doTearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php
index 247160d53c268..3b5abc9e2bcfc 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemPoolInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
/**
@@ -19,6 +20,8 @@
*/
class PhpFilesAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.',
];
@@ -32,7 +35,7 @@ public function createCachePool()
return new PhpFilesAdapter('sf-cache');
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
index f311a35390070..896624766af1b 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Predis\Connection\StreamConnection;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\RedisAdapter;
class PredisAdapterTest extends AbstractRedisAdapterTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = new \Predis\Client(['host' => getenv('REDIS_HOST')]);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
index f723dc4468572..1b27fc1e5f943 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
@@ -11,15 +11,19 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class PredisClusterAdapterTest extends AbstractRedisAdapterTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = new \Predis\Client([['host' => getenv('REDIS_HOST')]]);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
index 6bf0348a1e68a..ee275789554ea 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
@@ -11,9 +11,13 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
@@ -21,7 +25,7 @@ public static function setupBeforeClass()
self::$redis = new \Predis\Client(explode(' ', $hosts), ['cluster' => 'redis']);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
index eb2cbd46fd957..d4de198e29bec 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
@@ -11,13 +11,16 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Traits\RedisProxy;
class RedisAdapterTest extends AbstractRedisAdapterTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
index 749b039a030dc..d7d1547e84312 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
@@ -11,9 +11,13 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class RedisArrayAdapterTest extends AbstractRedisAdapterTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
parent::setupBeforeClass();
if (!class_exists('RedisArray')) {
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
index 852079c00ce79..6bec87178ba7e 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
@@ -11,9 +11,13 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class RedisClusterAdapterTest extends AbstractRedisAdapterTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
index 488127cc950ad..96103b0fed43b 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
@@ -20,12 +21,14 @@
*/
class TagAwareAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
public function createCachePool($defaultLifetime = 0)
{
return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime));
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
index dd5e1509c1bcc..55d69fa136dfe 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
@@ -11,10 +11,13 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\RedisCache;
abstract class AbstractRedisCacheTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testSetTtl' => 'Testing expiration slows down the test suite',
'testSetMultipleTtl' => 'Testing expiration slows down the test suite',
@@ -28,7 +31,7 @@ public function createSimpleCache($defaultLifetime = 0)
return new RedisCache(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!\extension_loaded('redis')) {
self::markTestSkipped('Extension redis required.');
@@ -39,7 +42,7 @@ public static function setupBeforeClass()
}
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php b/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php
index ff9944a3400b2..4c016fdc4f6b8 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php
@@ -13,11 +13,14 @@
use Cache\IntegrationTests\SimpleCacheTest;
use Psr\SimpleCache\CacheInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\PruneableInterface;
abstract class CacheTestCase extends SimpleCacheTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
index f83f0a2e34527..a9674de40959e 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Simple\MemcachedCache;
class MemcachedCacheTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testSetTtl' => 'Testing expiration slows down the test suite',
'testSetMultipleTtl' => 'Testing expiration slows down the test suite',
@@ -24,7 +27,7 @@ class MemcachedCacheTest extends CacheTestCase
protected static $client;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!MemcachedCache::isSupported()) {
self::markTestSkipped('Extension memcached >=2.2.0 required.');
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
index 665db09f672a0..35baff11fa958 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\PdoCache;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -19,11 +20,12 @@
*/
class PdoCacheTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -35,7 +37,7 @@ public static function setupBeforeClass()
$pool->createTable();
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
index ce1a9ae4f8c6e..3364151771ba5 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Simple;
use Doctrine\DBAL\DriverManager;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\PdoCache;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -20,11 +21,12 @@
*/
class PdoDbalCacheTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -36,7 +38,7 @@ public static function setupBeforeClass()
$pool->createTable();
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php
index a1bab079cca21..0bcdeeacf9027 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\NullCache;
use Symfony\Component\Cache\Simple\PhpArrayCache;
use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
@@ -20,6 +21,8 @@
*/
class PhpArrayCacheTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testBasicUsageWithLongKey' => 'PhpArrayCache does no writes',
@@ -49,12 +52,12 @@ class PhpArrayCacheTest extends CacheTestCase
protected static $file;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- protected function tearDown()
+ private function doTearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
index abee5e7872164..dbb2d300d411f 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\FilesystemCache;
use Symfony\Component\Cache\Simple\PhpArrayCache;
use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
@@ -20,6 +21,8 @@
*/
class PhpArrayCacheWithFallbackTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testGetInvalidKeys' => 'PhpArrayCache does no validation',
'testGetMultipleInvalidKeys' => 'PhpArrayCache does no validation',
@@ -36,12 +39,12 @@ class PhpArrayCacheWithFallbackTest extends CacheTestCase
protected static $file;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- protected function tearDown()
+ private function doTearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
index bda39d990bcb3..0ef66c212d92c 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
@@ -11,9 +11,13 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class RedisArrayCacheTest extends AbstractRedisCacheTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
parent::setupBeforeClass();
if (!class_exists('RedisArray')) {
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
index 407d916c7317c..021d9353d2786 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\RedisCache;
class RedisCacheTest extends AbstractRedisCacheTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = RedisCache::createConnection('redis://'.getenv('REDIS_HOST'));
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
index 99d4e518fb409..1d72200512936 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
@@ -11,9 +11,13 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class RedisClusterCacheTest extends AbstractRedisCacheTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
diff --git a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
index 6706acbd36290..ae6cb0d390d44 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\ClassLoader\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\ClassLoader\ClassLoader;
@@ -20,7 +21,9 @@
*/
class ApcClassLoaderTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
if (!(filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) {
$this->markTestSkipped('The apc extension is not enabled.');
@@ -29,7 +32,7 @@ protected function setUp()
}
}
- protected function tearDown()
+ private function doTearDown()
{
if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
apcu_clear_cache();
diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php
index d0b70899b513a..5000b0edd7335 100644
--- a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php
+++ b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Tests\Resource\ResourceStub;
class ConfigCacheTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $cacheFile = null;
- protected function setUp()
+ private function doSetUp()
{
$this->cacheFile = tempnam(sys_get_temp_dir(), 'config_');
}
- protected function tearDown()
+ private function doTearDown()
{
$files = [$this->cacheFile, $this->cacheFile.'.meta'];
diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
index 85f6c02ee6ee8..6e86f9142dc88 100644
--- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
@@ -12,13 +12,16 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\DirectoryResource;
class DirectoryResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $directory;
- protected function setUp()
+ private function doSetUp()
{
$this->directory = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'symfonyDirectoryIterator';
if (!file_exists($this->directory)) {
@@ -27,7 +30,7 @@ protected function setUp()
touch($this->directory.'/tmp.xml');
}
- protected function tearDown()
+ private function doTearDown()
{
if (!is_dir($this->directory)) {
return;
diff --git a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php
index 433f65e8203db..ff80eddd4a790 100644
--- a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php
@@ -12,22 +12,25 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileExistenceResource;
class FileExistenceResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $resource;
protected $file;
protected $time;
- protected function setUp()
+ private function doSetUp()
{
$this->file = realpath(sys_get_temp_dir()).'/tmp.xml';
$this->time = time();
$this->resource = new FileExistenceResource($this->file);
}
- protected function tearDown()
+ private function doTearDown()
{
if (file_exists($this->file)) {
unlink($this->file);
diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
index 97781ffabfcf1..091d9630e0ef2 100644
--- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
class FileResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $resource;
protected $file;
protected $time;
- protected function setUp()
+ private function doSetUp()
{
$this->file = sys_get_temp_dir().'/tmp.xml';
$this->time = time();
@@ -28,7 +31,7 @@ protected function setUp()
$this->resource = new FileResource($this->file);
}
- protected function tearDown()
+ private function doTearDown()
{
if (!file_exists($this->file)) {
return;
diff --git a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php
index cfbfd2b4554e2..4bc1d1aef25ba 100644
--- a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\GlobResource;
class GlobResourceTest extends TestCase
{
- protected function tearDown()
+ use ForwardCompatTestTrait;
+
+ private function doTearDown()
{
$dir = \dirname(__DIR__).'/Fixtures';
@rmdir($dir.'/TmpGlob');
diff --git a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php
index a2c2eeb811b20..c235465178307 100644
--- a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php
+++ b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php
@@ -12,20 +12,23 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\ResourceCheckerConfigCache;
use Symfony\Component\Config\Tests\Resource\ResourceStub;
class ResourceCheckerConfigCacheTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $cacheFile = null;
- protected function setUp()
+ private function doSetUp()
{
$this->cacheFile = tempnam(sys_get_temp_dir(), 'config_');
}
- protected function tearDown()
+ private function doTearDown()
{
$files = [$this->cacheFile, "{$this->cacheFile}.meta"];
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 181e82593db76..8ea7870141823 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
@@ -39,16 +40,18 @@
class ApplicationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
private $colSize;
- protected function setUp()
+ private function doSetUp()
{
$this->colSize = getenv('COLUMNS');
}
- protected function tearDown()
+ private function doTearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
putenv('SHELL_VERBOSITY');
@@ -56,7 +59,7 @@ protected function tearDown()
unset($_SERVER['SHELL_VERBOSITY']);
}
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
require_once self::$fixturesPath.'/FooCommand.php';
diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
index 9a135d325590a..23e3ed581094a 100644
--- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\FormatterHelper;
@@ -26,9 +27,11 @@
class CommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../Fixtures/';
require_once self::$fixturesPath.'/TestCommand.php';
diff --git a/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php b/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php
index 6a72706ee457f..15763253af42e 100644
--- a/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Lock\Factory;
use Symfony\Component\Lock\Store\FlockStore;
@@ -19,9 +20,11 @@
class LockableTraitTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../Fixtures/';
require_once self::$fixturesPath.'/FooLockCommand.php';
diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
index a0be9b8a6d94d..5c878759711f2 100644
--- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\StreamOutput;
@@ -21,15 +22,17 @@
*/
class ProgressBarTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $colSize;
- protected function setUp()
+ private function doSetUp()
{
$this->colSize = getenv('COLUMNS');
putenv('COLUMNS=120');
}
- protected function tearDown()
+ private function doTearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
index d58a5036de830..fa7cca3ab576b 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Helper\TableSeparator;
@@ -20,14 +21,16 @@
class TableTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $stream;
- protected function setUp()
+ private function doSetUp()
{
$this->stream = fopen('php://memory', 'r+');
}
- protected function tearDown()
+ private function doTearDown()
{
fclose($this->stream);
$this->stream = null;
diff --git a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
index 5fdcb981c6079..92fab322f67d7 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
class InputDefinitionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixtures;
protected $foo;
@@ -25,7 +28,7 @@ class InputDefinitionTest extends TestCase
protected $foo1;
protected $foo2;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixtures = __DIR__.'/../Fixtures/';
}
diff --git a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
index 780b5681fa8d2..78a094ccdb5e1 100644
--- a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
+++ b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\Console\Tests\Output;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\StreamOutput;
class StreamOutputTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $stream;
- protected function setUp()
+ private function doSetUp()
{
$this->stream = fopen('php://memory', 'a', false);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->stream = null;
}
diff --git a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
index 88d00c8a9926b..323ef2dc08fae 100644
--- a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Style;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputInterface;
@@ -22,13 +23,15 @@
class SymfonyStyleTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var Command */
protected $command;
/** @var CommandTester */
protected $tester;
private $colSize;
- protected function setUp()
+ private function doSetUp()
{
$this->colSize = getenv('COLUMNS');
putenv('COLUMNS=121');
@@ -36,7 +39,7 @@ protected function setUp()
$this->tester = new CommandTester($this->command);
}
- protected function tearDown()
+ private function doTearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
$this->command = null;
diff --git a/src/Symfony/Component/Console/Tests/TerminalTest.php b/src/Symfony/Component/Console/Tests/TerminalTest.php
index 93b8c44a78158..bf40393fb5de0 100644
--- a/src/Symfony/Component/Console/Tests/TerminalTest.php
+++ b/src/Symfony/Component/Console/Tests/TerminalTest.php
@@ -12,20 +12,23 @@
namespace Symfony\Component\Console\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Terminal;
class TerminalTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $colSize;
private $lineSize;
- protected function setUp()
+ private function doSetUp()
{
$this->colSize = getenv('COLUMNS');
$this->lineSize = getenv('LINES');
}
- protected function tearDown()
+ private function doTearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
diff --git a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php
index 74c3562001fca..49d42314c2f88 100644
--- a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php
+++ b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Console\Tests\Tester;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Tester\ApplicationTester;
class ApplicationTesterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $application;
protected $tester;
- protected function setUp()
+ private function doSetUp()
{
$this->application = new Application();
$this->application->setAutoExit(false);
@@ -34,7 +37,7 @@ protected function setUp()
$this->tester->run(['command' => 'foo', 'foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->application = null;
$this->tester = null;
diff --git a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
index f916b1821fcc8..cea8090adbedf 100644
--- a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
+++ b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Tester;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
@@ -24,10 +25,12 @@
class CommandTesterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $command;
protected $tester;
- protected function setUp()
+ private function doSetUp()
{
$this->command = new Command('foo');
$this->command->addArgument('command');
@@ -38,7 +41,7 @@ protected function setUp()
$this->tester->execute(['foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->command = null;
$this->tester = null;
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index c6bc3f7d88b5e..b01020ec30fd9 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Debug\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\DebugClassLoader;
use Symfony\Component\Debug\ErrorHandler;
class DebugClassLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var int Error reporting level before running tests
*/
@@ -24,7 +27,7 @@ class DebugClassLoaderTest extends TestCase
private $loader;
- protected function setUp()
+ private function doSetUp()
{
$this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader();
@@ -32,7 +35,7 @@ protected function setUp()
DebugClassLoader::enable();
}
- protected function tearDown()
+ private function doTearDown()
{
DebugClassLoader::disable();
spl_autoload_unregister([$this->loader, 'loadClass']);
diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
index 8a196649503c3..b5e9a7e4ae07c 100644
--- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Debug\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\Exception\OutOfMemoryException;
use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
@@ -21,12 +22,14 @@
class ExceptionHandlerTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
testHeader();
}
- protected function tearDown()
+ private function doTearDown()
{
testHeader();
}
diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
index 9a56b3b4ec8fc..b40b3fd496e35 100644
--- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
@@ -13,13 +13,16 @@
use Composer\Autoload\ClassLoader as ComposerClassLoader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\DebugClassLoader;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
class ClassNotFoundFatalErrorHandlerTest extends TestCase
{
- public static function setUpBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
foreach (spl_autoload_functions() as $function) {
if (!\is_array($function)) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
index 810fbe48a573f..5b1862d97f135 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ExtensionCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -22,10 +23,12 @@
*/
class ExtensionCompilerPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $container;
private $pass;
- protected function setUp()
+ private function doSetUp()
{
$this->container = new ContainerBuilder();
$this->pass = new ExtensionCompilerPass();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
index 5aa6471751f24..3e946932f44bd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class ResolveParameterPlaceHoldersPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $compilerPass;
private $container;
private $fooDefinition;
- protected function setUp()
+ private function doSetUp()
{
$this->compilerPass = new ResolveParameterPlaceHoldersPass();
$this->container = $this->createContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php
index 153e0807ef862..03ed02035eedc 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Config\AutowireServiceResource;
@@ -20,6 +21,8 @@
*/
class AutowireServiceResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var AutowireServiceResource
*/
@@ -28,7 +31,7 @@ class AutowireServiceResourceTest extends TestCase
private $class;
private $time;
- protected function setUp()
+ private function doSetUp()
{
$this->file = realpath(sys_get_temp_dir()).'/tmp.php';
$this->time = time();
@@ -101,7 +104,7 @@ public function testNotFreshIfClassNotFound()
$this->assertFalse($resource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the class no longer exists');
}
- protected function tearDown()
+ private function doTearDown()
{
if (!file_exists($this->file)) {
return;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
index eb5fc5a99d2e1..4b089936e749c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\ResourceCheckerInterface;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker;
@@ -19,6 +20,8 @@
class ContainerParametersResourceCheckerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var ContainerParametersResource */
private $resource;
@@ -28,7 +31,7 @@ class ContainerParametersResourceCheckerTest extends TestCase
/** @var ContainerInterface */
private $container;
- protected function setUp()
+ private function doSetUp()
{
$this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']);
$this->container = $this->getMockBuilder(ContainerInterface::class)->getMock();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php
index e177ac16b80f7..392c84871c90e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php
@@ -12,14 +12,17 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
class ContainerParametersResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var ContainerParametersResource */
private $resource;
- protected function setUp()
+ private function doSetUp()
{
$this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']);
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
index fe132af484732..6afc5d9ae809d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
@@ -12,14 +12,17 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CrossCheckTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/Fixtures/';
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
index ea11c7c533a3d..23f1cb8bb4d0f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper;
@@ -19,9 +20,11 @@
class GraphvizDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../Fixtures/';
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index 0fca22cb694c7..b4e361077308b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
@@ -41,9 +42,11 @@
class PhpDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
index e660c7e801547..f9c545f01f647 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -21,9 +22,11 @@
class XmlDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php
index 49ee8e6f3002e..e94dcfb196573 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -24,9 +25,11 @@
class YamlDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
index c7c303b683d99..8de0b7d0de82e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -22,17 +23,19 @@
class DirectoryLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $fixturesPath;
private $container;
private $loader;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
- protected function setUp()
+ private function doSetUp()
{
$locator = new FileLocator(self::$fixturesPath);
$this->container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index 065acdf1babcb..ee102c75bbbc9 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface as PsrContainerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -35,9 +36,11 @@
class FileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
index 1d7d3a93ebd09..87a436c4b520c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
class IniFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $container;
protected $loader;
- protected function setUp()
+ private function doSetUp()
{
$this->container = new ContainerBuilder();
$this->loader = new IniFileLoader($this->container, new FileLocator(realpath(__DIR__.'/../Fixtures/').'/ini'));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php
index 9167e18cedcab..3200e344804a6 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -23,12 +24,14 @@
class LoaderResolverTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $fixturesPath;
/** @var LoaderResolver */
private $resolver;
- protected function setUp()
+ private function doSetUp()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index 03376a641dcc0..cafe419c6b027 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Config\Resource\FileResource;
@@ -33,9 +34,11 @@
class XmlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
require_once self::$fixturesPath.'/includes/foo.php';
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index 05521bf7846f7..45d9ff10da7e0 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Config\Resource\FileResource;
@@ -33,9 +34,11 @@
class YamlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
require_once self::$fixturesPath.'/includes/foo.php';
diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
index 2c0ee22c1fc45..32a7d9ec7079b 100644
--- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Form;
use Symfony\Component\DomCrawler\FormFieldRegistry;
class FormTest extends TestCase
{
- public static function setUpBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
// Ensure that the private helper class FormFieldRegistry is loaded
class_exists('Symfony\\Component\\DomCrawler\\Form');
diff --git a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
index b157659dc0846..2974fd2bb5339 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
abstract class AbstractEventDispatcherTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/* Some pseudo events */
const preFoo = 'pre.foo';
const postFoo = 'post.foo';
@@ -31,13 +34,13 @@ abstract class AbstractEventDispatcherTest extends TestCase
private $listener;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = $this->createEventDispatcher();
$this->listener = new TestEventListener();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dispatcher = null;
$this->listener = null;
diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventTest.php
index 5be2ea09f9d2f..7ccb3b773c1ac 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/EventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/EventTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\Event;
/**
@@ -19,6 +20,8 @@
*/
class EventTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Component\EventDispatcher\Event
*/
@@ -28,7 +31,7 @@ class EventTest extends TestCase
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
- protected function setUp()
+ private function doSetUp()
{
$this->event = new Event();
}
@@ -37,7 +40,7 @@ protected function setUp()
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
- protected function tearDown()
+ private function doTearDown()
{
$this->event = null;
}
diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
index 461f86161e067..e2f3c481ee951 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
@@ -19,6 +20,8 @@
*/
class GenericEventTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var GenericEvent
*/
@@ -29,7 +32,7 @@ class GenericEventTest extends TestCase
/**
* Prepares the environment before running a test.
*/
- protected function setUp()
+ private function doSetUp()
{
$this->subject = new \stdClass();
$this->event = new GenericEvent($this->subject, ['name' => 'Event']);
@@ -38,7 +41,7 @@ protected function setUp()
/**
* Cleans up the environment after running a test.
*/
- protected function tearDown()
+ private function doTearDown()
{
$this->subject = null;
$this->event = null;
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
index c52fefe509ae9..6eebf621e3f7e 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
@@ -20,6 +21,8 @@
*/
class ImmutableEventDispatcherTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -30,7 +33,7 @@ class ImmutableEventDispatcherTest extends TestCase
*/
private $dispatcher;
- protected function setUp()
+ private function doSetUp()
{
$this->innerDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
index ba35e7d19a9e2..d94dd74f06e60 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\Lexer;
use Symfony\Component\ExpressionLanguage\Token;
use Symfony\Component\ExpressionLanguage\TokenStream;
class LexerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var Lexer
*/
private $lexer;
- protected function setUp()
+ private function doSetUp()
{
$this->lexer = new Lexer();
}
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
index eb6b35ddfd621..b3fd67cbe8fcc 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Filesystem\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
class FilesystemTestCase extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $umask;
protected $longPathNamesWindows = [];
@@ -40,7 +43,7 @@ class FilesystemTestCase extends TestCase
*/
private static $symlinkOnWindows = null;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
if ('\\' === \DIRECTORY_SEPARATOR) {
self::$linkOnWindows = true;
@@ -69,7 +72,7 @@ public static function setUpBeforeClass()
}
}
- protected function setUp()
+ private function doSetUp()
{
$this->umask = umask(0);
$this->filesystem = new Filesystem();
@@ -78,7 +81,7 @@ protected function setUp()
$this->workspace = realpath($this->workspace);
}
- protected function tearDown()
+ private function doTearDown()
{
if (!empty($this->longPathNamesWindows)) {
foreach ($this->longPathNamesWindows as $path) {
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
index 70048a5ea6982..281cbf1093b89 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
@@ -11,12 +11,16 @@
namespace Symfony\Component\Finder\Tests\Iterator;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
abstract class RealIteratorTestCase extends IteratorTestCase
{
+ use ForwardCompatTestTrait;
+
protected static $tmpDir;
protected static $files;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
@@ -58,7 +62,7 @@ public static function setUpBeforeClass()
touch(self::toAbsolute('test.php'), strtotime('2005-10-15'));
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
$paths = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
diff --git a/src/Symfony/Component/Form/FormErrorIterator.php b/src/Symfony/Component/Form/FormErrorIterator.php
index db1d311a30d7a..a565d227c28f2 100644
--- a/src/Symfony/Component/Form/FormErrorIterator.php
+++ b/src/Symfony/Component/Form/FormErrorIterator.php
@@ -70,7 +70,7 @@ public function __toString()
if ($error instanceof FormError) {
$string .= 'ERROR: '.$error->getMessage()."\n";
} else {
- /** @var self $error */
+ /* @var self $error */
$string .= $error->form->getName().":\n";
$string .= self::indent((string) $error);
}
diff --git a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php
index b50d943779190..eabf82d161cf4 100644
--- a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php
+++ b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php
@@ -20,7 +20,7 @@
*/
abstract class FormIntegrationTestCase extends TestCase
{
- use TestCaseSetUpTearDownTrait;
+ use ForwardCompatTestTrait;
/**
* @var FormFactoryInterface
diff --git a/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php b/src/Symfony/Component/Form/Test/ForwardCompatTestTrait.php
similarity index 95%
rename from src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php
rename to src/Symfony/Component/Form/Test/ForwardCompatTestTrait.php
index b44d8212dfc28..756f7d17bfa1a 100644
--- a/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php
+++ b/src/Symfony/Component/Form/Test/ForwardCompatTestTrait.php
@@ -22,7 +22,7 @@
/**
* @internal
*/
- trait TestCaseSetUpTearDownTrait
+ trait ForwardCompatTestTrait
{
private function doSetUp(): void
{
@@ -47,7 +47,7 @@ protected function tearDown(): void
/**
* @internal
*/
- trait TestCaseSetUpTearDownTrait
+ trait ForwardCompatTestTrait
{
/**
* @return void
diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php
index 19fb5c32a0739..d7260c5da14a2 100644
--- a/src/Symfony/Component/Form/Test/TypeTestCase.php
+++ b/src/Symfony/Component/Form/Test/TypeTestCase.php
@@ -17,7 +17,7 @@
abstract class TypeTestCase extends FormIntegrationTestCase
{
- use TestCaseSetUpTearDownTrait;
+ use ForwardCompatTestTrait;
/**
* @var FormBuilder
diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
index 00d9e0fbd485e..0a3edfee30247 100644
--- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormBuilder;
abstract class AbstractFormTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var EventDispatcherInterface
*/
@@ -33,14 +36,14 @@ abstract class AbstractFormTest extends TestCase
*/
protected $form;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->form = $this->createForm();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dispatcher = null;
$this->factory = null;
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index 4e01253e2e564..1309e680396a0 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormView;
@@ -18,12 +19,13 @@
abstract class AbstractLayoutTest extends FormIntegrationTestCase
{
+ use ForwardCompatTestTrait;
use VersionAwareTest;
protected $csrfTokenManager;
protected $testableFeatures = [];
- protected function setUp()
+ private function doSetUp()
{
if (!\extension_loaded('intl')) {
$this->markTestSkipped('Extension intl is required.');
@@ -43,7 +45,7 @@ protected function getExtensions()
];
}
- protected function tearDown()
+ private function doTearDown()
{
$this->csrfTokenManager = null;
diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
index f2ee71b3424cd..36126dcb086c2 100644
--- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Form;
@@ -26,6 +27,8 @@
*/
abstract class AbstractRequestHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var RequestHandlerInterface
*/
@@ -40,7 +43,7 @@ abstract class AbstractRequestHandlerTest extends TestCase
protected $serverParams;
- protected function setUp()
+ private function doSetUp()
{
$this->serverParams = $this->getMockBuilder('Symfony\Component\Form\Util\ServerParams')->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
$this->requestHandler = $this->getRequestHandler();
diff --git a/src/Symfony/Component/Form/Tests/ButtonTest.php b/src/Symfony/Component/Form/Tests/ButtonTest.php
index 8c1ccec75c2bb..7f4344fe63e1f 100644
--- a/src/Symfony/Component/Form/Tests/ButtonTest.php
+++ b/src/Symfony/Component/Form/Tests/ButtonTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\FormBuilder;
@@ -20,11 +21,13 @@
*/
class ButtonTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $dispatcher;
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php
index aca967daba16a..3c5290cd86b76 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Bernhard Schussek
*/
abstract class AbstractChoiceListTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Component\Form\ChoiceList\ChoiceListInterface
*/
@@ -103,7 +106,7 @@ abstract class AbstractChoiceListTest extends TestCase
*/
protected $key4;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php
index c71fd75bcf7f6..c6a80f9b638aa 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
/**
@@ -18,9 +19,11 @@
*/
class ArrayChoiceListTest extends AbstractChoiceListTest
{
+ use ForwardCompatTestTrait;
+
private $object;
- protected function setUp()
+ private function doSetUp()
{
$this->object = new \stdClass();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
index 7277d49780d65..53540651e5612 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator;
/**
@@ -19,6 +20,8 @@
*/
class CachingFactoryDecoratorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -29,7 +32,7 @@ class CachingFactoryDecoratorTest extends TestCase
*/
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->factory = new CachingFactoryDecorator($this->decoratedFactory);
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
index 5a9884e2951b0..76280d4c5df16 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory;
@@ -22,6 +23,8 @@
class DefaultChoiceListFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $obj1;
private $obj2;
@@ -84,7 +87,7 @@ public function getGroupAsObject($object)
: new DefaultChoiceListFactoryTest_Castable('Group 2');
}
- protected function setUp()
+ private function doSetUp()
{
$this->obj1 = (object) ['label' => 'A', 'index' => 'w', 'value' => 'a', 'preferred' => false, 'group' => 'Group 1', 'attr' => []];
$this->obj2 = (object) ['label' => 'B', 'index' => 'x', 'value' => 'b', 'preferred' => true, 'group' => 'Group 1', 'attr' => ['attr1' => 'value1']];
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
index 42893696db622..9e16699a7b733 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator;
use Symfony\Component\PropertyAccess\PropertyPath;
@@ -20,6 +21,8 @@
*/
class PropertyAccessDecoratorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -30,7 +33,7 @@ class PropertyAccessDecoratorTest extends TestCase
*/
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->factory = new PropertyAccessDecorator($this->decoratedFactory);
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
index 6854c43ef733f..d6cffc9447b71 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
@@ -20,6 +21,8 @@
*/
class LazyChoiceListTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var LazyChoiceList
*/
@@ -37,7 +40,7 @@ class LazyChoiceListTest extends TestCase
private $value;
- protected function setUp()
+ private function doSetUp()
{
$this->loadedList = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
$this->loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
index 362783c91e8e6..ffde233264e0a 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
@@ -20,6 +21,8 @@
*/
class CallbackChoiceLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader
*/
@@ -45,7 +48,7 @@ class CallbackChoiceLoaderTest extends TestCase
*/
private static $lazyChoiceList;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$loader = new CallbackChoiceLoader(function () {
return self::$choices;
@@ -91,7 +94,7 @@ public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall()
);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
self::$loader = null;
self::$value = null;
diff --git a/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php b/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php
index fb339f6b475ed..b8e8dd1b95afb 100644
--- a/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php
+++ b/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php
@@ -11,16 +11,19 @@
namespace Symfony\Component\Form\Tests\Console\Descriptor;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Console\Descriptor\JsonDescriptor;
class JsonDescriptorTest extends AbstractDescriptorTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
putenv('COLUMNS=121');
}
- protected function tearDown()
+ private function doTearDown()
{
putenv('COLUMNS');
}
diff --git a/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php b/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php
index 053f7e4512341..c361874e8230f 100644
--- a/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php
+++ b/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php
@@ -11,16 +11,19 @@
namespace Symfony\Component\Form\Tests\Console\Descriptor;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Console\Descriptor\TextDescriptor;
class TextDescriptorTest extends AbstractDescriptorTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
putenv('COLUMNS=121');
}
- protected function tearDown()
+ private function doTearDown()
{
putenv('COLUMNS');
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
index da351295c381e..80017a0ffb12a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataMapper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
@@ -23,6 +24,8 @@
class PropertyPathMapperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PropertyPathMapper
*/
@@ -38,7 +41,7 @@ class PropertyPathMapperTest extends TestCase
*/
private $propertyAccessor;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$this->propertyAccessor = PropertyAccess::createPropertyAccessor();
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 4f11c7f7966d1..09b81fc5e1bb4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
@@ -12,13 +12,16 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
class ArrayToPartsTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $transformer;
- protected function setUp()
+ private function doSetUp()
{
$this->transformer = new ArrayToPartsTransformer([
'first' => ['a', 'b', 'c'],
@@ -26,7 +29,7 @@ protected function setUp()
]);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->transformer = null;
}
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 5195092e18b88..5c1582eb04ad6 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
class BooleanToStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const TRUE_VALUE = '1';
/**
@@ -23,12 +26,12 @@ class BooleanToStringTransformerTest extends TestCase
*/
protected $transformer;
- protected function setUp()
+ private function doSetUp()
{
$this->transformer = new BooleanToStringTransformer(self::TRUE_VALUE);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->transformer = null;
}
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 da41a89729512..37d383490f966 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer;
class ChoiceToValueTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $transformer;
protected $transformerWithNull;
- protected function setUp()
+ private function doSetUp()
{
$list = new ArrayChoiceList(['', false, 'X', true]);
$listWithNull = new ArrayChoiceList(['', false, 'X', null]);
@@ -29,7 +32,7 @@ protected function setUp()
$this->transformerWithNull = new ChoiceToValueTransformer($listWithNull);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->transformer = null;
$this->transformerWithNull = null;
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 9e7a666ba8b2e..e741a3e11f0cf 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer;
class ChoicesToValuesTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $transformer;
protected $transformerWithNull;
- protected function setUp()
+ private function doSetUp()
{
$list = new ArrayChoiceList(['', false, 'X']);
$listWithNull = new ArrayChoiceList(['', false, 'X', null]);
@@ -29,7 +32,7 @@ protected function setUp()
$this->transformerWithNull = new ChoicesToValuesTransformer($listWithNull);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->transformer = null;
$this->transformerWithNull = null;
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 d2feb116bfcac..ec73a64950e93 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Form\Tests\Extension\Core\DataTransformer\Traits\DateTimeEqualsTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class DateTimeToLocalizedStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
use DateTimeEqualsTrait;
protected $dateTime;
protected $dateTimeWithoutSeconds;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -36,7 +39,7 @@ protected function setUp()
$this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dateTime = null;
$this->dateTimeWithoutSeconds = null;
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 773f00d71311d..ec251d8f35c10 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
@@ -12,17 +12,20 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer;
use Symfony\Component\Form\Tests\Extension\Core\DataTransformer\Traits\DateTimeEqualsTrait;
class DateTimeToRfc3339TransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
use DateTimeEqualsTrait;
protected $dateTime;
protected $dateTimeWithoutSeconds;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -30,7 +33,7 @@ protected function setUp()
$this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dateTime = null;
$this->dateTimeWithoutSeconds = null;
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 f918434715e80..c7b60d1e57e83 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
@@ -12,20 +12,23 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class IntegerToLocalizedStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $defaultLocale;
- protected function setUp()
+ private function doSetUp()
{
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
- protected function tearDown()
+ private function doTearDown()
{
\Locale::setDefault($this->defaultLocale);
}
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 c5bffe4d96e65..c7f61705f97b5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class MoneyToLocalizedStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $previousLocale;
- protected function setUp()
+ private function doSetUp()
{
$this->previousLocale = setlocale(LC_ALL, '0');
}
- protected function tearDown()
+ private function doTearDown()
{
setlocale(LC_ALL, $this->previousLocale);
}
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 9baad43549e62..fd3f570d4c740 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -12,20 +12,23 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class NumberToLocalizedStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $defaultLocale;
- protected function setUp()
+ private function doSetUp()
{
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
- protected function tearDown()
+ private function doTearDown()
{
\Locale::setDefault($this->defaultLocale);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
index f726edcda466a..e9bfa8704360f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
@@ -12,20 +12,23 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class PercentToLocalizedStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $defaultLocale;
- protected function setUp()
+ private function doSetUp()
{
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
- protected function tearDown()
+ private function doTearDown()
{
\Locale::setDefault($this->defaultLocale);
}
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 3ef681da66b4d..179ace5a6cf60 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;
class ValueToDuplicatesTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $transformer;
- protected function setUp()
+ private function doSetUp()
{
$this->transformer = new ValueToDuplicatesTransformer(['a', 'b', 'c']);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->transformer = null;
}
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 8c691dffc1d75..daf5d60d37882 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener;
use Symfony\Component\Form\FormEvent;
abstract class MergeCollectionListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $form;
- protected function setUp()
+ private function doSetUp()
{
$this->form = $this->getForm('axes');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->form = null;
}
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 ae7d2db4678dd..a1775efe9f8fa 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
@@ -23,10 +24,12 @@
class ResizeFormListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $factory;
private $form;
- protected function setUp()
+ private function doSetUp()
{
$this->factory = (new FormFactoryBuilder())->getFormFactory();
$this->form = $this->getBuilder()
@@ -35,7 +38,7 @@ protected function setUp()
->getForm();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->factory = null;
$this->form = null;
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 bb7cc0ca7f757..544f4442f19ec 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
class ChoiceTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
private $choices = [
@@ -60,7 +63,7 @@ class ChoiceTypeTest extends BaseTypeTest
],
];
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -73,7 +76,7 @@ protected function setUp()
];
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
index 96fce79f21d33..641f355de7c04 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class CountryTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CountryType';
- protected function setUp()
+ private function doSetUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
index ae8c960cc1502..afbae0d7bf79e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class CurrencyTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CurrencyType';
- protected function setUp()
+ private function doSetUp()
{
IntlTestHelper::requireIntl($this, false);
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 e3f3b729d3ec7..c1d5726122187 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
@@ -11,13 +11,16 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormError;
class DateTimeTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType';
- protected function setUp()
+ private function doSetUp()
{
\Locale::setDefault('en');
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 31dfc65af0700..6e9059d2cdb3f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -11,25 +11,28 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormError;
use Symfony\Component\Intl\Util\IntlTestHelper;
class DateTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateType';
private $defaultTimezone;
private $defaultLocale;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
$this->defaultTimezone = date_default_timezone_get();
$this->defaultLocale = \Locale::getDefault();
}
- protected function tearDown()
+ private function doTearDown()
{
date_default_timezone_set($this->defaultTimezone);
\Locale::setDefault($this->defaultLocale);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
index c5c7dd9161b7e..7c3868990bc09 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
@@ -11,13 +11,16 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class IntegerTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\IntegerType';
- protected function setUp()
+ private function doSetUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index 60614a97177f7..08f9c57bdf5c8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class LanguageTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LanguageType';
- protected function setUp()
+ private function doSetUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
index 59cdc13547547..6aead799ccae8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class LocaleTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LocaleType';
- protected function setUp()
+ private function doSetUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
index 34576ec6306ee..7dacb03a09803 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class MoneyTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\MoneyType';
private $defaultLocale;
- protected function setUp()
+ private function doSetUp()
{
// we test against different locales, so we need the full
// implementation
@@ -30,7 +33,7 @@ protected function setUp()
$this->defaultLocale = \Locale::getDefault();
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
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 9cc2893c662dc..c66ec0cc10ff6 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class NumberTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\NumberType';
private $defaultLocale;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -30,7 +33,7 @@ protected function setUp()
\Locale::setDefault('de_DE');
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
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 c380c0590b8cf..de99a9b9f16ec 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
@@ -11,10 +11,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Form;
class RepeatedTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\RepeatedType';
/**
@@ -22,7 +25,7 @@ class RepeatedTypeTest extends BaseTypeTest
*/
protected $form;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
index 5876b092b9da0..ff7be6b1f96a1 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Csrf\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener;
@@ -22,12 +23,14 @@
class CsrfValidationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $dispatcher;
protected $factory;
protected $tokenManager;
protected $form;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = (new FormFactoryBuilder())->getFormFactory();
@@ -37,7 +40,7 @@ protected function setUp()
->getForm();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dispatcher = null;
$this->factory = null;
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
index 665b700479735..d36fd38aad723 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Csrf\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\FormBuilderInterface;
@@ -30,6 +31,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
class FormTypeCsrfExtensionTest extends TypeTestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -40,7 +43,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
*/
protected $translator;
- protected function setUp()
+ private function doSetUp()
{
$this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
$this->translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock();
@@ -48,7 +51,7 @@ protected function setUp()
parent::setUp();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->tokenManager = null;
$this->translator = null;
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
index da84a5b436bd9..72c32904b1475 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension;
class DataCollectorExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var DataCollectorExtension
*/
@@ -26,7 +29,7 @@ class DataCollectorExtensionTest extends TestCase
*/
private $dataCollector;
- protected function setUp()
+ private function doSetUp()
{
$this->dataCollector = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface')->getMock();
$this->extension = new DataCollectorExtension($this->dataCollector);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
index 83d44167d5cf4..8e2e579d66cea 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\DataCollector\FormDataCollector;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
@@ -19,6 +20,8 @@
class FormDataCollectorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -64,7 +67,7 @@ class FormDataCollectorTest extends TestCase
*/
private $childView;
- protected function setUp()
+ private function doSetUp()
{
$this->dataExtractor = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface')->getMock();
$this->dataCollector = new FormDataCollector($this->dataExtractor);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
index 860a96abcddfa..5d8faf7bd0d29 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\DataCollector\FormDataExtractor;
@@ -27,6 +28,7 @@
*/
class FormDataExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
use VarDumperTestTrait;
/**
@@ -44,7 +46,7 @@ class FormDataExtractorTest extends TestCase
*/
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->dataExtractor = new FormDataExtractor();
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
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 35f38fc53aa4e..f5d0750b37a48 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector\Type;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension;
class DataCollectorTypeExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var DataCollectorTypeExtension
*/
@@ -26,7 +29,7 @@ class DataCollectorTypeExtensionTest extends TestCase
*/
private $dataCollector;
- protected function setUp()
+ private function doSetUp()
{
$this->dataCollector = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface')->getMock();
$this->extension = new DataCollectorTypeExtension($this->dataCollector);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
index 8a8af9ed6809a..a36961ed47e09 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\CallbackTransformer;
@@ -38,6 +39,8 @@
*/
class FormValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var EventDispatcherInterface
*/
@@ -48,7 +51,7 @@ class FormValidatorTest extends ConstraintValidatorTestCase
*/
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = (new FormFactoryBuilder())->getFormFactory();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
index 76bc07b2ee981..b1848ac9a4eaa 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
@@ -32,6 +33,8 @@
class ValidationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var EventDispatcherInterface
*/
@@ -58,7 +61,7 @@ class ValidationListenerTest extends TestCase
private $params;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = (new FormFactoryBuilder())->getFormFactory();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
index 878bbfad21bc5..3f657c3643fc2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\ValueGuess;
@@ -32,6 +33,8 @@
*/
class ValidatorTypeGuesserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const TEST_CLASS = 'Symfony\Component\Form\Tests\Extension\Validator\ValidatorTypeGuesserTest_TestClass';
const TEST_PROPERTY = 'property';
@@ -51,7 +54,7 @@ class ValidatorTypeGuesserTest extends TestCase
*/
private $metadataFactory;
- protected function setUp()
+ private function doSetUp()
{
$this->metadata = new ClassMetadata(self::TEST_CLASS);
$this->metadataFactory = new FakeMetadataFactory();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
index 2fa3e928926ee..7f7e9cd527637 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\CallbackTransformer;
@@ -31,6 +32,8 @@
*/
class ViolationMapperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const LEVEL_0 = 0;
const LEVEL_1 = 1;
const LEVEL_1B = 2;
@@ -61,7 +64,7 @@ class ViolationMapperTest extends TestCase
*/
private $params;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$this->mapper = new ViolationMapper();
diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
index 1247a80bbda30..4bf4a6dad9a0e 100644
--- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
@@ -12,24 +12,27 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\SubmitButtonBuilder;
class FormBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $dispatcher;
private $factory;
private $builder;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->builder = new FormBuilder('name', null, $this->dispatcher, $this->factory);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dispatcher = null;
$this->factory = null;
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
index 3e66ce8c38be6..12d5d3a6715b1 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Form\Tests\Fixtures\FooType;
class FormFactoryBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $registry;
private $guesser;
private $type;
- protected function setUp()
+ private function doSetUp()
{
$factory = new \ReflectionClass('Symfony\Component\Form\FormFactory');
$this->registry = $factory->getProperty('registry');
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
index 4426310676538..965485cf2c7e5 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\Form\Guess\Guess;
@@ -23,6 +24,8 @@
*/
class FormFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -48,7 +51,7 @@ class FormFactoryTest extends TestCase
*/
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->guesser1 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
$this->guesser2 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
index e4dee5da8a07d..8d72db3391075 100644
--- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\Form\ResolvedFormType;
@@ -31,6 +32,8 @@
*/
class FormRegistryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var FormRegistry
*/
@@ -61,7 +64,7 @@ class FormRegistryTest extends TestCase
*/
private $extension2;
- protected function setUp()
+ private function doSetUp()
{
$this->resolvedTypeFactory = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeFactory')->getMock();
$this->guesser1 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
index 36638a124f072..ab66904617849 100644
--- a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\NativeRequestHandler;
/**
@@ -18,14 +19,16 @@
*/
class NativeRequestHandlerTest extends AbstractRequestHandlerTest
{
+ use ForwardCompatTestTrait;
+
private static $serverBackup;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$serverBackup = $_SERVER;
}
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -38,7 +41,7 @@ protected function setUp()
];
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
index ba078ad1fd119..b424f2fc5523e 100644
--- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigInterface;
use Symfony\Component\Form\FormTypeExtensionInterface;
@@ -24,6 +25,8 @@
*/
class ResolvedFormTypeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -69,7 +72,7 @@ class ResolvedFormTypeTest extends TestCase
*/
private $resolvedType;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
index 853b4bb3dfe11..74d3e81622c70 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\Stream;
use Symfony\Component\HttpFoundation\Request;
@@ -19,6 +20,8 @@
class BinaryFileResponseTest extends ResponseTestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstruction()
{
$file = __DIR__.'/../README.md';
@@ -356,7 +359,7 @@ protected function provideResponse()
return new BinaryFileResponse(__DIR__.'/../README.md', 200, ['Content-Type' => 'application/octet-stream']);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
$path = __DIR__.'/../Fixtures/to_delete';
if (file_exists($path)) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
index bb88807ab0519..9f3c87c9806e5 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\File\MimeType;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
@@ -20,6 +21,8 @@
*/
class MimeTypeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $path;
public function testGuessImageWithoutExtension()
@@ -79,7 +82,7 @@ public function testGuessWithNonReadablePath()
}
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
$path = __DIR__.'/../Fixtures/to_delete';
if (file_exists($path)) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
index 5a37cda351f9a..f886ebcd11f89 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\HttpFoundation\Tests\File;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class UploadedFileTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
if (!ini_get('file_uploads')) {
$this->markTestSkipped('file_uploads is disabled in php.ini');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
index 0b6d660423f8a..3ef868eafe273 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\FileBag;
@@ -23,6 +24,8 @@
*/
class FileBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \InvalidArgumentException
*/
@@ -159,12 +162,12 @@ protected function createTempFile()
return tempnam(sys_get_temp_dir().'/form_test', 'FormTest');
}
- protected function setUp()
+ private function doSetUp()
{
mkdir(sys_get_temp_dir().'/form_test', 0777, true);
}
- protected function tearDown()
+ private function doTearDown()
{
foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) {
unlink($file);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
index ef0346cbe6dae..56a40420a2329 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\JsonResponse;
class JsonResponseTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 73d12cb3f74f4..219a16256e9d7 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -19,7 +20,9 @@
class RequestTest extends TestCase
{
- protected function tearDown()
+ use ForwardCompatTestTrait;
+
+ private function doTearDown()
{
Request::setTrustedProxies([], -1);
Request::setTrustedHosts([]);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
index 3d3e696c75c3b..e264710d16bd4 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @requires PHP 7.0
*/
class ResponseFunctionalTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $server;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
$spec = [
1 => ['file', '/dev/null', 'w'],
@@ -32,7 +35,7 @@ public static function setUpBeforeClass()
sleep(1);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
if (self::$server) {
proc_terminate(self::$server);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
index 3f2f7b3c8f341..aef66da1d2651 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
/**
@@ -21,6 +22,8 @@
*/
class AttributeBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $array = [];
/**
@@ -28,7 +31,7 @@ class AttributeBagTest extends TestCase
*/
private $bag;
- protected function setUp()
+ private function doSetUp()
{
$this->array = [
'hello' => 'world',
@@ -49,7 +52,7 @@ protected function setUp()
$this->bag->initialize($this->array);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->bag = null;
$this->array = [];
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
index 6b4bb17d696f2..a1f6bf5eb4b02 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag;
/**
@@ -21,6 +22,8 @@
*/
class NamespacedAttributeBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $array = [];
/**
@@ -28,7 +31,7 @@ class NamespacedAttributeBagTest extends TestCase
*/
private $bag;
- protected function setUp()
+ private function doSetUp()
{
$this->array = [
'hello' => 'world',
@@ -49,7 +52,7 @@ protected function setUp()
$this->bag->initialize($this->array);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->bag = null;
$this->array = [];
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
index b4e2c3a5ad30a..65b2058146a04 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag;
/**
@@ -21,6 +22,8 @@
*/
class AutoExpireFlashBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag
*/
@@ -28,7 +31,7 @@ class AutoExpireFlashBagTest extends TestCase
protected $array = [];
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
$this->bag = new FlashBag();
@@ -36,7 +39,7 @@ protected function setUp()
$this->bag->initialize($this->array);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->bag = null;
parent::tearDown();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php
index 6d8619e078a12..427af6d6775bd 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
/**
@@ -21,6 +22,8 @@
*/
class FlashBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface
*/
@@ -28,7 +31,7 @@ class FlashBagTest extends TestCase
protected $array = [];
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
$this->bag = new FlashBag();
@@ -36,7 +39,7 @@ protected function setUp()
$this->bag->initialize($this->array);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->bag = null;
parent::tearDown();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
index acb129984edd1..51516e2f23c8a 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -27,6 +28,8 @@
*/
class SessionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface
*/
@@ -37,13 +40,13 @@ class SessionTest extends TestCase
*/
protected $session;
- protected function setUp()
+ private function doSetUp()
{
$this->storage = new MockArraySessionStorage();
$this->session = new Session($this->storage, new AttributeBag(), new FlashBag());
}
- protected function tearDown()
+ private function doTearDown()
{
$this->storage = null;
$this->session = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
index 98bc67bcabb40..d83182be7ad5e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @requires PHP 7.0
*/
class AbstractSessionHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $server;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
$spec = [
1 => ['file', '/dev/null', 'w'],
@@ -32,7 +35,7 @@ public static function setUpBeforeClass()
sleep(1);
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
if (self::$server) {
proc_terminate(self::$server);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
index d7a324fc205bc..d2526868d578e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler;
/**
@@ -21,6 +22,8 @@
*/
class MemcacheSessionHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const PREFIX = 'prefix_';
const TTL = 1000;
@@ -31,7 +34,7 @@ class MemcacheSessionHandlerTest extends TestCase
protected $memcache;
- protected function setUp()
+ private function doSetUp()
{
if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
@@ -45,7 +48,7 @@ protected function setUp()
);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->memcache = null;
$this->storage = null;
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 c3deb7aed8fb5..86ac574d2f9ca 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler;
/**
@@ -20,6 +21,8 @@
*/
class MemcachedSessionHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const PREFIX = 'prefix_';
const TTL = 1000;
@@ -30,7 +33,7 @@ class MemcachedSessionHandlerTest extends TestCase
protected $memcached;
- protected function setUp()
+ private function doSetUp()
{
if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
@@ -49,7 +52,7 @@ protected function setUp()
);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->memcached = null;
$this->storage = null;
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 5ce6a9e5a6641..a762de01c130e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;
/**
@@ -21,6 +22,8 @@
*/
class MongoDbSessionHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -28,7 +31,7 @@ class MongoDbSessionHandlerTest extends TestCase
private $storage;
public $options;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
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 f0914eb43d080..e9439c3da49fb 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
/**
@@ -20,9 +21,11 @@
*/
class PdoSessionHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $dbFile;
- protected function tearDown()
+ private function doTearDown()
{
// make sure the temporary database file is deleted when it has been created (even when a test fails)
if ($this->dbFile) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php
index 2c4758b9137c0..02cea329251a6 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
/**
@@ -21,6 +22,8 @@
*/
class MetadataBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var MetadataBag
*/
@@ -28,7 +31,7 @@ class MetadataBagTest extends TestCase
protected $array = [];
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
$this->bag = new MetadataBag();
@@ -36,7 +39,7 @@ protected function setUp()
$this->bag->initialize($this->array);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->array = [];
$this->bag = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
index 2e3024ef1b166..c60a78910bc58 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
@@ -23,6 +24,8 @@
*/
class MockArraySessionStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var MockArraySessionStorage
*/
@@ -40,7 +43,7 @@ class MockArraySessionStorageTest extends TestCase
private $data;
- protected function setUp()
+ private function doSetUp()
{
$this->attributes = new AttributeBag();
$this->flashes = new FlashBag();
@@ -56,7 +59,7 @@ protected function setUp()
$this->storage->setSessionData($this->data);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->data = null;
$this->flashes = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
index 9e2692dc0ba18..36b4e605b2c9c 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;
@@ -23,6 +24,8 @@
*/
class MockFileSessionStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var string
*/
@@ -33,13 +36,13 @@ class MockFileSessionStorageTest extends TestCase
*/
protected $storage;
- protected function setUp()
+ private function doSetUp()
{
$this->sessionDir = sys_get_temp_dir().'/sf2test';
$this->storage = $this->getStorage();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->sessionDir = null;
$this->storage = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 7cc2eb79c8dbd..035b674c1ba17 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
@@ -31,9 +32,11 @@
*/
class NativeSessionStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $savePath;
- protected function setUp()
+ private function doSetUp()
{
$this->iniSet('session.save_handler', 'files');
$this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
@@ -42,7 +45,7 @@ protected function setUp()
}
}
- protected function tearDown()
+ private function doTearDown()
{
session_write_close();
array_map('unlink', glob($this->savePath.'/*'));
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
index 752be618bc1ee..c8a53f169e19f 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
@@ -27,9 +28,11 @@
*/
class PhpBridgeSessionStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $savePath;
- protected function setUp()
+ private function doSetUp()
{
$this->iniSet('session.save_handler', 'files');
$this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
@@ -38,7 +41,7 @@ protected function setUp()
}
}
- protected function tearDown()
+ private function doTearDown()
{
session_write_close();
array_map('unlink', glob($this->savePath.'/*'));
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 cbb291f19fc3f..499a54a8ed7bf 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
@@ -22,17 +23,19 @@
*/
class AbstractProxyTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var AbstractProxy
*/
protected $proxy;
- protected function setUp()
+ private function doSetUp()
{
$this->proxy = $this->getMockForAbstractClass(AbstractProxy::class);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->proxy = null;
}
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 b6e0da99ddd67..63b3c8afb3a19 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
/**
@@ -24,6 +25,8 @@
*/
class SessionHandlerProxyTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var \PHPUnit_Framework_MockObject_Matcher
*/
@@ -34,13 +37,13 @@ class SessionHandlerProxyTest extends TestCase
*/
private $proxy;
- protected function setUp()
+ private function doSetUp()
{
$this->mock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
$this->proxy = new SessionHandlerProxy($this->mock);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->mock = null;
$this->proxy = null;
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
index a7093dfc9df90..b4852cd936f1e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\HttpKernel\Tests\CacheClearer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer;
class ChainCacheClearerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $cacheDir;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$cacheDir = tempnam(sys_get_temp_dir(), 'sf2_cache_clearer_dir');
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$cacheDir);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
index 41fe28507c8f9..3f40f70bc66c5 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\HttpKernel\Tests\CacheWarmer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
class CacheWarmerAggregateTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $cacheDir;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$cacheDir = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir');
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$cacheDir);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
index 4d34e7bfc90ed..ea2c1788c47c8 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\HttpKernel\Tests\CacheWarmer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer;
class CacheWarmerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $cacheFile;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$cacheFile = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir');
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
@unlink(self::$cacheFile);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php b/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php
index a1bf52957219b..cb9d67a329f84 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Config;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
/**
@@ -19,11 +20,13 @@
*/
class EnvParametersResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $prefix = '__DUMMY_';
protected $initialEnv;
protected $resource;
- protected function setUp()
+ private function doSetUp()
{
$this->initialEnv = [
$this->prefix.'1' => 'foo',
@@ -37,7 +40,7 @@ protected function setUp()
$this->resource = new EnvParametersResource($this->prefix);
}
- protected function tearDown()
+ private function doTearDown()
{
foreach ($_SERVER as $key => $value) {
if (0 === strpos($key, $this->prefix)) {
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
index 8c900fb92c228..8fefbd7716928 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Controller;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
@@ -27,10 +28,12 @@
class ArgumentResolverTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var ArgumentResolver */
private static $resolver;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
$factory = new ArgumentMetadataFactory();
diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
index 1c0c4648a0f2a..5b5433ac9c657 100644
--- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
@@ -13,6 +13,7 @@
use Fake\ImportedAndFake;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory;
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\BasicTypesController;
@@ -21,12 +22,14 @@
class ArgumentMetadataFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ArgumentMetadataFactory
*/
private $factory;
- protected function setUp()
+ private function doSetUp()
{
$this->factory = new ArgumentMetadataFactory();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
index 5fe92d60e0491..3be1ef8eefcb1 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector\Util;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
/**
@@ -19,12 +20,14 @@
*/
class ValueExporterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ValueExporter
*/
private $valueExporter;
- protected function setUp()
+ private function doSetUp()
{
$this->valueExporter = new ValueExporter();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php
index 86f1abdb05292..a1c07a765a2ce 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php
@@ -12,13 +12,16 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService;
use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService;
class ServicesResetterTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
ResettableService::$counter = 0;
ClearableService::$counter = 0;
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
index 4ab0a8fb1ea62..3e93a24845248 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
use Symfony\Component\HttpKernel\KernelEvents;
@@ -23,17 +24,19 @@
*/
class AddRequestFormatsListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var AddRequestFormatsListener
*/
private $listener;
- protected function setUp()
+ private function doSetUp()
{
$this->listener = new AddRequestFormatsListener(['csv' => ['text/csv', 'text/plain']]);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->listener = null;
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
index 5f96f7f7c660b..0c0948d9a8c34 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\LocaleListener;
@@ -19,9 +20,11 @@
class LocaleListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $requestStack;
- protected function setUp()
+ private function doSetUp()
{
$this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
index aeab68f3e9155..aa5f5ec2ccb7c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -22,11 +23,13 @@
class ResponseListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $dispatcher;
private $kernel;
- protected function setUp()
+ private function doSetUp()
{
$this->dispatcher = new EventDispatcher();
$listener = new ResponseListener('UTF-8');
@@ -35,7 +38,7 @@ protected function setUp()
$this->kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->dispatcher = null;
$this->kernel = null;
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
index 33f6ab9594a96..94d7757f614f1 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -29,9 +30,11 @@
class RouterListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $requestStack;
- protected function setUp()
+ private function doSetUp()
{
$this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
index 7187c7d1f6251..ea321ad5ca5a5 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -31,6 +32,8 @@
*/
class TestSessionListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var TestSessionListener
*/
@@ -41,7 +44,7 @@ class TestSessionListenerTest extends TestCase
*/
private $session;
- protected function setUp()
+ private function doSetUp()
{
$this->listener = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener');
$this->session = $this->getSession();
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
index 77c2c1c694529..038209ed10771 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -20,11 +21,13 @@
class TranslatorListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $listener;
private $translator;
private $requestStack;
- protected function setUp()
+ private function doSetUp()
{
$this->translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock();
$this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
index fb7a4379bfa49..709c601713855 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -21,7 +22,9 @@
class ValidateRequestListenerTest extends TestCase
{
- protected function tearDown()
+ use ForwardCompatTestTrait;
+
+ private function doTearDown()
{
Request::setTrustedProxies([], -1);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
index 06ce785ea6094..b66041bcd23e7 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
@@ -21,9 +22,11 @@
*/
class FragmentHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $requestStack;
- protected function setUp()
+ private function doSetUp()
{
$this->requestStack = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
->disableOriginalConstructor()
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
index 1eb461744726e..831d3f8f2e757 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpCache\Esi;
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
@@ -20,6 +21,8 @@
class HttpCacheTestCase extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $kernel;
protected $cache;
protected $caches;
@@ -35,7 +38,7 @@ class HttpCacheTestCase extends TestCase
*/
protected $store;
- protected function setUp()
+ private function doSetUp()
{
$this->kernel = null;
@@ -53,7 +56,7 @@ protected function setUp()
$this->clearDirectory(sys_get_temp_dir().'/http_cache');
}
- protected function tearDown()
+ private function doTearDown()
{
if ($this->cache) {
$this->cache->getStore()->cleanup();
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
index fc47ff2c88c56..a4c03abd62896 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Store;
class StoreTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $request;
protected $response;
@@ -26,7 +29,7 @@ class StoreTest extends TestCase
*/
protected $store;
- protected function setUp()
+ private function doSetUp()
{
$this->request = Request::create('/');
$this->response = new Response('hello world', 200, []);
@@ -36,7 +39,7 @@ protected function setUp()
$this->store = new Store(sys_get_temp_dir().'/http_cache');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->store = null;
$this->request = null;
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php
index 67b637bfe3d05..316b269f189e8 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\SubRequestHandler;
@@ -19,14 +20,16 @@
class SubRequestHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $globalState;
- protected function setUp()
+ private function doSetUp()
{
self::$globalState = $this->getGlobalState();
}
- protected function tearDown()
+ private function doTearDown()
{
Request::setTrustedProxies(self::$globalState[0], self::$globalState[1]);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
index 04d74ae0a3199..2682905eedc3b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -31,7 +32,9 @@
class KernelTest extends TestCase
{
- public static function tearDownAfterClass()
+ use ForwardCompatTestTrait;
+
+ private static function doTearDownAfterClass()
{
$fs = new Filesystem();
$fs->remove(__DIR__.'/Fixtures/cache');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
index 3a5a8ade54156..26e9a99abdbe6 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
@@ -14,6 +14,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Log\Logger;
/**
@@ -22,6 +23,8 @@
*/
class LoggerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var LoggerInterface
*/
@@ -32,13 +35,13 @@ class LoggerTest extends TestCase
*/
private $tmpFile;
- protected function setUp()
+ private function doSetUp()
{
$this->tmpFile = tempnam(sys_get_temp_dir(), 'log');
$this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile);
}
- protected function tearDown()
+ private function doTearDown()
{
if (!@unlink($this->tmpFile)) {
file_put_contents($this->tmpFile, '');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
index 1cc05e41ec854..5303cb246c4da 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\HttpKernel\Tests\Profiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage;
use Symfony\Component\HttpKernel\Profiler\Profile;
class FileProfilerStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $tmpDir;
private $storage;
- protected function setUp()
+ private function doSetUp()
{
$this->tmpDir = sys_get_temp_dir().'/sf2_profiler_file_storage';
if (is_dir($this->tmpDir)) {
@@ -30,7 +33,7 @@ protected function setUp()
$this->storage->purge();
}
- protected function tearDown()
+ private function doTearDown()
{
self::cleanDir();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php
index 8f12e013a4533..8c1e51d92d970 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Profiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
@@ -21,6 +22,8 @@
class ProfilerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $tmp;
private $storage;
@@ -82,7 +85,7 @@ public function testFindWorksWithStatusCode()
$this->assertCount(0, $profiler->find(null, null, null, null, null, null, '204'));
}
- protected function setUp()
+ private function doSetUp()
{
$this->tmp = tempnam(sys_get_temp_dir(), 'sf2_profiler');
if (file_exists($this->tmp)) {
@@ -93,7 +96,7 @@ protected function setUp()
$this->storage->purge();
}
- protected function tearDown()
+ private function doTearDown()
{
if (null !== $this->storage) {
$this->storage->purge();
diff --git a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
index 378463cac854e..662fad7645752 100644
--- a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
+++ b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Collator\Verification;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\Collator\AbstractCollatorTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -22,7 +23,9 @@
*/
class CollatorTest extends AbstractCollatorTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
IntlTestHelper::requireFullIntl($this, false);
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 3357b039ea814..02f9830de4a47 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Exception\ResourceBundleNotFoundException;
@@ -20,6 +21,8 @@
*/
class BundleEntryReaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const RES_DIR = '/res/dir';
/**
@@ -61,7 +64,7 @@ class BundleEntryReaderTest extends TestCase
'Foo' => 'Bar',
];
- protected function setUp()
+ private function doSetUp()
{
$this->readerImpl = $this->getMockBuilder('Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface')->getMock();
$this->reader = new BundleEntryReader($this->readerImpl);
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 8b7cc1a7580b5..bf149d39d3810 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader;
/**
@@ -20,12 +21,14 @@
*/
class IntlBundleReaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var IntlBundleReader
*/
private $reader;
- protected function setUp()
+ private function doSetUp()
{
$this->reader = new IntlBundleReader();
}
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 dd0cf9cd872cd..a40f4dce56868 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\JsonBundleReader;
/**
@@ -19,12 +20,14 @@
*/
class JsonBundleReaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var JsonBundleReader
*/
private $reader;
- protected function setUp()
+ private function doSetUp()
{
$this->reader = new JsonBundleReader();
}
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 f6adae9b7de00..651fea0116e47 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\PhpBundleReader;
/**
@@ -19,12 +20,14 @@
*/
class PhpBundleReaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PhpBundleReader
*/
private $reader;
- protected function setUp()
+ private function doSetUp()
{
$this->reader = new PhpBundleReader();
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
index f56bc84385d8f..1b99e5004b2cb 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Writer\JsonBundleWriter;
@@ -20,6 +21,8 @@
*/
class JsonBundleWriterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var JsonBundleWriter
*/
@@ -32,7 +35,7 @@ class JsonBundleWriterTest extends TestCase
*/
private $filesystem;
- protected function setUp()
+ private function doSetUp()
{
$this->writer = new JsonBundleWriter();
$this->directory = sys_get_temp_dir().'/JsonBundleWriterTest/'.mt_rand(1000, 9999);
@@ -41,7 +44,7 @@ protected function setUp()
$this->filesystem->mkdir($this->directory);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php
index 8010f9574a027..e2e12a7d710eb 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Writer\PhpBundleWriter;
@@ -20,6 +21,8 @@
*/
class PhpBundleWriterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PhpBundleWriter
*/
@@ -32,7 +35,7 @@ class PhpBundleWriterTest extends TestCase
*/
private $filesystem;
- protected function setUp()
+ private function doSetUp()
{
$this->writer = new PhpBundleWriter();
$this->directory = sys_get_temp_dir().'/PhpBundleWriterTest/'.mt_rand(1000, 9999);
@@ -41,7 +44,7 @@ protected function setUp()
$this->filesystem->mkdir($this->directory);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php
index 2c0e70e019acf..369206db2b076 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Writer\TextBundleWriter;
@@ -22,6 +23,8 @@
*/
class TextBundleWriterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var TextBundleWriter
*/
@@ -34,7 +37,7 @@ class TextBundleWriterTest extends TestCase
*/
private $filesystem;
- protected function setUp()
+ private function doSetUp()
{
$this->writer = new TextBundleWriter();
$this->directory = sys_get_temp_dir().'/TextBundleWriterTest/'.mt_rand(1000, 9999);
@@ -43,7 +46,7 @@ protected function setUp()
$this->filesystem->mkdir($this->directory);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
index 4c566aed3cde4..9e9067cb845ed 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\CurrencyDataProvider;
use Symfony\Component\Intl\Intl;
@@ -19,6 +20,8 @@
*/
abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
{
+ use ForwardCompatTestTrait;
+
// The below arrays document the state of the ICU data bundled with this package.
protected static $currencies = [
@@ -590,7 +593,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php
index 562f8386d1c9e..fb4d31ef3815a 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
use Symfony\Component\Intl\Locale;
@@ -21,6 +22,8 @@
*/
abstract class AbstractDataProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
// Include the locales statically so that the data providers are decoupled
// from the Intl class. Otherwise tests will fail if the intl extension is
// not loaded, because it is NOT possible to skip the execution of data
@@ -701,7 +704,7 @@ abstract class AbstractDataProviderTest extends TestCase
private static $rootLocales;
- protected function setUp()
+ private function doSetUp()
{
\Locale::setDefault('en');
Locale::setDefaultFallback('en');
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
index 2b55349584a62..0eda13fe4bd6a 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\LanguageDataProvider;
use Symfony\Component\Intl\Intl;
@@ -19,6 +20,8 @@
*/
abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
{
+ use ForwardCompatTestTrait;
+
// The below arrays document the state of the ICU data bundled with this package.
protected static $languages = [
@@ -832,7 +835,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
index 88242a6f9bcb3..0f7e2924c54bc 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\LocaleDataProvider;
use Symfony\Component\Intl\Intl;
@@ -19,12 +20,14 @@
*/
abstract class AbstractLocaleDataProviderTest extends AbstractDataProviderTest
{
+ use ForwardCompatTestTrait;
+
/**
* @var LocaleDataProvider
*/
protected $dataProvider;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
index aeb922f9e3e5f..170e7f3d19186 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\RegionDataProvider;
use Symfony\Component\Intl\Intl;
@@ -19,6 +20,8 @@
*/
abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
{
+ use ForwardCompatTestTrait;
+
// The below arrays document the state of the ICU data bundled with this package.
protected static $territories = [
@@ -284,7 +287,7 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
index 8620fb2060fbc..e1ff85b4f4374 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\ScriptDataProvider;
use Symfony\Component\Intl\Intl;
@@ -20,6 +21,8 @@
*/
abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
{
+ use ForwardCompatTestTrait;
+
// The below arrays document the state of the ICU data bundled with this package.
protected static $scripts = [
@@ -220,7 +223,7 @@ abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php
index 23f312b7bf16d..b5841cef071f0 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Util;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Util\LocaleScanner;
@@ -20,6 +21,8 @@
*/
class LocaleScannerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $directory;
/**
@@ -32,7 +35,7 @@ class LocaleScannerTest extends TestCase
*/
private $scanner;
- protected function setUp()
+ private function doSetUp()
{
$this->directory = sys_get_temp_dir().'/LocaleScannerTest/'.mt_rand(1000, 9999);
$this->filesystem = new Filesystem();
@@ -56,7 +59,7 @@ protected function setUp()
file_put_contents($this->directory.'/fr_alias.txt', 'fr_alias{"%%ALIAS"{"fr"}}');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
index f13bf36c96d19..425c0bba04f70 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Data\Util;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Util\RingBuffer;
/**
@@ -19,12 +20,14 @@
*/
class RingBufferTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var RingBuffer
*/
private $buffer;
- protected function setUp()
+ private function doSetUp()
{
$this->buffer = new RingBuffer(2);
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
index e472000974a6f..3ac53b7a3cfd4 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\DateFormatter;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\Intl;
@@ -24,7 +25,9 @@
*/
abstract class AbstractIntlDateFormatterTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
\Locale::setDefault('en');
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
index 8d5912ca6c9e3..a94e317be8af7 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\DateFormatter\Verification;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
use Symfony\Component\Intl\Tests\DateFormatter\AbstractIntlDateFormatterTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -23,7 +24,9 @@
*/
class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
index b5cd1c13c32ff..c6c2097349531 100644
--- a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
+++ b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Globals\Verification;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\Globals\AbstractIntlGlobalsTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -22,7 +23,9 @@
*/
class IntlGlobalsTest extends AbstractIntlGlobalsTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
index 13f2c4f5e285b..b09adb27a197e 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Locale\Verification;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\Locale\AbstractLocaleTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -22,7 +23,9 @@
*/
class LocaleTest extends AbstractLocaleTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
index 2e1e9e5bb60b4..38dd258fa15e5 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter\Verification;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\NumberFormatter\AbstractNumberFormatterTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -20,7 +21,9 @@
*/
class NumberFormatterTest extends AbstractNumberFormatterTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
IntlTestHelper::requireFullIntl($this, '55.1');
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
index d9ff58fe8f5b7..547789aaa94dc 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Ldap\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
use Symfony\Component\Ldap\Entry;
@@ -22,10 +23,12 @@
*/
class LdapManagerTest extends LdapTestCase
{
+ use ForwardCompatTestTrait;
+
/** @var Adapter */
private $adapter;
- protected function setUp()
+ private function doSetUp()
{
$this->adapter = new Adapter($this->getLdapConfig());
$this->adapter->getConnection()->bind('cn=admin,dc=symfony,dc=com', 'symfony');
diff --git a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
index 95373e92b14e7..0fd34061d90e9 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Ldap\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -22,12 +23,14 @@
*/
class LdapClientTest extends LdapTestCase
{
+ use ForwardCompatTestTrait;
+
/** @var LdapClient */
private $client;
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $ldap;
- protected function setUp()
+ private function doSetUp()
{
$this->ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php
index 0d6961c267ac1..f25593d8f75ec 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Ldap\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\AdapterInterface;
use Symfony\Component\Ldap\Adapter\ConnectionInterface;
use Symfony\Component\Ldap\Exception\DriverNotFoundException;
@@ -19,13 +20,15 @@
class LdapTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $adapter;
/** @var Ldap */
private $ldap;
- protected function setUp()
+ private function doSetUp()
{
$this->adapter = $this->getMockBuilder(AdapterInterface::class)->getMock();
$this->ldap = new Ldap($this->adapter);
diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
index bcfc40b1bc266..688620b677d46 100644
--- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Store\CombinedStore;
@@ -24,6 +25,7 @@
*/
class CombinedStoreTest extends AbstractStoreTest
{
+ use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;
/**
@@ -58,7 +60,7 @@ public function getStore()
/** @var CombinedStore */
private $store;
- protected function setUp()
+ private function doSetUp()
{
$this->strategy = $this->getMockBuilder(StrategyInterface::class)->getMock();
$this->store1 = $this->getMockBuilder(StoreInterface::class)->getMock();
diff --git a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
index f4ab571f567a6..592d9c4f5d989 100644
--- a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Store\MemcachedStore;
/**
@@ -20,9 +21,10 @@
*/
class MemcachedStoreTest extends AbstractStoreTest
{
+ use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;
- public static function setupBeforeClass()
+ private static function doSetUpBeforeClass()
{
$memcached = new \Memcached();
$memcached->addServer(getenv('MEMCACHED_HOST'), 11211);
diff --git a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
index 621affecb5435..1d5f50e179c17 100644
--- a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
@@ -11,12 +11,16 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* @author Jérémy Derussé
*/
class PredisStoreTest extends AbstractRedisStoreTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
$redis = new \Predis\Client('tcp://'.getenv('REDIS_HOST').':6379');
try {
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
index 7d915615a7a59..eae72f5fbaf6c 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* @author Jérémy Derussé
*
@@ -18,7 +20,9 @@
*/
class RedisArrayStoreTest extends AbstractRedisStoreTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!class_exists('RedisArray')) {
self::markTestSkipped('The RedisArray class is required.');
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
index 2ee17888eb6d3..b495acfb775d7 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* @author Jérémy Derussé
*
@@ -18,7 +20,9 @@
*/
class RedisClusterStoreTest extends AbstractRedisStoreTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
index 6c7d244107b6d..e48734b43e043 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* @author Jérémy Derussé
*
@@ -18,7 +20,9 @@
*/
class RedisStoreTest extends AbstractRedisStoreTest
{
- public static function setupBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) {
$e = error_get_last();
diff --git a/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php b/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php
index 8034cfe7cf900..da2a74e178dd6 100644
--- a/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php
+++ b/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Lock\Tests\Strategy;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Strategy\ConsensusStrategy;
/**
@@ -19,10 +20,12 @@
*/
class ConsensusStrategyTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var ConsensusStrategy */
private $strategy;
- protected function setUp()
+ private function doSetUp()
{
$this->strategy = new ConsensusStrategy();
}
diff --git a/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php b/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php
index a07b42ddf52fb..44d927d40ab17 100644
--- a/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php
+++ b/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Lock\Tests\Strategy;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Strategy\UnanimousStrategy;
/**
@@ -19,10 +20,12 @@
*/
class UnanimousStrategyTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var UnanimousStrategy */
private $strategy;
- protected function setUp()
+ private function doSetUp()
{
$this->strategy = new UnanimousStrategy();
}
diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
index d85bbe8fd8485..259128ebd7ea9 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
@@ -13,18 +13,21 @@
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OptionsResolverTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var OptionsResolver
*/
private $resolver;
- protected function setUp()
+ private function doSetUp()
{
$this->resolver = new OptionsResolver();
}
diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
index a437f2bb6f771..39dde41f08518 100644
--- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
+++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\ExecutableFinder;
/**
@@ -19,9 +20,11 @@
*/
class ExecutableFinderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $path;
- protected function tearDown()
+ private function doTearDown()
{
if ($this->path) {
// Restore path if it was changed.
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 18fef4ff5ff17..8ac17b2c8f492 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\Exception\LogicException;
use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Symfony\Component\Process\Exception\RuntimeException;
@@ -25,12 +26,14 @@
*/
class ProcessTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $phpBin;
private static $process;
private static $sigchild;
private static $notEnhancedSigchild = false;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
$phpBin = new PhpExecutableFinder();
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());
@@ -40,7 +43,7 @@ public static function setUpBeforeClass()
self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
}
- protected function tearDown()
+ private function doTearDown()
{
if (self::$process) {
self::$process->stop(0);
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
index 3c007fde9343e..5749cfae6fc0d 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
@@ -12,17 +12,20 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessor;
abstract class PropertyAccessorArrayAccessTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PropertyAccessor
*/
protected $propertyAccessor;
- protected function setUp()
+ private function doSetUp()
{
$this->propertyAccessor = new PropertyAccessor();
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php
index 63bd64225039a..50660b8c46a85 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php
@@ -12,23 +12,26 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\PropertyAccessorBuilder;
class PropertyAccessorBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PropertyAccessorBuilder
*/
protected $builder;
- protected function setUp()
+ private function doSetUp()
{
$this->builder = new PropertyAccessorBuilder();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->builder = null;
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
index 9219d7167b3d0..b92e62c629975 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
use Symfony\Component\PropertyAccess\PropertyAccessor;
@@ -28,12 +29,14 @@
class PropertyAccessorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PropertyAccessor
*/
private $propertyAccessor;
- protected function setUp()
+ private function doSetUp()
{
$this->propertyAccessor = new PropertyAccessor();
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
index 3c02f4ded82eb..fcc400b8c527f 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyAccess\PropertyPath;
use Symfony\Component\PropertyAccess\PropertyPathBuilder;
@@ -20,6 +21,8 @@
*/
class PropertyPathBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const PREFIX = 'old1[old2].old3[old4][old5].old6';
/**
@@ -27,7 +30,7 @@ class PropertyPathBuilderTest extends TestCase
*/
private $builder;
- protected function setUp()
+ private function doSetUp()
{
$this->builder = new PropertyPathBuilder(new PropertyPath(self::PREFIX));
}
diff --git a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
index f0897d71c7167..2f9f596510cfc 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\PropertyInfo\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
@@ -22,12 +23,14 @@
*/
class AbstractPropertyInfoExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PropertyInfoExtractor
*/
protected $propertyInfo;
- protected function setUp()
+ private function doSetUp()
{
$extractors = [new NullExtractor(), new DummyExtractor()];
$this->propertyInfo = new PropertyInfoExtractor($extractors, $extractors, $extractors, $extractors);
diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
index f4f9e9dc77e29..4d7bb8d968e3a 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\PropertyInfo\Tests\PhpDocExtractor;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Type;
@@ -20,12 +21,14 @@
*/
class PhpDocExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PhpDocExtractor
*/
private $extractor;
- protected function setUp()
+ private function doSetUp()
{
$this->extractor = new PhpDocExtractor();
}
diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
index 0ed5390bb5882..715221dab4b21 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\PropertyInfo\Tests\Extractor;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\AdderRemoverDummy;
use Symfony\Component\PropertyInfo\Type;
@@ -21,12 +22,14 @@
*/
class ReflectionExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ReflectionExtractor
*/
private $extractor;
- protected function setUp()
+ private function doSetUp()
{
$this->extractor = new ReflectionExtractor();
}
diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php
index 791398e3f2658..a8bce835c3b23 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\SerializerExtractor;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
@@ -22,12 +23,14 @@
*/
class SerializerExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var SerializerExtractor
*/
private $extractor;
- protected function setUp()
+ private function doSetUp()
{
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$this->extractor = new SerializerExtractor($classMetadataFactory);
diff --git a/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php
index d31a7bd51ddde..359d06ccecbc7 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\PropertyInfo\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyInfo\PropertyInfoCacheExtractor;
@@ -19,7 +20,9 @@
*/
class PropertyInfoCacheExtractorTest extends AbstractPropertyInfoExtractorTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
index a6a47b4ba2fd0..13aba1325222f 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Tests\Generator\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
@@ -20,6 +21,8 @@
class PhpGeneratorDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var RouteCollection
*/
@@ -40,7 +43,7 @@ class PhpGeneratorDumperTest extends TestCase
*/
private $largeTestTmpFilepath;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -52,7 +55,7 @@ protected function setUp()
@unlink($this->largeTestTmpFilepath);
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
index 7726dc6fa89f1..d84de3ac5a4fe 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -11,14 +11,17 @@
namespace Symfony\Component\Routing\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Annotation\Route;
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
{
+ use ForwardCompatTestTrait;
+
protected $loader;
private $reader;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
index df96a679e40f9..e9e56043b28a6 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
@@ -11,15 +11,18 @@
namespace Symfony\Component\Routing\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
{
+ use ForwardCompatTestTrait;
+
protected $loader;
protected $reader;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
index 066b7c45f54e3..109d47096e6d3 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
@@ -11,16 +11,19 @@
namespace Symfony\Component\Routing\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
{
+ use ForwardCompatTestTrait;
+
protected $loader;
protected $reader;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php
index 2657751b38cda..ce31fc3559631 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Routing\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
@@ -20,10 +21,12 @@
class DirectoryLoaderTest extends AbstractAnnotationLoaderTest
{
+ use ForwardCompatTestTrait;
+
private $loader;
private $reader;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index 2816567c1eea8..c5b79c09ff6d0 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -21,6 +22,8 @@
class PhpMatcherDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var string
*/
@@ -31,7 +34,7 @@ class PhpMatcherDumperTest extends TestCase
*/
private $dumpPath;
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -39,7 +42,7 @@ protected function setUp()
$this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Routing/Tests/RouterTest.php b/src/Symfony/Component/Routing/Tests/RouterTest.php
index 0f46e5317b68c..7f42fd5ef5c40 100644
--- a/src/Symfony/Component/Routing/Tests/RouterTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouterTest.php
@@ -12,17 +12,20 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Router;
class RouterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $router = null;
private $loader = null;
- protected function setUp()
+ private function doSetUp()
{
$this->loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
$this->router = new Router($this->loader, 'routing.yml');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
index b4986b0177863..a26252df29bb4 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
@@ -12,17 +12,20 @@
namespace Symfony\Component\Security\Core\Tests\Authorization;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;
class AuthorizationCheckerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $authenticationManager;
private $accessDecisionManager;
private $authorizationChecker;
private $tokenStorage;
- protected function setUp()
+ private function doSetUp()
{
$this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
$this->accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
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 50dc84e435a90..a6e5a6c08c917 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\Security\Core\Tests\Authorization\Voter;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
class VoterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $token;
- protected function setUp()
+ private function doSetUp()
{
$this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
index 70f2142ec39df..cf21eb61dbe19 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder;
/**
@@ -19,9 +20,11 @@
*/
class Argon2iPasswordEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const PASSWORD = 'password';
- protected function setUp()
+ private function doSetUp()
{
if (!Argon2iPasswordEncoder::isSupported()) {
$this->markTestSkipped('Argon2i algorithm is not supported.');
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 305b665ea32c9..131b7f3b1fe48 100644
--- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Core\Tests\Validator\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
@@ -23,6 +24,8 @@
*/
abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
const PASSWORD = 's3Cr3t';
const SALT = '^S4lt$';
@@ -46,7 +49,7 @@ protected function createValidator()
return new UserPasswordValidator($this->tokenStorage, $this->encoderFactory);
}
- protected function setUp()
+ private function doSetUp()
{
$user = $this->createUser();
$this->tokenStorage = $this->createTokenStorage($user);
diff --git a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
index 631c36a0db0ac..28998bbdee9d2 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Csrf\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Csrf\CsrfToken;
@@ -22,6 +23,8 @@
*/
class CsrfTokenManagerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getManagerGeneratorAndStorage
*/
@@ -210,12 +213,12 @@ private function getGeneratorAndStorage()
];
}
- protected function setUp()
+ private function doSetUp()
{
$_SERVER['HTTPS'] = 'on';
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php
index 07f85c221432d..039ccbfe6acc4 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Csrf\Tests\TokenGenerator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator;
/**
@@ -19,6 +20,8 @@
*/
class UriSafeTokenGeneratorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const ENTROPY = 1000;
/**
@@ -33,17 +36,17 @@ class UriSafeTokenGeneratorTest extends TestCase
*/
private $generator;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$bytes = base64_decode('aMf+Tct/RLn2WQ==');
}
- protected function setUp()
+ private function doSetUp()
{
$this->generator = new UriSafeTokenGenerator(self::ENTROPY);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->generator = null;
}
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
index 86fb6e6b9cac6..ac4c19b895022 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Csrf\Tests\TokenStorage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage;
/**
@@ -22,6 +23,8 @@
*/
class NativeSessionTokenStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const SESSION_NAMESPACE = 'foobar';
/**
@@ -29,7 +32,7 @@ class NativeSessionTokenStorageTest extends TestCase
*/
private $storage;
- protected function setUp()
+ private function doSetUp()
{
$_SESSION = [];
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
index 7539852f13f3f..d90278b16a796 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Csrf\Tests\TokenStorage;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
@@ -21,6 +22,8 @@
*/
class SessionTokenStorageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const SESSION_NAMESPACE = 'foobar';
/**
@@ -33,7 +36,7 @@ class SessionTokenStorageTest extends TestCase
*/
private $storage;
- protected function setUp()
+ private function doSetUp()
{
$this->session = new Session(new MockArraySessionStorage());
$this->storage = new SessionTokenStorage($this->session, self::SESSION_NAMESPACE);
diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
index c3983287fc42b..2a64e61286627 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Guard\Tests\Authenticator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
@@ -23,6 +24,8 @@
*/
class FormLoginAuthenticatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $requestWithoutSession;
private $requestWithSession;
private $authenticator;
@@ -127,7 +130,7 @@ public function testStartWithSession()
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
- protected function setUp()
+ private function doSetUp()
{
$this->requestWithoutSession = new Request([], [], [], [], [], []);
$this->requestWithSession = new Request([], [], [], [], [], []);
diff --git a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
index 7e4d2929b6388..7decb4072eb68 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Guard\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -28,6 +29,8 @@
*/
class GuardAuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $authenticationManager;
private $guardAuthenticatorHandler;
private $event;
@@ -420,7 +423,7 @@ public function testReturnNullFromGetCredentialsTriggersForAbstractGuardAuthenti
$listener->handle($this->event);
}
- protected function setUp()
+ private function doSetUp()
{
$this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager')
->disableOriginalConstructor()
@@ -445,7 +448,7 @@ protected function setUp()
$this->rememberMeServices = $this->getMockBuilder('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface')->getMock();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->authenticationManager = null;
$this->guardAuthenticatorHandler = null;
diff --git a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
index 3bf204ec7f5c0..4fc75933c70e4 100644
--- a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Guard\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@@ -22,6 +23,8 @@
class GuardAuthenticatorHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $tokenStorage;
private $dispatcher;
private $token;
@@ -156,7 +159,7 @@ public function testSessionStrategyIsNotCalledWhenStateless()
$handler->authenticateWithToken($this->token, $this->request, 'some_provider_key');
}
- protected function setUp()
+ private function doSetUp()
{
$this->tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
@@ -166,7 +169,7 @@ protected function setUp()
$this->guardAuthenticator = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->tokenStorage = null;
$this->dispatcher = null;
diff --git a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
index 26f830e500d4c..cb3cb3d221bf1 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Guard\Tests\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Guard\AuthenticatorInterface;
@@ -24,6 +25,8 @@
*/
class GuardAuthenticationProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $userProvider;
private $userChecker;
private $preAuthenticationToken;
@@ -233,7 +236,7 @@ public function testAuthenticateFailsOnNonOriginatingToken()
$provider->authenticate($token);
}
- protected function setUp()
+ private function doSetUp()
{
$this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
$this->userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
@@ -242,7 +245,7 @@ protected function setUp()
->getMock();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->userProvider = null;
$this->userChecker = null;
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
index a71ad179a3551..348f5d2c93cdd 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Authentication;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Security;
@@ -19,6 +20,8 @@
class DefaultAuthenticationFailureHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $httpKernel;
private $httpUtils;
private $logger;
@@ -26,7 +29,7 @@ class DefaultAuthenticationFailureHandlerTest extends TestCase
private $session;
private $exception;
- protected function setUp()
+ private function doSetUp()
{
$this->httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
$this->httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
index 70923ae31806e..7a3ce94fcc209 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@@ -21,6 +22,8 @@
class SimpleAuthenticationHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $successHandler;
private $failureHandler;
@@ -33,7 +36,7 @@ class SimpleAuthenticationHandlerTest extends TestCase
private $response;
- protected function setUp()
+ private function doSetUp()
{
$this->successHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface')->getMock();
$this->failureHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php
index 185055efceb68..229c9f2768157 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Http\Firewall\DigestData;
/**
@@ -19,6 +20,8 @@
*/
class DigestDataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetResponse()
{
$digestAuth = new DigestData(
@@ -163,7 +166,7 @@ public function testIsNonceExpired()
$this->assertFalse($digestAuth->isNonceExpired());
}
- protected function setUp()
+ private function doSetUp()
{
class_exists('Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener', true);
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
index 1584b66ecee44..74b59615d6203 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
@@ -20,6 +21,8 @@
class SimplePreAuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $authenticationManager;
private $dispatcher;
private $event;
@@ -93,7 +96,7 @@ public function testHandlecatchAuthenticationException()
$listener->handle($this->event);
}
- protected function setUp()
+ private function doSetUp()
{
$this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager')
->disableOriginalConstructor()
@@ -116,7 +119,7 @@ protected function setUp()
$this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->authenticationManager = null;
$this->dispatcher = null;
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
index 2d22a91d6bdeb..6db9950fdf4e3 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -25,6 +26,8 @@
class SwitchUserListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $tokenStorage;
private $userProvider;
@@ -37,7 +40,7 @@ class SwitchUserListenerTest extends TestCase
private $event;
- protected function setUp()
+ private function doSetUp()
{
$this->tokenStorage = new TokenStorage();
$this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
index fe34eaa6e5da3..d51cc44833e8a 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Logout;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -21,11 +22,13 @@
class CsrfTokenClearingLogoutHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $session;
private $csrfTokenStorage;
private $csrfTokenClearingLogoutHandler;
- protected function setUp()
+ private function doSetUp()
{
$this->session = new Session(new MockArraySessionStorage());
$this->csrfTokenStorage = new SessionTokenStorage($this->session, 'foo');
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
index 727dde0f81b30..cdade5e870cf4 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Logout;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
@@ -25,12 +26,14 @@
*/
class LogoutUrlGeneratorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var TokenStorage */
private $tokenStorage;
/** @var LogoutUrlGenerator */
private $generator;
- protected function setUp()
+ private function doSetUp()
{
$requestStack = $this->getMockBuilder(RequestStack::class)->getMock();
$request = $this->getMockBuilder(Request::class)->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
index 599a7e81c303b..3764afec426d3 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\RememberMe;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
@@ -24,7 +25,9 @@
class PersistentTokenBasedRememberMeServicesTest extends TestCase
{
- public static function setUpBeforeClass()
+ use ForwardCompatTestTrait;
+
+ private static function doSetUpBeforeClass()
{
try {
random_bytes(1);
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
index 22b86758a590a..ecb37f2300843 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\ChainDecoder;
class ChainDecoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const FORMAT_1 = 'format1';
const FORMAT_2 = 'format2';
const FORMAT_3 = 'format3';
@@ -24,7 +27,7 @@ class ChainDecoderTest extends TestCase
private $decoder1;
private $decoder2;
- protected function setUp()
+ private function doSetUp()
{
$this->decoder1 = $this
->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface')
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
index d9b6251ed93c3..2a0f85d04a981 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\ChainEncoder;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;
class ChainEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const FORMAT_1 = 'format1';
const FORMAT_2 = 'format2';
const FORMAT_3 = 'format3';
@@ -26,7 +29,7 @@ class ChainEncoderTest extends TestCase
private $encoder1;
private $encoder2;
- protected function setUp()
+ private function doSetUp()
{
$this->encoder1 = $this
->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface')
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php
index 7b5131cb533a6..d6969d6f5dde6 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
/**
@@ -19,12 +20,14 @@
*/
class CsvEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var CsvEncoder
*/
private $encoder;
- protected function setUp()
+ private function doSetUp()
{
$this->encoder = new CsvEncoder();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
index 76a1b6324631c..2d9550d26fe36 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
@@ -12,15 +12,18 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonDecode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
class JsonDecodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var \Symfony\Component\Serializer\Encoder\JsonDecode */
private $decode;
- protected function setUp()
+ private function doSetUp()
{
$this->decode = new JsonDecode();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
index 42a460e520400..e7c6a4f39bb71 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
@@ -12,14 +12,17 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
class JsonEncodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $encoder;
- protected function setUp()
+ private function doSetUp()
{
$this->encode = new JsonEncode();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
index 439fbda1638a3..0080112baad85 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer;
class JsonEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $encoder;
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->encoder = new JsonEncoder();
$this->serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]);
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
index 573605c1ab092..e72dab9b9edf0 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -22,6 +23,8 @@
class XmlEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var XmlEncoder
*/
@@ -29,7 +32,7 @@ class XmlEncoderTest extends TestCase
private $exampleDateTimeString = '2017-02-19T15:16:08+0300';
- protected function setUp()
+ private function doSetUp()
{
$this->encoder = new XmlEncoder();
$serializer = new Serializer([new CustomNormalizer()], ['xml' => new XmlEncoder()]);
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
index b2e5c69211227..ee07e929ee998 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
@@ -22,12 +23,14 @@
*/
class AnnotationLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var AnnotationLoader
*/
private $loader;
- protected function setUp()
+ private function doSetUp()
{
$this->loader = new AnnotationLoader(new AnnotationReader());
}
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
index 264f37fc42d97..b142ac08eceb6 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
@@ -21,6 +22,8 @@
*/
class XmlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var XmlFileLoader
*/
@@ -30,7 +33,7 @@ class XmlFileLoaderTest extends TestCase
*/
private $metadata;
- protected function setUp()
+ private function doSetUp()
{
$this->loader = new XmlFileLoader(__DIR__.'/../../Fixtures/serialization.xml');
$this->metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
index 1bf5586baffa7..8d07809386fea 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
@@ -21,6 +22,8 @@
*/
class YamlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var YamlFileLoader
*/
@@ -30,7 +33,7 @@ class YamlFileLoaderTest extends TestCase
*/
private $metadata;
- protected function setUp()
+ private function doSetUp()
{
$this->loader = new YamlFileLoader(__DIR__.'/../../Fixtures/serialization.yml');
$this->metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
index cce383075a6fe..b0991c17d018c 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -25,6 +26,8 @@
*/
class AbstractNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var AbstractNormalizerDummy
*/
@@ -35,7 +38,7 @@ class AbstractNormalizerTest extends TestCase
*/
private $classMetadata;
- protected function setUp()
+ private function doSetUp()
{
$loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs([[]])->getMock();
$this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs([$loader])->getMock();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
index 132f3c0806350..efe18b24f5368 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\SerializerInterface;
class ArrayDenormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ArrayDenormalizer
*/
@@ -27,7 +30,7 @@ class ArrayDenormalizerTest extends TestCase
*/
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')->getMock();
$this->denormalizer = new ArrayDenormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
index 28fb73ece5bcd..3a20f800b0410 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy;
class CustomNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var CustomNormalizer
*/
private $normalizer;
- protected function setUp()
+ private function doSetUp()
{
$this->normalizer = new CustomNormalizer();
$this->normalizer->setSerializer(new Serializer());
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
index e1f714b55c1e9..ba252106a4eab 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
@@ -20,6 +21,8 @@
*/
class DataUriNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const TEST_GIF_DATA = 'data:image/gif;base64,R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=';
const TEST_TXT_DATA = 'data:text/plain,K%C3%A9vin%20Dunglas%0A';
const TEST_TXT_CONTENT = "Kévin Dunglas\n";
@@ -29,7 +32,7 @@ class DataUriNormalizerTest extends TestCase
*/
private $normalizer;
- protected function setUp()
+ private function doSetUp()
{
$this->normalizer = new DataUriNormalizer();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
index b092c779a8cf8..0352bb87cf1a5 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
/**
@@ -10,12 +11,14 @@
*/
class DateIntervalNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var DateIntervalNormalizer
*/
private $normalizer;
- protected function setUp()
+ private function doSetUp()
{
$this->normalizer = new DateIntervalNormalizer();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
index 5ff41c80337a5..33463f49346d2 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
/**
@@ -19,12 +20,14 @@
*/
class DateTimeNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var DateTimeNormalizer
*/
private $normalizer;
- protected function setUp()
+ private function doSetUp()
{
$this->normalizer = new DateTimeNormalizer();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
index d9c6b8e2ca423..809284d525080 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;
@@ -27,6 +28,8 @@
class GetSetMethodNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var GetSetMethodNormalizer
*/
@@ -36,7 +39,7 @@ class GetSetMethodNormalizerTest extends TestCase
*/
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\SerializerNormalizer')->getMock();
$this->normalizer = new GetSetMethodNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
index 4d9a53eeb9374..9af0d2171fdf5 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\SerializerInterface;
@@ -22,6 +23,8 @@
*/
class JsonSerializableNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var JsonSerializableNormalizer
*/
@@ -32,7 +35,7 @@ class JsonSerializableNormalizerTest extends TestCase
*/
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->serializer = $this->getMockBuilder(JsonSerializerNormalizer::class)->getMock();
$this->normalizer = new JsonSerializableNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
index fe9d0b8546096..31679c3c6a95a 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
@@ -35,6 +36,8 @@
*/
class ObjectNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ObjectNormalizer
*/
@@ -44,7 +47,7 @@ class ObjectNormalizerTest extends TestCase
*/
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\ObjectSerializerNormalizer')->getMock();
$this->normalizer = new ObjectNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
index cfa21b6758a06..5223496d8982f 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;
@@ -27,6 +28,8 @@
class PropertyNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var PropertyNormalizer
*/
@@ -36,7 +39,7 @@ class PropertyNormalizerTest extends TestCase
*/
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
$this->normalizer = new PropertyNormalizer();
diff --git a/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php
index c81698bd89ca5..a5a344bc73961 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Templating\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\Loader\ChainLoader;
use Symfony\Component\Templating\Loader\FilesystemLoader;
use Symfony\Component\Templating\TemplateReference;
class ChainLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $loader1;
protected $loader2;
- protected function setUp()
+ private function doSetUp()
{
$fixturesPath = realpath(__DIR__.'/../Fixtures/');
$this->loader1 = new FilesystemLoader($fixturesPath.'/null/%name%');
diff --git a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
index c6dcdefc95f51..e045e2473d79c 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
@@ -12,14 +12,17 @@
namespace Symfony\Component\Templating\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\Loader\FilesystemLoader;
use Symfony\Component\Templating\TemplateReference;
class FilesystemLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected static $fixturesPath;
- public static function setUpBeforeClass()
+ private static function doSetUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index 1b469d7e47654..be7ec0bb15529 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Templating\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\Helper\SlotsHelper;
use Symfony\Component\Templating\Loader\Loader;
use Symfony\Component\Templating\PhpEngine;
@@ -22,14 +23,16 @@
class PhpEngineTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $loader;
- protected function setUp()
+ private function doSetUp()
{
$this->loader = new ProjectTemplateLoader();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->loader = null;
}
diff --git a/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php b/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php
index c67dc376c2364..7088bad00450e 100644
--- a/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php
+++ b/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\Templating\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\TemplateNameParser;
use Symfony\Component\Templating\TemplateReference;
class TemplateNameParserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $parser;
- protected function setUp()
+ private function doSetUp()
{
$this->parser = new TemplateNameParser();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->parser = null;
}
diff --git a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
index bd97a2445c0a5..d0da3340e2aa9 100644
--- a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
+++ b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Translation\Tests\DataCollector;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\DataCollector\TranslationDataCollector;
use Symfony\Component\Translation\DataCollectorTranslator;
class TranslationDataCollectorTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
if (!class_exists('Symfony\Component\HttpKernel\DataCollector\DataCollector')) {
$this->markTestSkipped('The "DataCollector" is not available');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php b/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
index 279e9fde5b667..98c1a2185a8c2 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
abstract class LocalizedTestCase extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
if (!\extension_loaded('intl')) {
$this->markTestSkipped('Extension intl is required.');
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
index 0213e22254782..33deb88482cb5 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Loader\LoaderInterface;
@@ -20,15 +21,17 @@
class TranslatorCacheTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $tmpDir;
- protected function setUp()
+ private function doSetUp()
{
$this->tmpDir = sys_get_temp_dir().'/sf2_translation';
$this->deleteTmpDir();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->deleteTmpDir();
}
diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
index 0a11c4741385a..18705b7987efe 100644
--- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
@@ -29,7 +29,7 @@
*/
abstract class ConstraintValidatorTestCase extends TestCase
{
- use TestCaseSetUpTearDownTrait;
+ use ForwardCompatTestTrait;
/**
* @var ExecutionContextInterface
diff --git a/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php b/src/Symfony/Component/Validator/Test/ForwardCompatTestTrait.php
similarity index 95%
rename from src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php
rename to src/Symfony/Component/Validator/Test/ForwardCompatTestTrait.php
index 236e02267b118..078d8d54b48a6 100644
--- a/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php
+++ b/src/Symfony/Component/Validator/Test/ForwardCompatTestTrait.php
@@ -22,7 +22,7 @@
/**
* @internal
*/
- trait TestCaseSetUpTearDownTrait
+ trait ForwardCompatTestTrait
{
private function doSetUp(): void
{
@@ -47,7 +47,7 @@ protected function tearDown(): void
/**
* @internal
*/
- trait TestCaseSetUpTearDownTrait
+ trait ForwardCompatTestTrait
{
/**
* @return void
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
index 73d81cbfad9c4..35cf81cf7dfbf 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
class ConstraintViolationListTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $list;
- protected function setUp()
+ private function doSetUp()
{
$this->list = new ConstraintViolationList();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->list = null;
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
index 65906c5539fee..4d447eb25dcac 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\FileValidator;
@@ -18,6 +19,8 @@
abstract class FileValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected $path;
protected $file;
@@ -27,7 +30,7 @@ protected function createValidator()
return new FileValidator();
}
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
@@ -36,7 +39,7 @@ protected function setUp()
fwrite($this->file, ' ', 1);
}
- protected function tearDown()
+ private function doTearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
index aa8ad4cf55dc7..22bb93bd09311 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\ImageValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -20,6 +21,8 @@
*/
class ImageValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected $context;
/**
@@ -39,7 +42,7 @@ protected function createValidator()
return new ImageValidator();
}
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php
index 17334bea7925a..29d52c9182301 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Type;
use Symfony\Component\Validator\Constraints\TypeValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class TypeValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected static $file;
protected function createValidator()
@@ -172,7 +175,7 @@ protected function createFile()
return static::$file;
}
- public static function tearDownAfterClass()
+ private static function doTearDownAfterClass()
{
if (static::$file) {
fclose(static::$file);
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php
index 6296030fd7dff..171608755f52b 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Validator\Tests\Mapping\Cache;
use Doctrine\Common\Cache\ArrayCache;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\Cache\DoctrineCache;
class DoctrineCacheTest extends AbstractCacheTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
$this->cache = new DoctrineCache(new ArrayCache());
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
index fcac5e232ae4e..e704732fadd70 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
@@ -2,6 +2,7 @@
namespace Symfony\Component\Validator\Tests\Mapping\Cache;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Validator\Mapping\Cache\Psr6Cache;
use Symfony\Component\Validator\Mapping\ClassMetadata;
@@ -11,7 +12,9 @@
*/
class Psr6CacheTest extends AbstractCacheTest
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
$this->cache = new Psr6Cache(new ArrayAdapter());
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
index d33342c42557c..f45b7c931a070 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata;
@@ -21,6 +22,8 @@
class ClassMetadataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
const PROVIDERCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity';
@@ -28,12 +31,12 @@ class ClassMetadataTest extends TestCase
protected $metadata;
- protected function setUp()
+ private function doSetUp()
{
$this->metadata = new ClassMetadata(self::CLASSNAME);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->metadata = null;
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php
index 069ccd322929e..80e1f5e7c417c 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php
@@ -12,20 +12,23 @@
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
class StaticMethodLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $errorLevel;
- protected function setUp()
+ private function doSetUp()
{
$this->errorLevel = error_reporting();
}
- protected function tearDown()
+ private function doTearDown()
{
error_reporting($this->errorLevel);
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
index b6983f75b5715..a47a447e3e99e 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\MemberMetadata;
use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint;
@@ -20,9 +21,11 @@
class MemberMetadataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $metadata;
- protected function setUp()
+ private function doSetUp()
{
$this->metadata = new TestMemberMetadata(
'Symfony\Component\Validator\Tests\Fixtures\Entity',
@@ -31,7 +34,7 @@ protected function setUp()
);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->metadata = null;
}
diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
index c9c05a0edfa36..a2525311c56ac 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Validator;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Expression;
@@ -33,6 +34,8 @@
*/
abstract class AbstractTest extends AbstractValidatorTest
{
+ use ForwardCompatTestTrait;
+
/**
* @var ValidatorInterface
*/
@@ -43,7 +46,7 @@ abstract class AbstractTest extends AbstractValidatorTest
*/
abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []);
- protected function setUp()
+ private function doSetUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
index 884ccc7da0f95..e07a158fa2535 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Validator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\Constraints\Valid;
@@ -28,6 +29,8 @@
*/
abstract class AbstractValidatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const ENTITY_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const REFERENCE_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Reference';
@@ -47,7 +50,7 @@ abstract class AbstractValidatorTest extends TestCase
*/
public $referenceMetadata;
- protected function setUp()
+ private function doSetUp()
{
$this->metadataFactory = new FakeMetadataFactory();
$this->metadata = new ClassMetadata(self::ENTITY_CLASS);
@@ -56,7 +59,7 @@ protected function setUp()
$this->metadataFactory->addMetadata($this->referenceMetadata);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->metadataFactory = null;
$this->metadata = null;
diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
index 16d81697e6585..b2ff01c66a944 100644
--- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
+++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
@@ -12,22 +12,25 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\ValidatorBuilder;
use Symfony\Component\Validator\ValidatorBuilderInterface;
class ValidatorBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var ValidatorBuilderInterface
*/
protected $builder;
- protected function setUp()
+ private function doSetUp()
{
$this->builder = new ValidatorBuilder();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->builder = null;
}
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
index ea83e77163d19..2ac264d2a5760 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ExceptionCaster;
use Symfony\Component\VarDumper\Caster\FrameStub;
@@ -21,6 +22,7 @@
class ExceptionCasterTest extends TestCase
{
+ use ForwardCompatTestTrait;
use VarDumperTestTrait;
private function getTestException($msg, &$ref = null)
@@ -28,7 +30,7 @@ private function getTestException($msg, &$ref = null)
return new \Exception(''.$msg);
}
- protected function tearDown()
+ private function doTearDown()
{
ExceptionCaster::$srcContext = 1;
ExceptionCaster::$traceArgs = true;
@@ -44,14 +46,14 @@ public function testDefaultSettings()
#message: "foo"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 28
+ #line: 30
trace: {
- %s%eTests%eCaster%eExceptionCasterTest.php:28 {
+ %s%eTests%eCaster%eExceptionCasterTest.php:30 {
› {
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:40 { …}
+ %s%eTests%eCaster%eExceptionCasterTest.php:42 { …}
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testDefaultSettings() {}
%A
EODUMP;
@@ -66,12 +68,12 @@ public function testSeek()
$expectedDump = <<<'EODUMP'
{
- %s%eTests%eCaster%eExceptionCasterTest.php:28 {
+ %s%eTests%eCaster%eExceptionCasterTest.php:30 {
› {
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:65 { …}
+ %s%eTests%eCaster%eExceptionCasterTest.php:67 { …}
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testSeek() {}
%A
EODUMP;
@@ -89,14 +91,14 @@ public function testNoArgs()
#message: "1"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 28
+ #line: 30
trace: {
- %sExceptionCasterTest.php:28 {
+ %sExceptionCasterTest.php:30 {
› {
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:84 { …}
+ %s%eTests%eCaster%eExceptionCasterTest.php:86 { …}
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testNoArgs() {}
%A
EODUMP;
@@ -114,9 +116,9 @@ public function testNoSrcContext()
#message: "1"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 28
+ #line: 30
trace: {
- %s%eTests%eCaster%eExceptionCasterTest.php:28
+ %s%eTests%eCaster%eExceptionCasterTest.php:30
%s%eTests%eCaster%eExceptionCasterTest.php:%d
%A
EODUMP;
@@ -146,10 +148,10 @@ public function testHtmlDump()
#code: 0
#file: "%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php"
- #line: 28
+ #line: 30trace: {%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php:28
+Stack level %d.">%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php:30
…%d
}
}
@@ -221,7 +223,7 @@ public function testExcludeVerbosity()
#message: "foo"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 28
+ #line: 30
}
EODUMP;
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php
index 1d7b3f62787a2..fff7dd3219655 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
@@ -19,18 +20,19 @@
*/
class XmlReaderCasterTest extends TestCase
{
+ use ForwardCompatTestTrait;
use VarDumperTestTrait;
/** @var \XmlReader */
private $reader;
- protected function setUp()
+ private function doSetUp()
{
$this->reader = new \XmlReader();
$this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml');
}
- protected function tearDown()
+ private function doTearDown()
{
$this->reader->close();
}
diff --git a/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php b/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php
index fb4bbd96f2107..b2e5c70c4ad64 100644
--- a/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php
+++ b/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php
@@ -13,16 +13,19 @@
use Fig\Link\Link;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\WebLink\HttpHeaderSerializer;
class HttpHeaderSerializerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var HttpHeaderSerializer
*/
private $serializer;
- protected function setUp()
+ private function doSetUp()
{
$this->serializer = new HttpHeaderSerializer();
}
diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
index 116f8000775b1..d2f09d1143c0c 100644
--- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
@@ -3,17 +3,19 @@
namespace Symfony\Component\Workflow\Tests\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
class GraphvizDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
private $dumper;
- protected function setUp()
+ private function doSetUp()
{
$this->dumper = new GraphvizDumper();
}
diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php
index 473d31ecf5895..7e29d7deffbf8 100644
--- a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php
@@ -3,17 +3,19 @@
namespace Symfony\Component\Workflow\Tests\Dumper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Dumper\StateMachineGraphvizDumper;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
class StateMachineGraphvizDumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
private $dumper;
- protected function setUp()
+ private function doSetUp()
{
$this->dumper = new StateMachineGraphvizDumper();
}
diff --git a/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php b/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php
index d27c63e5275c7..57add5342e2b3 100644
--- a/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php
+++ b/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Workflow\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -18,12 +19,14 @@
class GuardListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $authenticationChecker;
private $validator;
private $listener;
private $configuration;
- protected function setUp()
+ private function doSetUp()
{
$this->configuration = [
'test_is_granted' => 'is_granted("something")',
@@ -44,7 +47,7 @@ protected function setUp()
$this->listener = new GuardListener($this->configuration, $expressionLanguage, $tokenStorage, $this->authenticationChecker, $trustResolver, null, $this->validator);
}
- protected function tearDown()
+ private function doTearDown()
{
$this->authenticationChecker = null;
$this->validator = null;
diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
index adedfc93b74d0..038af0d89fde2 100644
--- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php
+++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
@@ -12,9 +13,11 @@
class RegistryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $registry;
- protected function setUp()
+ private function doSetUp()
{
$this->registry = new Registry();
@@ -23,7 +26,7 @@ protected function setUp()
$this->registry->add(new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow3'), $this->createSupportStrategy(Subject2::class));
}
- protected function tearDown()
+ private function doTearDown()
{
$this->registry = null;
}
diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
index 2bf0286b6e38b..cb86e951d273c 100644
--- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Yaml\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
@@ -24,6 +25,8 @@
*/
class LintCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $files;
public function testLintCorrectFile()
@@ -115,13 +118,13 @@ protected function createCommandTester()
return new CommandTester($command);
}
- protected function setUp()
+ private function doSetUp()
{
$this->files = [];
@mkdir(sys_get_temp_dir().'/framework-yml-lint-test');
}
- protected function tearDown()
+ private function doTearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php
index 1a9cac6f73600..0a85acd9a28f2 100644
--- a/src/Symfony/Component/Yaml/Tests/DumperTest.php
+++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
@@ -19,6 +20,8 @@
class DumperTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $parser;
protected $dumper;
protected $path;
@@ -38,14 +41,14 @@ class DumperTest extends TestCase
],
];
- protected function setUp()
+ private function doSetUp()
{
$this->parser = new Parser();
$this->dumper = new Dumper();
$this->path = __DIR__.'/Fixtures';
}
- protected function tearDown()
+ private function doTearDown()
{
$this->parser = null;
$this->dumper = null;
diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php
index 950c702300ebe..2d69916420aec 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -12,13 +12,16 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Inline;
use Symfony\Component\Yaml\Yaml;
class InlineTest extends TestCase
{
- protected function setUp()
+ use ForwardCompatTestTrait;
+
+ private function doSetUp()
{
Inline::initialize(0, 0);
}
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index 4b5073fb4edea..c3a03c244e0cc 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
@@ -19,6 +20,8 @@
class ParserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @var Parser */
protected $parser;
From 629d21736d15cd76fe06c6cacde82020c4107d47 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 1 Aug 2019 00:26:30 +0200
Subject: [PATCH 019/147] [Cache] fix cs
---
.../Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php | 2 +-
.../Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php | 2 +-
.../Component/Cache/Tests/Simple/AbstractRedisCacheTest.php | 2 +-
src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php | 2 +-
src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php | 2 +-
src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php | 2 +-
.../Component/Cache/Tests/Simple/RedisArrayCacheTest.php | 2 +-
src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php | 2 +-
.../Component/Cache/Tests/Simple/RedisClusterCacheTest.php | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
index 1b27fc1e5f943..02bbde1290053 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
@@ -15,7 +15,7 @@
class PredisClusterAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
private static function doSetUpBeforeClass()
{
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
index d7d1547e84312..f2734ff082455 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
@@ -15,7 +15,7 @@
class RedisArrayAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
private static function doSetUpBeforeClass()
{
diff --git a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
index 55d69fa136dfe..a739084f71dd5 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
@@ -16,7 +16,7 @@
abstract class AbstractRedisCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
protected $skippedTests = [
'testSetTtl' => 'Testing expiration slows down the test suite',
diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
index a9674de40959e..570666c51df79 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
@@ -17,7 +17,7 @@
class MemcachedCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
protected $skippedTests = [
'testSetTtl' => 'Testing expiration slows down the test suite',
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
index 35baff11fa958..0886fc5da617b 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
@@ -20,7 +20,7 @@
*/
class PdoCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
index 3364151771ba5..8e48cd3a86972 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
@@ -21,7 +21,7 @@
*/
class PdoDbalCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
index 0ef66c212d92c..5de1114fc327f 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
@@ -15,7 +15,7 @@
class RedisArrayCacheTest extends AbstractRedisCacheTest
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
private static function doSetUpBeforeClass()
{
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
index 021d9353d2786..9f7359ddbef1f 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
@@ -16,7 +16,7 @@
class RedisCacheTest extends AbstractRedisCacheTest
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
private static function doSetUpBeforeClass()
{
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
index 1d72200512936..5cbfe8eae99b6 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
@@ -15,7 +15,7 @@
class RedisClusterCacheTest extends AbstractRedisCacheTest
{
- use ForwardCompatTestTrait;
+ use ForwardCompatTestTrait;
private static function doSetUpBeforeClass()
{
From 9e2d683423e7e5db124d5a3b5ec8ad6003166d67 Mon Sep 17 00:00:00 2001
From: Benjamin Morel
Date: Thu, 1 Aug 2019 00:40:47 +0200
Subject: [PATCH 020/147] Micro-typo fix
---
.../Security/Http/RememberMe/TokenBasedRememberMeServices.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
index 952211333930e..afa12e4f03d20 100644
--- a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
+++ b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
@@ -109,7 +109,7 @@ protected function generateCookieValue($class, $username, $expires, $password)
}
/**
- * Generates a hash for the cookie to ensure it is not being tempered with.
+ * Generates a hash for the cookie to ensure it is not being tampered with.
*
* @param string $class
* @param string $username The username
From 4c8442462adbac88df88050df3ae827888d92bf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 1 Aug 2019 09:31:22 +0200
Subject: [PATCH 021/147] Fix assertInternalType deprecation in phpunit 9
---
.../Tests/Form/Type/EntityTypeTest.php | 4 +-
.../Legacy/ForwardCompatTestTraitForV5.php | 110 ++++++++++++++++++
.../CacheWarmer/SerializerCacheWarmerTest.php | 4 +-
.../CacheWarmer/ValidatorCacheWarmerTest.php | 6 +-
.../Tests/Functional/ProfilerTest.php | 2 +-
.../Definition/Builder/TreeBuilderTest.php | 5 +-
.../Tests/ContainerBuilderTest.php | 7 +-
.../Tests/Loader/YamlFileLoaderTest.php | 2 +-
.../EnvPlaceholderParameterBagTest.php | 7 +-
.../DomCrawler/Tests/CrawlerTest.php | 7 +-
.../Tests/Field/FileFormFieldTest.php | 5 +-
.../DataCollectorExtensionTest.php | 2 +-
.../Type/BaseValidatorExtensionTest.php | 7 +-
.../HttpFoundation/Tests/JsonResponseTest.php | 4 +-
.../HttpFoundation/Tests/RequestTest.php | 4 +-
.../Storage/NativeSessionStorageTest.php | 2 +-
.../DataCollector/MemoryDataCollectorTest.php | 7 +-
.../Bundle/Reader/JsonBundleReaderTest.php | 2 +-
.../Bundle/Reader/PhpBundleReaderTest.php | 2 +-
.../AbstractCurrencyDataProviderTest.php | 4 +-
.../AbstractNumberFormatterTest.php | 16 +--
.../NumberFormatter/NumberFormatterTest.php | 3 +
.../Component/Process/Tests/ProcessTest.php | 4 +-
.../Routing/Tests/Matcher/UrlMatcherTest.php | 13 ++-
.../AbstractRememberMeServicesTest.php | 5 +-
.../AbstractObjectNormalizerTest.php | 7 +-
.../Stopwatch/Tests/StopwatchTest.php | 9 +-
.../VarDumper/Tests/Cloner/DataTest.php | 5 +-
.../Component/Yaml/Tests/ParserTest.php | 2 +-
29 files changed, 203 insertions(+), 54 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index 0bbc2b1d14ad6..3a78eb57b0b0a 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -1466,7 +1466,7 @@ public function testSetDataEmptyArraySubmitNullMultiple()
]);
$form->setData($emptyArray);
$form->submit(null);
- $this->assertInternalType('array', $form->getData());
+ $this->assertIsArray($form->getData());
$this->assertEquals([], $form->getData());
$this->assertEquals([], $form->getNormData());
$this->assertSame([], $form->getViewData(), 'View data is always an array');
@@ -1484,7 +1484,7 @@ public function testSetDataNonEmptyArraySubmitNullMultiple()
$existing = [0 => $entity1];
$form->setData($existing);
$form->submit(null);
- $this->assertInternalType('array', $form->getData());
+ $this->assertIsArray($form->getData());
$this->assertEquals([], $form->getData());
$this->assertEquals([], $form->getNormData());
$this->assertSame([], $form->getViewData(), 'View data is always an array');
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
index 5b35e8018290b..5ef837434a948 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
@@ -79,4 +79,114 @@ private function doTearDown()
{
parent::tearDown();
}
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsArray($actual, $message = '')
+ {
+ static::assertInternalType('array', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsBool($actual, $message = '')
+ {
+ static::assertInternalType('bool', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsFloat($actual, $message = '')
+ {
+ static::assertInternalType('float', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsInt($actual, $message = '')
+ {
+ static::assertInternalType('int', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsNumeric($actual, $message = '')
+ {
+ static::assertInternalType('numeric', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsObject($actual, $message = '')
+ {
+ static::assertInternalType('object', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsResource($actual, $message = '')
+ {
+ static::assertInternalType('resource', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsString($actual, $message = '')
+ {
+ static::assertInternalType('string', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsScalar($actual, $message = '')
+ {
+ static::assertInternalType('scalar', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsCallable($actual, $message = '')
+ {
+ static::assertInternalType('callable', $actual, $message);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public static function assertIsIterable($actual, $message = '')
+ {
+ static::assertInternalType('iterable', $actual, $message);
+ }
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
index 50a5abf0ae98b..51c979c597825 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
@@ -50,7 +50,7 @@ public function testWarmUp()
$values = $fallbackPool->getValues();
- $this->assertInternalType('array', $values);
+ $this->assertIsArray($values);
$this->assertCount(2, $values);
$this->assertArrayHasKey('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person', $values);
$this->assertArrayHasKey('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author', $values);
@@ -74,7 +74,7 @@ public function testWarmUpWithoutLoader()
$values = $fallbackPool->getValues();
- $this->assertInternalType('array', $values);
+ $this->assertIsArray($values);
$this->assertCount(0, $values);
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
index 47c88f1a206af..ad0feb33ffca0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
@@ -46,7 +46,7 @@ public function testWarmUp()
$values = $fallbackPool->getValues();
- $this->assertInternalType('array', $values);
+ $this->assertIsArray($values);
$this->assertCount(2, $values);
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Person', $values);
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author', $values);
@@ -77,7 +77,7 @@ public function testWarmUpWithAnnotations()
$values = $fallbackPool->getValues();
- $this->assertInternalType('array', $values);
+ $this->assertIsArray($values);
$this->assertCount(2, $values);
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Category', $values);
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.SubCategory', $values);
@@ -99,7 +99,7 @@ public function testWarmUpWithoutLoader()
$values = $fallbackPool->getValues();
- $this->assertInternalType('array', $values);
+ $this->assertIsArray($values);
$this->assertCount(0, $values);
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php
index ec3c47e76205c..7ee42cdd17a3e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php
@@ -30,7 +30,7 @@ public function testProfilerIsDisabled($insulate)
$client->enableProfiler();
$this->assertFalse($client->getProfile());
$client->request('GET', '/profiler');
- $this->assertInternalType('object', $client->getProfile());
+ $this->assertIsObject($client->getProfile());
$client->request('GET', '/profiler');
$this->assertFalse($client->getProfile());
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
index d94912b78dc93..edf30c6b7cb8b 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
class TreeBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testUsingACustomNodeBuilder()
{
$builder = new TreeBuilder();
@@ -128,7 +131,7 @@ public function testDefinitionExampleGetsTransferredToNode()
$tree = $builder->buildTree();
$children = $tree->getChildren();
- $this->assertInternalType('array', $tree->getExample());
+ $this->assertIsArray($tree->getExample());
$this->assertEquals('example', $children['child']->getExample());
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index ec163609180e1..de0bede4c98c7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -16,6 +16,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface as PsrContainerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\ComposerResource;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Config\Resource\FileResource;
@@ -45,6 +46,8 @@
class ContainerBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDefaultRegisteredDefinitions()
{
$builder = new ContainerBuilder();
@@ -168,7 +171,7 @@ public function testGetCreatesServiceBasedOnDefinition()
$builder = new ContainerBuilder();
$builder->register('foo', 'stdClass');
- $this->assertInternalType('object', $builder->get('foo'), '->get() returns the service definition associated with the id');
+ $this->assertIsObject($builder->get('foo'), '->get() returns the service definition associated with the id');
}
public function testGetReturnsRegisteredService()
@@ -662,7 +665,7 @@ public function testResolveEnvValuesWithArray()
$container->resolveEnvPlaceholders('%dummy%', true);
$container->resolveEnvPlaceholders('%dummy2%', true);
- $this->assertInternalType('array', $container->resolveEnvPlaceholders('%dummy2%', true));
+ $this->assertIsArray($container->resolveEnvPlaceholders('%dummy2%', true));
foreach ($dummyArray as $key => $value) {
$this->assertArrayHasKey($key, $container->resolveEnvPlaceholders('%dummy2%', true));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index 45d9ff10da7e0..d4d14a2cba081 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -599,7 +599,7 @@ public function testAnonymousServices()
// Anonymous service in a callable
$factory = $definition->getFactory();
- $this->assertInternalType('array', $factory);
+ $this->assertIsArray($factory);
$this->assertInstanceOf(Reference::class, $factory[0]);
$this->assertTrue($container->has((string) $factory[0]));
$this->assertRegExp('/^\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
index e7c88d2bb58ec..bd0613e5cd3bc 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
class EnvPlaceholderParameterBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
*/
@@ -42,7 +45,7 @@ public function testMergeWillNotDuplicateIdenticalParameters()
$placeholder = array_values($placeholderForVariable)[0];
$this->assertCount(1, $placeholderForVariable);
- $this->assertInternalType('string', $placeholder);
+ $this->assertIsString($placeholder);
$this->assertContains($envVariableName, $placeholder);
}
@@ -65,7 +68,7 @@ public function testMergeWhereFirstBagIsEmptyWillWork()
$placeholder = array_values($placeholderForVariable)[0];
$this->assertCount(1, $placeholderForVariable);
- $this->assertInternalType('string', $placeholder);
+ $this->assertIsString($placeholder);
$this->assertContains($envVariableName, $placeholder);
}
diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
index 1be69f06d64a1..03670f913c0c0 100644
--- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Crawler;
class CrawlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$crawler = new Crawler();
@@ -843,7 +846,7 @@ public function testChaining()
public function testLinks()
{
$crawler = $this->createTestCrawler('http://example.com/bar/')->selectLink('Foo');
- $this->assertInternalType('array', $crawler->links(), '->links() returns an array');
+ $this->assertIsArray($crawler->links(), '->links() returns an array');
$this->assertCount(4, $crawler->links(), '->links() returns an array');
$links = $crawler->links();
@@ -855,7 +858,7 @@ public function testLinks()
public function testImages()
{
$crawler = $this->createTestCrawler('http://example.com/bar/')->selectImage('Bar');
- $this->assertInternalType('array', $crawler->images(), '->images() returns an array');
+ $this->assertIsArray($crawler->images(), '->images() returns an array');
$this->assertCount(4, $crawler->images(), '->images() returns an array');
$images = $crawler->images();
diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php
index 03ab383cbbaf1..2e31be5fa528c 100644
--- a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php
@@ -11,10 +11,13 @@
namespace Symfony\Component\DomCrawler\Tests\Field;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Field\FileFormField;
class FileFormFieldTest extends FormFieldTestCase
{
+ use ForwardCompatTestTrait;
+
public function testInitialize()
{
$node = $this->createNode('input', '', ['type' => 'file']);
@@ -55,7 +58,7 @@ public function testSetValue($method)
$this->assertEquals(basename(__FILE__), $value['name'], "->$method() sets the name of the file field");
$this->assertEquals('', $value['type'], "->$method() sets the type of the file field");
- $this->assertInternalType('string', $value['tmp_name'], "->$method() sets the tmp_name of the file field");
+ $this->assertIsString($value['tmp_name'], "->$method() sets the tmp_name of the file field");
$this->assertFileExists($value['tmp_name'], "->$method() creates a copy of the file at the tmp_name path");
$this->assertEquals(0, $value['error'], "->$method() sets the error of the file field");
$this->assertEquals(filesize(__FILE__), $value['size'], "->$method() sets the size of the file field");
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
index 72c32904b1475..cb834867f3d6d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
@@ -39,7 +39,7 @@ public function testLoadTypeExtensions()
{
$typeExtensions = $this->extension->getTypeExtensions('Symfony\Component\Form\Extension\Core\Type\FormType');
- $this->assertInternalType('array', $typeExtensions);
+ $this->assertIsArray($typeExtensions);
$this->assertCount(1, $typeExtensions);
$this->assertInstanceOf('Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension', array_shift($typeExtensions));
}
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 b90098b412714..6486b2f2f2fe4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Test\FormInterface;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\Validator\Constraints\GroupSequence;
@@ -20,6 +21,8 @@
*/
abstract class BaseValidatorExtensionTest extends TypeTestCase
{
+ use ForwardCompatTestTrait;
+
public function testValidationGroupNullByDefault()
{
$form = $this->createForm();
@@ -60,7 +63,7 @@ public function testValidationGroupsCanBeSetToCallback()
'validation_groups' => [$this, 'testValidationGroupsCanBeSetToCallback'],
]);
- $this->assertInternalType('callable', $form->getConfig()->getOption('validation_groups'));
+ $this->assertIsCallable($form->getConfig()->getOption('validation_groups'));
}
public function testValidationGroupsCanBeSetToClosure()
@@ -69,7 +72,7 @@ public function testValidationGroupsCanBeSetToClosure()
'validation_groups' => function (FormInterface $form) { },
]);
- $this->assertInternalType('callable', $form->getConfig()->getOption('validation_groups'));
+ $this->assertIsCallable($form->getConfig()->getOption('validation_groups'));
}
public function testValidationGroupsCanBeSetToGroupSequence()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
index 56a40420a2329..d196205309753 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
@@ -56,7 +56,7 @@ public function testConstructorWithSimpleTypes()
$response = new JsonResponse(0.1);
$this->assertEquals('0.1', $response->getContent());
- $this->assertInternalType('string', $response->getContent());
+ $this->assertIsString($response->getContent());
$response = new JsonResponse(true);
$this->assertSame('true', $response->getContent());
@@ -145,7 +145,7 @@ public function testStaticCreateWithSimpleTypes()
$response = JsonResponse::create(0.1);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertEquals('0.1', $response->getContent());
- $this->assertInternalType('string', $response->getContent());
+ $this->assertIsString($response->getContent());
$response = JsonResponse::create(true);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 219a16256e9d7..3f7ba60179e8b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -1156,7 +1156,7 @@ public function testGetContentReturnsResource()
{
$req = new Request();
$retval = $req->getContent(true);
- $this->assertInternalType('resource', $retval);
+ $this->assertIsResource($retval);
$this->assertEquals('', fread($retval, 1));
$this->assertTrue(feof($retval));
}
@@ -1166,7 +1166,7 @@ public function testGetContentReturnsResourceWhenContentSetInConstructor()
$req = new Request([], [], [], [], [], [], 'MyContent');
$resource = $req->getContent(true);
- $this->assertInternalType('resource', $resource);
+ $this->assertIsResource($resource);
$this->assertEquals('MyContent', stream_get_contents($resource));
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 035b674c1ba17..18540264dbe6a 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -101,7 +101,7 @@ public function testGetId()
$storage->start();
$id = $storage->getId();
- $this->assertInternalType('string', $id);
+ $this->assertIsString($id);
$this->assertNotSame('', $id);
$storage->save();
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php
index c434ed1e1162b..a46cc388b43c8 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php
@@ -12,19 +12,22 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector;
class MemoryDataCollectorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCollect()
{
$collector = new MemoryDataCollector();
$collector->collect(new Request(), new Response());
- $this->assertInternalType('integer', $collector->getMemory());
- $this->assertInternalType('integer', $collector->getMemoryLimit());
+ $this->assertIsInt($collector->getMemory());
+ $this->assertIsInt($collector->getMemoryLimit());
$this->assertSame('memory', $collector->getName());
}
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 a40f4dce56868..cf9dac64b5bfb 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -36,7 +36,7 @@ public function testReadReturnsArray()
{
$data = $this->reader->read(__DIR__.'/Fixtures/json', 'en');
- $this->assertInternalType('array', $data);
+ $this->assertIsArray($data);
$this->assertSame('Bar', $data['Foo']);
$this->assertArrayNotHasKey('ExistsNot', $data);
}
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 651fea0116e47..d4879b94793e2 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -36,7 +36,7 @@ public function testReadReturnsArray()
{
$data = $this->reader->read(__DIR__.'/Fixtures/php', 'en');
- $this->assertInternalType('array', $data);
+ $this->assertIsArray($data);
$this->assertSame('Bar', $data['Foo']);
$this->assertArrayNotHasKey('ExistsNot', $data);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
index 9e9067cb845ed..99000f5eff58d 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
@@ -709,7 +709,7 @@ function ($currency) { return [$currency]; },
*/
public function testGetFractionDigits($currency)
{
- $this->assertInternalType('numeric', $this->dataProvider->getFractionDigits($currency));
+ $this->assertIsNumeric($this->dataProvider->getFractionDigits($currency));
}
/**
@@ -717,7 +717,7 @@ public function testGetFractionDigits($currency)
*/
public function testGetRoundingIncrement($currency)
{
- $this->assertInternalType('numeric', $this->dataProvider->getRoundingIncrement($currency));
+ $this->assertIsNumeric($this->dataProvider->getRoundingIncrement($currency));
}
public function provideCurrenciesWithNumericEquivalent()
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index a81d30c865035..ea7e0e7bbf48a 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -748,11 +748,11 @@ public function testParseTypeInt64With32BitIntegerInPhp32Bit()
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse('2,147,483,647', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('integer', $parsedValue);
+ $this->assertIsInt($parsedValue);
$this->assertEquals(2147483647, $parsedValue);
$parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('int', $parsedValue);
+ $this->assertIsInt($parsedValue);
$this->assertEquals(-2147483648, $parsedValue);
}
@@ -763,11 +763,11 @@ public function testParseTypeInt64With32BitIntegerInPhp64Bit()
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse('2,147,483,647', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('integer', $parsedValue);
+ $this->assertIsInt($parsedValue);
$this->assertEquals(2147483647, $parsedValue);
$parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('integer', $parsedValue);
+ $this->assertIsInt($parsedValue);
$this->assertEquals(-2147483647 - 1, $parsedValue);
}
@@ -782,11 +782,11 @@ public function testParseTypeInt64With64BitIntegerInPhp32Bit()
// int 64 using only 32 bit range strangeness
$parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('float', $parsedValue);
+ $this->assertIsFloat($parsedValue);
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.');
$parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('float', $parsedValue);
+ $this->assertIsFloat($parsedValue);
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.');
}
@@ -800,12 +800,12 @@ public function testParseTypeInt64With64BitIntegerInPhp64Bit()
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('integer', $parsedValue);
+ $this->assertIsInt($parsedValue);
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
$parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64);
- $this->assertInternalType('integer', $parsedValue);
+ $this->assertIsInt($parsedValue);
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
}
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
index 4a6fa9d3f7414..8e20c81f13f7a 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
@@ -20,6 +21,8 @@
*/
class NumberFormatterTest extends AbstractNumberFormatterTest
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
*/
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 8ac17b2c8f492..fd40aaa9e13f3 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -736,8 +736,8 @@ public function testRestart()
// Ensure that both processed finished and the output is numeric
$this->assertFalse($process1->isRunning());
$this->assertFalse($process2->isRunning());
- $this->assertInternalType('numeric', $process1->getOutput());
- $this->assertInternalType('numeric', $process2->getOutput());
+ $this->assertIsNumeric($process1->getOutput());
+ $this->assertIsNumeric($process2->getOutput());
// Ensure that restart returned a new process by check that the output is different
$this->assertNotEquals($process1->getOutput(), $process2->getOutput());
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
index 61f9be3358471..d8f7a84518614 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Tests\Matcher;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -21,13 +22,15 @@
class UrlMatcherTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testNoMethodSoAllowed()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo'));
$matcher = $this->getUrlMatcher($coll);
- $this->assertInternalType('array', $matcher->match('/foo'));
+ $this->assertIsArray($matcher->match('/foo'));
}
public function testMethodNotAllowed()
@@ -66,7 +69,7 @@ public function testHeadAllowedWhenRequirementContainsGet()
$coll->add('foo', new Route('/foo', [], [], [], '', [], ['get']));
$matcher = $this->getUrlMatcher($coll, new RequestContext('', 'head'));
- $this->assertInternalType('array', $matcher->match('/foo'));
+ $this->assertIsArray($matcher->match('/foo'));
}
public function testMethodNotAllowedAggregatesAllowedMethods()
@@ -108,7 +111,7 @@ public function testMatch()
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo', [], [], [], '', [], ['get', 'head']));
$matcher = $this->getUrlMatcher($collection);
- $this->assertInternalType('array', $matcher->match('/foo'));
+ $this->assertIsArray($matcher->match('/foo'));
// route does not match with POST method context
$matcher = $this->getUrlMatcher($collection, new RequestContext('', 'post'));
@@ -120,9 +123,9 @@ public function testMatch()
// route does match with GET or HEAD method context
$matcher = $this->getUrlMatcher($collection);
- $this->assertInternalType('array', $matcher->match('/foo'));
+ $this->assertIsArray($matcher->match('/foo'));
$matcher = $this->getUrlMatcher($collection, new RequestContext('', 'head'));
- $this->assertInternalType('array', $matcher->match('/foo'));
+ $this->assertIsArray($matcher->match('/foo'));
// route with an optional variable as the first segment
$collection = new RouteCollection();
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
index ade199c0b9224..3709a92bba50e 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\RememberMe;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
@@ -19,6 +20,8 @@
class AbstractRememberMeServicesTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetRememberMeParameter()
{
$service = $this->getService(null, ['remember_me_parameter' => 'foo']);
@@ -261,7 +264,7 @@ public function testEncodeCookieAndDecodeCookieAreInvertible()
$service = $this->getService();
$encoded = $this->callProtected($service, 'encodeCookie', [$cookieParts]);
- $this->assertInternalType('string', $encoded);
+ $this->assertIsString($encoded);
$decoded = $this->callProtected($service, 'decodeCookie', [$encoded]);
$this->assertSame($cookieParts, $decoded);
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
index 6155cc3ea0f3e..1e3eb9b5ede36 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
@@ -13,6 +13,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
@@ -26,6 +27,8 @@
class AbstractObjectNormalizerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDenormalize()
{
$normalizer = new AbstractObjectNormalizerDummy();
@@ -93,7 +96,7 @@ public function testDenormalizeCollectionDecodedFromXmlWithOneChild()
);
$this->assertInstanceOf(DummyCollection::class, $dummyCollection);
- $this->assertInternalType('array', $dummyCollection->children);
+ $this->assertIsArray($dummyCollection->children);
$this->assertCount(1, $dummyCollection->children);
$this->assertInstanceOf(DummyChild::class, $dummyCollection->children[0]);
}
@@ -114,7 +117,7 @@ public function testDenormalizeCollectionDecodedFromXmlWithTwoChildren()
);
$this->assertInstanceOf(DummyCollection::class, $dummyCollection);
- $this->assertInternalType('array', $dummyCollection->children);
+ $this->assertIsArray($dummyCollection->children);
$this->assertCount(2, $dummyCollection->children);
$this->assertInstanceOf(DummyChild::class, $dummyCollection->children[0]);
$this->assertInstanceOf(DummyChild::class, $dummyCollection->children[1]);
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
index 30f976ad040a6..d70e803e43d89 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Stopwatch\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Stopwatch\Stopwatch;
/**
@@ -23,6 +24,8 @@
*/
class StopwatchTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const DELTA = 20;
public function testStart()
@@ -115,9 +118,9 @@ public function testMorePrecision()
$stopwatch->start('foo');
$event = $stopwatch->stop('foo');
- $this->assertInternalType('float', $event->getStartTime());
- $this->assertInternalType('float', $event->getEndTime());
- $this->assertInternalType('float', $event->getDuration());
+ $this->assertIsFloat($event->getStartTime());
+ $this->assertIsFloat($event->getEndTime());
+ $this->assertIsFloat($event->getDuration());
}
public function testSection()
diff --git a/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php b/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php
index 7d20bced35a4f..24af145a510d6 100644
--- a/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\VarDumper\Tests\Cloner;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Cloner\Data;
@@ -19,6 +20,8 @@
class DataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testBasicData()
{
$values = [1 => 123, 4.5, 'abc', null, false];
@@ -69,7 +72,7 @@ public function testArray()
$children = $data->getValue();
- $this->assertInternalType('array', $children);
+ $this->assertIsArray($children);
$this->assertInstanceOf(Data::class, $children[0]);
$this->assertInstanceOf(Data::class, $children[1]);
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index c3a03c244e0cc..d3217b6302ec6 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -2080,7 +2080,7 @@ public function testFilenamesAreParsedAsStringsWithoutFlag()
public function testParseFile()
{
- $this->assertInternalType('array', $this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
+ $this->assertIsArray($this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
}
/**
From c06454827d71ff8bd5e563c834078cbbae23537b Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 1 Aug 2019 12:14:38 +0200
Subject: [PATCH 022/147] fix tests
---
.../Tests/CacheWarmer/SerializerCacheWarmerTest.php | 3 +++
.../Tests/CacheWarmer/ValidatorCacheWarmerTest.php | 3 +++
.../Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php | 3 +++
3 files changed, 9 insertions(+)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
index 51c979c597825..e0ac2485b0221 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -22,6 +23,8 @@
class SerializerCacheWarmerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testWarmUp()
{
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
index ad0feb33ffca0..868bd83cf7e32 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -21,6 +22,8 @@
class ValidatorCacheWarmerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testWarmUp()
{
$validatorBuilder = new ValidatorBuilder();
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index ea7e0e7bbf48a..52e02f6667a8d 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -22,6 +23,8 @@
*/
abstract class AbstractNumberFormatterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider formatCurrencyWithDecimalStyleProvider
*/
From c2c7ba82df194a0b42d57d47f21db725001433f3 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 1 Aug 2019 14:16:51 +0200
Subject: [PATCH 023/147] Skip tests that fatal-error on PHP 7.4 because of
missing parent classes
---
.../Tests/CacheWarmer/ValidatorCacheWarmerTest.php | 5 +++++
.../Tests/Resource/ClassExistenceResourceTest.php | 9 +++++++++
.../Tests/Compiler/AutowirePassTest.php | 13 +++++++++++++
.../Tests/Compiler/ResolveBindingsPassTest.php | 5 +++++
.../Tests/Dumper/PhpDumperTest.php | 5 +++++
.../Tests/Loader/FileLoaderTest.php | 13 +++++++++++++
6 files changed, 50 insertions(+)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
index 868bd83cf7e32..416f4b6123a36 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
+use PHPUnit\Framework\Warning;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -26,6 +27,10 @@ class ValidatorCacheWarmerTest extends TestCase
public function testWarmUp()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$validatorBuilder = new ValidatorBuilder();
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');
diff --git a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
index 79bc64d69b9ad..5612e7ca24636 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Warning;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fixtures\BadParent;
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
@@ -77,6 +78,10 @@ public function testExistsKo()
public function testBadParentWithTimestamp()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$res = new ClassExistenceResource(BadParent::class, false);
$this->assertTrue($res->isFresh(time()));
}
@@ -87,6 +92,10 @@ public function testBadParentWithTimestamp()
*/
public function testBadParentWithNoTimestamp()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$res = new ClassExistenceResource(BadParent::class, false);
$res->isFresh(0);
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
index 31fa665ae7a85..85979f367e353 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Warning;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
@@ -395,6 +396,10 @@ public function testClassNotFoundThrowsException()
*/
public function testParentClassNotFoundThrowsException()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
$aDefinition = $container->register('a', __NAMESPACE__.'\BadParentTypeHintedArgument');
@@ -707,6 +712,10 @@ public function getCreateResourceTests()
public function testIgnoreServiceWithClassNotExisting()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
$container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass');
@@ -917,6 +926,10 @@ public function testExceptionWhenAliasExists()
*/
public function testExceptionWhenAliasDoesNotExist()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
// multiple I instances... but no IInterface alias
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
index 7bbecf6207f46..303e3abd49354 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Warning;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
@@ -69,6 +70,10 @@ public function testUnusedBinding()
*/
public function testMissingParent()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
$definition = $container->register(ParentNotExists::class, ParentNotExists::class);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index b4e361077308b..6a5cff1089fb3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
@@ -906,6 +907,10 @@ public function testInlineSelfRef()
public function testHotPathOptimizations()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = include self::$fixturesPath.'/containers/container_inline_requires.php';
$container->setParameter('inline_requires', true);
$container->compile();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index ee102c75bbbc9..8493642b4c84b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
@@ -112,6 +113,10 @@ public function testRegisterClasses()
public function testRegisterClassesWithExclude()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
$container->setParameter('other_dir', 'OtherDir');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@@ -141,6 +146,10 @@ public function testRegisterClassesWithExclude()
public function testNestedRegisterClasses()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@@ -169,6 +178,10 @@ public function testNestedRegisterClasses()
public function testMissingParentClass()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
+ }
+
$container = new ContainerBuilder();
$container->setParameter('bad_classes_dir', 'BadClasses');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
From abcd45a5877f7526c1c8e4b464a8e6e18365295d Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 1 Aug 2019 14:45:14 +0200
Subject: [PATCH 024/147] Add polyfill for TestCase::createMock()
---
.../Bridge/PhpUnit/ForwardCompatTestTrait.php | 11 ++++--
.../Legacy/ForwardCompatTestTraitForV5.php | 21 +++++++++++
.../Legacy/ForwardCompatTestTraitForV7.php | 35 +++++++++++++++++++
.../ValidatorDataCollectorTest.php | 8 ++---
.../Validator/TraceableValidatorTest.php | 8 ++---
5 files changed, 71 insertions(+), 12 deletions(-)
create mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
diff --git a/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php b/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
index bdff8c18829ba..29597bbe10cb0 100644
--- a/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
@@ -15,7 +15,14 @@
// A trait to provide forward compatibility with newest PHPUnit versions
-if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
+$r = new \ReflectionClass(TestCase::class);
+
+if (\PHP_VERSION_ID < 70000 || !$r->hasMethod('createMock') || !$r->getMethod('createMock')->hasReturnType()) {
+ trait ForwardCompatTestTrait
+ {
+ use Legacy\ForwardCompatTestTraitForV5;
+ }
+} elseif ($r->getMethod('tearDown')->hasReturnType()) {
trait ForwardCompatTestTrait
{
use Legacy\ForwardCompatTestTraitForV8;
@@ -23,6 +30,6 @@ trait ForwardCompatTestTrait
} else {
trait ForwardCompatTestTrait
{
- use Legacy\ForwardCompatTestTraitForV5;
+ use Legacy\ForwardCompatTestTraitForV7;
}
}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
index 5ef837434a948..36db32e55f657 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
@@ -11,6 +11,8 @@
namespace Symfony\Bridge\PhpUnit\Legacy;
+use PHPUnit\Framework\MockObject\MockObject;
+
/**
* @internal
*/
@@ -80,6 +82,25 @@ private function doTearDown()
parent::tearDown();
}
+ /**
+ * @param string $originalClassName
+ *
+ * @return MockObject
+ */
+ protected function createMock($originalClassName)
+ {
+ $mock = $this->getMockBuilder($originalClassName)
+ ->disableOriginalConstructor()
+ ->disableOriginalClone()
+ ->disableArgumentCloning();
+
+ if (method_exists($mock, 'disallowMockingUnknownTypes')) {
+ $mock = $mock->disallowMockingUnknownTypes();
+ }
+
+ return $mock->getMock();
+ }
+
/**
* @param string $message
*
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
new file mode 100644
index 0000000000000..84a26faebe99a
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+use PHPUnit\Framework\MockObject\MockObject;
+
+/**
+ * @internal
+ */
+trait ForwardCompatTestTraitForV7
+{
+ use ForwardCompatTestTraitForV5;
+
+ /**
+ * @param string|string[] $originalClassName
+ */
+ protected function createMock($originalClassName): MockObject
+ {
+ return $this->getMockBuilder($originalClassName)
+ ->disableOriginalConstructor()
+ ->disableOriginalClone()
+ ->disableArgumentCloning()
+ ->disallowMockingUnknownTypes()
+ ->getMock();
+ }
+}
diff --git a/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php b/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
index f32acf228bcc3..00407b3ab0f31 100644
--- a/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
+++ b/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\DataCollector;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\DataCollector\ValidatorDataCollector;
@@ -20,6 +21,8 @@
class ValidatorDataCollectorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCollectsValidatorCalls()
{
$originalValidator = $this->createMock(ValidatorInterface::class);
@@ -71,9 +74,4 @@ public function testReset()
$this->assertCount(0, $collector->getCalls());
$this->assertSame(0, $collector->getViolationsCount());
}
-
- protected function createMock($classname)
- {
- return $this->getMockBuilder($classname)->disableOriginalConstructor()->getMock();
- }
}
diff --git a/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
index b80efed27e7b7..2e76466b1c6b8 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Validator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
@@ -23,6 +24,8 @@
class TraceableValidatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testValidate()
{
$originalValidator = $this->createMock(ValidatorInterface::class);
@@ -95,9 +98,4 @@ public function testForwardsToOriginalValidator()
$expects('validatePropertyValue')->willReturn($expected = new ConstraintViolationList());
$this->assertSame($expected, $validator->validatePropertyValue(new \stdClass(), 'property', 'value'), 'returns original validator validatePropertyValue() result');
}
-
- protected function createMock($classname)
- {
- return $this->getMockBuilder($classname)->disableOriginalConstructor()->getMock();
- }
}
From 9f40b100e5f0abc8ab1bfba6d63918027f6ef9f9 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 1 Aug 2019 14:52:58 +0200
Subject: [PATCH 025/147] [Yaml] fix test for PHP 7.4
---
src/Symfony/Component/Yaml/Tests/ParserTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index d3217b6302ec6..1a60f7979a1ed 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -25,12 +25,12 @@ class ParserTest extends TestCase
/** @var Parser */
protected $parser;
- protected function setUp()
+ private function doSetUp()
{
$this->parser = new Parser();
}
- protected function tearDown()
+ private function doTearDown()
{
$this->parser = null;
From a0f68aa554a6ecf111a0cd1264f2f07b254b90cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 1 Aug 2019 16:07:07 +0200
Subject: [PATCH 026/147] Fix symfony/phpunit-bridge not up to date in phpunit
4.8 test suite
---
src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
index 7afcbeedc768d..85a2cde0cf118 100755
--- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
+++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
@@ -83,6 +83,8 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
}
+
+ passthru("$COMPOSER config --unset platform");
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
passthru("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path)));
From 41c02d7eadb50bb509e51342b88ac72b8362e7ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 1 Aug 2019 16:27:42 +0200
Subject: [PATCH 027/147] Replace calls to setExpectedException by Pollyfill
---
.../Security/User/EntityUserProviderTest.php | 17 ++--
.../Legacy/ForwardCompatTestTraitForV5.php | 93 +++++++++++++++++++
.../PhpUnit/Tests/ProcessIsolationTest.php | 11 +--
.../Extension/HttpKernelExtensionTest.php | 11 +--
.../DependencyInjection/ConfigurationTest.php | 11 +--
.../Compiler/AddSecurityVotersPassTest.php | 11 +--
.../UserPasswordEncoderCommandTest.php | 8 +-
.../Component/BrowserKit/Tests/CookieTest.php | 7 +-
.../Config/Tests/Definition/ArrayNodeTest.php | 11 +--
.../Tests/Definition/ScalarNodeTest.php | 19 ++--
.../Config/Tests/Util/XmlUtilsTest.php | 11 +--
.../Console/Tests/ApplicationTest.php | 16 +---
.../Console/Tests/Command/CommandTest.php | 10 +-
.../Formatter/OutputFormatterStyleTest.php | 7 +-
.../Console/Tests/Input/ArgvInputTest.php | 11 +--
.../Console/Tests/Input/ArrayInputTest.php | 11 +--
.../Console/Tests/Input/InputArgumentTest.php | 11 +--
.../Console/Tests/Input/InputOptionTest.php | 11 +--
.../CssSelector/Tests/Parser/ParserTest.php | 5 +-
.../Tests/Parser/TokenStreamTest.php | 7 +-
.../Tests/Compiler/AutowirePassTest.php | 11 +--
.../Tests/ContainerBuilderTest.php | 2 +-
.../Tests/DefinitionTest.php | 11 +--
.../Tests/Dumper/PhpDumperTest.php | 8 +-
.../Tests/ParameterBag/ParameterBagTest.php | 11 +--
.../Tests/GenericEventTest.php | 2 +-
.../ParserCache/ParserCacheAdapterTest.php | 17 ++--
.../Form/Tests/ButtonBuilderTest.php | 11 +--
.../Form/Tests/Command/DebugCommandTest.php | 11 +--
.../DateIntervalToArrayTransformerTest.php | 23 ++---
.../DateIntervalToStringTransformerTest.php | 11 ++-
...teTimeToLocalizedStringTransformerTest.php | 2 +-
.../DateTimeToStringTransformerTest.php | 11 ++-
.../DateTimeToTimestampTransformerTest.php | 7 +-
.../MoneyToLocalizedStringTransformerTest.php | 4 +-
...ercentToLocalizedStringTransformerTest.php | 4 +-
.../Core/Type/CollectionTypeTest.php | 5 +-
.../Component/Form/Tests/FormBuilderTest.php | 12 +--
.../Component/Form/Tests/FormConfigTest.php | 7 +-
.../HttpFoundation/Tests/File/FileTest.php | 5 +-
.../Tests/File/MimeType/MimeTypeTest.php | 6 +-
.../Tests/File/UploadedFileTest.php | 2 +-
.../HttpFoundation/Tests/RequestTest.php | 8 +-
.../Tests/Config/FileLocatorTest.php | 5 +-
.../ContainerControllerResolverTest.php | 11 +--
.../Controller/ControllerResolverTest.php | 11 +--
.../AbstractNumberFormatterTest.php | 6 +-
.../Intl/Tests/Util/GitRepositoryTest.php | 9 +-
.../Tests/Adapter/ExtLdap/AdapterTest.php | 5 +-
.../Tests/Adapter/ExtLdap/LdapManagerTest.php | 8 +-
src/Symfony/Component/Ldap/Tests/LdapTest.php | 2 +-
.../Tests/OptionsResolverTest.php | 8 +-
.../Tests/ProcessFailedExceptionTest.php | 11 +--
.../Component/Process/Tests/ProcessTest.php | 16 +---
.../Tests/Generator/UrlGeneratorTest.php | 5 +-
.../Routing/Tests/Matcher/UrlMatcherTest.php | 6 +-
.../AccessDecisionManagerTest.php | 11 +--
.../Tests/Encoder/XmlEncoderTest.php | 8 +-
.../Templating/Tests/PhpEngineTest.php | 2 +-
.../Tests/Catalogue/AbstractOperationTest.php | 5 +-
.../Tests/Loader/QtFileLoaderTest.php | 11 +--
.../Tests/Loader/XliffFileLoaderTest.php | 11 +--
.../Validator/Tests/ConstraintTest.php | 13 ++-
.../AbstractComparisonValidatorTestCase.php | 11 +--
.../Tests/Mapping/ClassMetadataTest.php | 4 +-
.../Tests/Mapping/GetterMetadataTest.php | 5 +-
.../Mapping/Loader/XmlFileLoaderTest.php | 7 +-
.../Mapping/Loader/YamlFileLoaderTest.php | 5 +-
.../Tests/Mapping/MemberMetadataTest.php | 2 +-
.../Tests/Mapping/PropertyMetadataTest.php | 7 +-
.../Component/Yaml/Tests/InlineTest.php | 22 +----
.../Component/Yaml/Tests/ParserTest.php | 14 +--
72 files changed, 393 insertions(+), 338 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
index e88a0a715c391..54a20bec33d34 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
@@ -16,9 +16,12 @@
use Symfony\Bridge\Doctrine\Security\User\EntityUserProvider;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Bridge\Doctrine\Tests\Fixtures\User;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class EntityUserProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testRefreshUserGetsUserByPrimaryKey()
{
$em = DoctrineTestHelper::createTestEntityManager();
@@ -105,10 +108,9 @@ public function testRefreshUserRequiresId()
$user1 = new User(null, null, 'user1');
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
- 'InvalidArgumentException',
- 'You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine'
- );
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine');
+
$provider->refreshUser($user1);
}
@@ -125,10 +127,9 @@ public function testRefreshInvalidUser()
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
$user2 = new User(1, 2, 'user2');
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
- 'Symfony\Component\Security\Core\Exception\UsernameNotFoundException',
- 'User with id {"id1":1,"id2":2} not found'
- );
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
+ $this->expectExceptionMessage('User with id {"id1":1,"id2":2} not found');
+
$provider->refreshUser($user2);
}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
index 36db32e55f657..83f7db407af85 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
@@ -12,12 +12,16 @@
namespace Symfony\Bridge\PhpUnit\Legacy;
use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
/**
* @internal
*/
trait ForwardCompatTestTraitForV5
{
+ private $forwardCompatExpectedExceptionMessage = '';
+ private $forwardCompatExpectedExceptionCode = null;
+
/**
* @return void
*/
@@ -210,4 +214,93 @@ public static function assertIsIterable($actual, $message = '')
{
static::assertInternalType('iterable', $actual, $message);
}
+
+ /**
+ * @param string $exception
+ *
+ * @return void
+ */
+ public function expectException($exception)
+ {
+ if (method_exists(TestCase::class, 'expectException')) {
+ parent::expectException($exception);
+
+ return;
+ }
+
+ parent::setExpectedException($exception, $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
+ }
+
+ /**
+ * @return void
+ */
+ public function expectExceptionCode($code)
+ {
+ if (method_exists(TestCase::class, 'expectExceptionCode')) {
+ parent::expectExceptionCode($code);
+
+ return;
+ }
+
+ $this->forwardCompatExpectedExceptionCode = $code;
+ parent::setExpectedException(parent::getExpectedException(), $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public function expectExceptionMessage($message)
+ {
+ if (method_exists(TestCase::class, 'expectExceptionMessage')) {
+ parent::expectExceptionMessage($message);
+
+ return;
+ }
+
+ $this->forwardCompatExpectedExceptionMessage = $message;
+ parent::setExpectedException(parent::getExpectedException(), $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
+ }
+
+ /**
+ * @param string $messageRegExp
+ *
+ * @return void
+ */
+ public function expectExceptionMessageRegExp($messageRegExp)
+ {
+ if (method_exists(TestCase::class, 'expectExceptionMessageRegExp')) {
+ parent::expectExceptionMessageRegExp($messageRegExp);
+
+ return;
+ }
+
+ parent::setExpectedExceptionRegExp(parent::getExpectedException(), $messageRegExp, $this->forwardCompatExpectedExceptionCode);
+ }
+
+ /**
+ * @param string $exceptionMessage
+ *
+ * @return void
+ */
+ public function setExpectedException($exceptionName, $exceptionMessage = '', $exceptionCode = null)
+ {
+ $this->forwardCompatExpectedExceptionMessage = $exceptionMessage;
+ $this->forwardCompatExpectedExceptionCode = $exceptionCode;
+
+ parent::setExpectedException($exceptionName, $exceptionMessage, $exceptionCode);
+ }
+
+ /**
+ * @param string $exceptionMessageRegExp
+ *
+ * @return void
+ */
+ public function setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp = '', $exceptionCode = null)
+ {
+ $this->forwardCompatExpectedExceptionCode = $exceptionCode;
+
+ parent::setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp, $exceptionCode);
+ }
}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
index ec8f124a5f2c1..b75ff1cfc0c5d 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Bridge\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* Don't remove this test case, it tests the legacy group.
@@ -13,6 +14,8 @@
*/
class ProcessIsolationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedDeprecation Test abc
*/
@@ -25,12 +28,8 @@ public function testIsolation()
public function testCallingOtherErrorHandler()
{
$class = class_exists('PHPUnit\Framework\Exception') ? 'PHPUnit\Framework\Exception' : 'PHPUnit_Framework_Exception';
- if (method_exists($this, 'expectException')) {
- $this->expectException($class);
- $this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.');
- } else {
- $this->setExpectedException($class, 'Test that PHPUnit\'s error handler fires.');
- }
+ $this->expectException($class);
+ $this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.');
trigger_error('Test that PHPUnit\'s error handler fires.', E_USER_WARNING);
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
index 22084ec1ae616..d3d64f053897b 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\HttpKernelExtension;
use Symfony\Bridge\Twig\Extension\HttpKernelRuntime;
use Symfony\Component\HttpFoundation\Request;
@@ -22,6 +23,8 @@
class HttpKernelExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \Twig\Error\RuntimeError
*/
@@ -49,12 +52,8 @@ public function testUnknownFragmentRenderer()
;
$renderer = new FragmentHandler($context);
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('The "inline" renderer does not exist.');
- } else {
- $this->setExpectedException('InvalidArgumentException', 'The "inline" renderer does not exist.');
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "inline" renderer does not exist.');
$renderer->render('/foo');
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
index b1dea4cba4b01..b64efd67de01b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
use Symfony\Bundle\FullStack;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
@@ -20,6 +21,8 @@
class ConfigurationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDefaultConfig()
{
$processor = new Processor();
@@ -245,12 +248,8 @@ public function provideValidAssetsPackageNameConfigurationTests()
*/
public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMessage)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException(InvalidConfigurationException::class);
- $this->expectExceptionMessage($expectedMessage);
- } else {
- $this->setExpectedException(InvalidConfigurationException::class, $expectedMessage);
- }
+ $this->expectException(InvalidConfigurationException::class);
+ $this->expectExceptionMessage($expectedMessage);
$processor = new Processor();
$configuration = new Configuration(true);
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
index 5a92b2c714075..a97054cd70c82 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddSecurityVotersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
@@ -21,6 +22,8 @@
class AddSecurityVotersPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
*/
@@ -101,12 +104,8 @@ public function testVoterMissingInterfaceAndMethod()
$exception = LogicException::class;
$message = 'stdClass should implement the Symfony\Component\Security\Core\Authorization\Voter\VoterInterface interface when used as voter.';
- if (method_exists($this, 'expectException')) {
- $this->expectException($exception);
- $this->expectExceptionMessage($message);
- } else {
- $this->setExpectedException($exception, $message);
- }
+ $this->expectException($exception);
+ $this->expectExceptionMessage($message);
$container = new ContainerBuilder();
$container
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
index 05413b805b0e9..0380f5cb1295f 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
@@ -170,12 +170,8 @@ public function testEncodePasswordArgon2iOutput()
public function testEncodePasswordNoConfigForGivenUserClass()
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('\RuntimeException');
- $this->expectExceptionMessage('No encoder has been configured for account "Foo\Bar\User".');
- } else {
- $this->setExpectedException('\RuntimeException', 'No encoder has been configured for account "Foo\Bar\User".');
- }
+ $this->expectException('\RuntimeException');
+ $this->expectExceptionMessage('No encoder has been configured for account "Foo\Bar\User".');
$this->passwordEncoderCommandTester->execute([
'command' => 'security:encode-password',
diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
index 1ffa1d87ed3b6..11acfa8471522 100644
--- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\BrowserKit\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\BrowserKit\Cookie;
class CookieTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testToString()
{
$cookie = new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
@@ -100,7 +103,7 @@ public function testFromStringWithUrl()
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
Cookie::fromString('foo');
}
@@ -113,7 +116,7 @@ public function testFromStringIgnoresInvalidExpiresDate()
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
Cookie::fromString('foo=bar', 'foobar');
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
index 8f84cff388284..2440a2eb9537c 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\ScalarNode;
class ArrayNodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
@@ -55,12 +58,8 @@ public function ignoreAndRemoveMatrixProvider()
public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $message = '')
{
if ($expected instanceof \Exception) {
- if (method_exists($this, 'expectException')) {
- $this->expectException(\get_class($expected));
- $this->expectExceptionMessage($expected->getMessage());
- } else {
- $this->setExpectedException(\get_class($expected), $expected->getMessage());
- }
+ $this->expectException(\get_class($expected));
+ $this->expectExceptionMessage($expected->getMessage());
}
$node = new ArrayNode('root');
$node->setIgnoreExtraKeys($ignore, $remove);
diff --git a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
index ada5b04be9423..36f25667ce319 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\ScalarNode;
class ScalarNodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getValidValues
*/
@@ -95,12 +98,8 @@ public function testNormalizeThrowsExceptionWithoutHint()
{
$node = new ScalarNode('test');
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
- $this->expectExceptionMessage('Invalid type for path "test". Expected scalar, but got array.');
- } else {
- $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
- }
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
+ $this->expectExceptionMessage('Invalid type for path "test". Expected scalar, but got array.');
$node->normalize([]);
}
@@ -110,12 +109,8 @@ public function testNormalizeThrowsExceptionWithErrorMessage()
$node = new ScalarNode('test');
$node->setInfo('"the test value"');
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
- $this->expectExceptionMessage("Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
- } else {
- $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
- }
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
+ $this->expectExceptionMessage("Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
$node->normalize([]);
}
diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
index 0a6637f78536c..8c5d0a957f0f2 100644
--- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
+++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Util;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Util\XmlUtils;
class XmlUtilsTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoadFile()
{
$fixtures = __DIR__.'/../Fixtures/Util/';
@@ -166,12 +169,8 @@ public function testLoadEmptyXmlFile()
{
$file = __DIR__.'/../Fixtures/foo.xml';
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage(sprintf('File %s does not contain valid XML, it is empty.', $file));
- } else {
- $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('File %s does not contain valid XML, it is empty.', $file));
XmlUtils::loadFile($file);
}
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 8ea7870141823..362c549d9b11d 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -314,12 +314,8 @@ public function testFindAmbiguousNamespace()
$expectedMsg = "The namespace \"f\" is ambiguous.\nDid you mean one of these?\n foo\n foo1";
- if (method_exists($this, 'expectException')) {
- $this->expectException(CommandNotFoundException::class);
- $this->expectExceptionMessage($expectedMsg);
- } else {
- $this->setExpectedException(CommandNotFoundException::class, $expectedMsg);
- }
+ $this->expectException(CommandNotFoundException::class);
+ $this->expectExceptionMessage($expectedMsg);
$application->findNamespace('f');
}
@@ -423,12 +419,8 @@ public function testFindWithCommandLoader()
public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage)
{
putenv('COLUMNS=120');
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
- $this->expectExceptionMessage($expectedExceptionMessage);
- } else {
- $this->setExpectedException('Symfony\Component\Console\Exception\CommandNotFoundException', $expectedExceptionMessage);
- }
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
$application = new Application();
$application->add(new \FooCommand());
diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
index 23e3ed581094a..9cb7e45dd7892 100644
--- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
@@ -120,12 +120,8 @@ public function testGetNamespaceGetNameSetName()
*/
public function testInvalidCommandNames($name)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name));
- } else {
- $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name));
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name));
$command = new \TestCommand();
$command->setName($name);
@@ -191,7 +187,7 @@ public function testGetSetAliases()
public function testSetAliasesNull()
{
$command = new \TestCommand();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
$command->setAliases(null);
}
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
index d47760fe4e3e7..2620ddbc86035 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Console\Tests\Formatter;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class OutputFormatterStyleTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$style = new OutputFormatterStyle('green', 'black', ['bold', 'underscore']);
@@ -41,7 +44,7 @@ public function testForeground()
$style->setForeground('default');
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
$style->setForeground('undefined-color');
}
@@ -58,7 +61,7 @@ public function testBackground()
$style->setBackground('default');
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
$style->setBackground('undefined-color');
}
diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
index e20bcdd21bc7c..40f3e2fdc07b1 100644
--- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
@@ -19,6 +20,8 @@
class ArgvInputTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$_SERVER['argv'] = ['cli.php', 'foo'];
@@ -182,12 +185,8 @@ public function provideOptions()
*/
public function testInvalidInput($argv, $definition, $expectedExceptionMessage)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('RuntimeException');
- $this->expectExceptionMessage($expectedExceptionMessage);
- } else {
- $this->setExpectedException('RuntimeException', $expectedExceptionMessage);
- }
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
$input = new ArgvInput($argv);
$input->bind($definition);
diff --git a/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
index afe74831e367a..b46e48e27c7f0 100644
--- a/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
@@ -19,6 +20,8 @@
class ArrayInputTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetFirstArgument()
{
$input = new ArrayInput([]);
@@ -127,12 +130,8 @@ public function provideOptions()
*/
public function testParseInvalidInput($parameters, $definition, $expectedExceptionMessage)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage($expectedExceptionMessage);
- } else {
- $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
new ArrayInput($parameters, $definition);
}
diff --git a/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php b/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
index 7561e10abe362..7bd0cff1abf44 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\InputArgument;
class InputArgumentTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$argument = new InputArgument('foo');
@@ -42,12 +45,8 @@ public function testModes()
*/
public function testInvalidModes($mode)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode));
- } else {
- $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode));
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode));
new InputArgument('foo', $mode);
}
diff --git a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
index 413cb5270078f..78363806f29bf 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\InputOption;
class InputOptionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$option = new InputOption('foo');
@@ -78,12 +81,8 @@ public function testModes()
*/
public function testInvalidModes($mode)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode));
- } else {
- $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode));
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode));
new InputOption('foo', 'f', $mode);
}
diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
index de3509348c051..8a83d661018e9 100644
--- a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\CssSelector\Tests\Parser;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\Node\SelectorNode;
@@ -20,6 +21,8 @@
class ParserTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @dataProvider getParserTestData */
public function testParser($source, $representation)
{
@@ -89,7 +92,7 @@ public function testParseSeriesException($series)
/** @var FunctionNode $function */
$function = $selectors[0]->getTree();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
Parser::parseSeries($function->getArguments());
}
diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
index 44c751ac865d2..a94fa7be5f9be 100644
--- a/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\CssSelector\Tests\Parser;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\Parser\Token;
use Symfony\Component\CssSelector\Parser\TokenStream;
class TokenStreamTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetNext()
{
$stream = new TokenStream();
@@ -53,7 +56,7 @@ public function testGetNextIdentifier()
public function testFailToGetNextIdentifier()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
$stream = new TokenStream();
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -73,7 +76,7 @@ public function testGetNextIdentifierOrStar()
public function testFailToGetNextIdentifierOrStar()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
$stream = new TokenStream();
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
index 85979f367e353..ce834f5c49c88 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
@@ -33,6 +34,8 @@
*/
class AutowirePassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -841,12 +844,8 @@ public function testNotWireableCalls($method, $expectedMsg)
$foo->addMethodCall($method, []);
}
- if (method_exists($this, 'expectException')) {
- $this->expectException(RuntimeException::class);
- $this->expectExceptionMessage($expectedMsg);
- } else {
- $this->setExpectedException(RuntimeException::class, $expectedMsg);
- }
+ $this->expectException(RuntimeException::class);
+ $this->expectExceptionMessage($expectedMsg);
(new ResolveClassPass())->process($container);
(new AutowireRequiredMethodsPass())->process($container);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index de0bede4c98c7..a811ac8c36df3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -1056,7 +1056,7 @@ public function testExtension()
$container->registerExtension($extension = new \ProjectExtension());
$this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension');
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
+ $this->expectException('LogicException');
$container->getExtension('no_registered');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
index 3581fe855037e..d1f13dc7b8d82 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Definition;
class DefinitionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$def = new Definition('stdClass');
@@ -69,12 +72,8 @@ public function testSetGetDecoratedService()
$def = new Definition('stdClass');
- if (method_exists($this, 'expectException')) {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('The decorated service inner name for "foo" must be different than the service name itself.');
- } else {
- $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.');
- }
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The decorated service inner name for "foo" must be different than the service name itself.');
$def->setDecoratedService('foo', 'foo');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index 6a5cff1089fb3..4140894fce021 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -550,12 +550,8 @@ public function testCircularReferenceAllowanceForLazyServices()
$dumper = new PhpDumper($container);
$message = 'Circular reference detected for service "foo", path: "foo -> bar -> foo". Try running "composer require symfony/proxy-manager-bridge".';
- if (method_exists($this, 'expectException')) {
- $this->expectException(ServiceCircularReferenceException::class);
- $this->expectExceptionMessage($message);
- } else {
- $this->setExpectedException(ServiceCircularReferenceException::class, $message);
- }
+ $this->expectException(ServiceCircularReferenceException::class);
+ $this->expectExceptionMessage($message);
$dumper->dump();
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php
index e67e393df7798..31a1957c1388b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -19,6 +20,8 @@
class ParameterBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$bag = new ParameterBag($parameters = [
@@ -78,12 +81,8 @@ public function testGetThrowParameterNotFoundException($parameterKey, $exception
'fiz' => ['bar' => ['boo' => 12]],
]);
- if (method_exists($this, 'expectException')) {
- $this->expectException(ParameterNotFoundException::class);
- $this->expectExceptionMessage($exceptionMessage);
- } else {
- $this->setExpectedException(ParameterNotFoundException::class, $exceptionMessage);
- }
+ $this->expectException(ParameterNotFoundException::class);
+ $this->expectExceptionMessage($exceptionMessage);
$bag->get($parameterKey);
}
diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
index e2f3c481ee951..dfcd2431ecb4d 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
@@ -95,7 +95,7 @@ public function testOffsetGet()
$this->assertEquals('Event', $this->event['name']);
// test getting invalid arg
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
$this->assertFalse($this->event['nameNotExist']);
}
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php
index b75224c8a09e9..d5373636232ff 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\Node\Node;
use Symfony\Component\ExpressionLanguage\ParsedExpression;
use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter;
@@ -21,6 +22,8 @@
*/
class ParserCacheAdapterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetItem()
{
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
@@ -75,7 +78,7 @@ public function testGetItems()
{
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->getItems();
}
@@ -85,7 +88,7 @@ public function testHasItem()
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$key = 'key';
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->hasItem($key);
}
@@ -94,7 +97,7 @@ public function testClear()
{
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->clear();
}
@@ -104,7 +107,7 @@ public function testDeleteItem()
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$key = 'key';
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->deleteItem($key);
}
@@ -114,7 +117,7 @@ public function testDeleteItems()
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$keys = ['key'];
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->deleteItems($keys);
}
@@ -124,7 +127,7 @@ public function testSaveDeferred()
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
$cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->saveDeferred($cacheItemMock);
}
@@ -133,7 +136,7 @@ public function testCommit()
{
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
$parserCacheAdapter = new ParserCacheAdapter($poolMock);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(\BadMethodCallException::class);
+ $this->expectException(\BadMethodCallException::class);
$parserCacheAdapter->commit();
}
diff --git a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
index ced54a4588b59..f012868c734d5 100644
--- a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\Exception\InvalidArgumentException;
@@ -20,6 +21,8 @@
*/
class ButtonBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function getValidNames()
{
return [
@@ -54,12 +57,8 @@ public function getInvalidNames()
*/
public function testInvalidNames($name)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Buttons cannot have empty names.');
- } else {
- $this->setExpectedException(InvalidArgumentException::class, 'Buttons cannot have empty names.');
- }
+ $this->expectException(InvalidArgumentException::class);
+ $this->expectExceptionMessage('Buttons cannot have empty names.');
new ButtonBuilder($name);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
index 1e7ce7985379a..77ab8e73b0411 100644
--- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Tester\CommandTester;
@@ -21,6 +22,8 @@
class DebugCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDebugDefaults()
{
$tester = $this->createCommandTester();
@@ -68,12 +71,8 @@ public function testDebugAmbiguousFormType()
Symfony\Component\Form\Tests\Fixtures\Debug\B\AmbiguousType
TXT;
- if (method_exists($this, 'expectException')) {
- $this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage($expectedMessage);
- } else {
- $this->setExpectedException(InvalidArgumentException::class, $expectedMessage);
- }
+ $this->expectException(InvalidArgumentException::class);
+ $this->expectExceptionMessage($expectedMessage);
$tester = $this->createCommandTester([
'Symfony\Component\Form\Tests\Fixtures\Debug\A',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php
index ead142709d75a..99c6f57f9ad37 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToArrayTransformer;
@@ -20,6 +21,8 @@
*/
class DateIntervalToArrayTransformerTest extends DateIntervalTestCase
{
+ use ForwardCompatTestTrait;
+
public function testTransform()
{
$transformer = new DateIntervalToArrayTransformer();
@@ -176,7 +179,7 @@ public function testReverseTransformRequiresDateTime()
{
$transformer = new DateIntervalToArrayTransformer();
$this->assertNull($transformer->reverseTransform(null));
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
+ $this->expectException(UnexpectedTypeException::class);
$transformer->reverseTransform('12345');
}
@@ -184,7 +187,7 @@ public function testReverseTransformWithUnsetFields()
{
$transformer = new DateIntervalToArrayTransformer();
$input = ['years' => '1'];
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
+ $this->expectException(TransformationFailedException::class);
$transformer->reverseTransform($input);
}
@@ -196,12 +199,8 @@ public function testReverseTransformWithEmptyFields()
'minutes' => '',
'seconds' => '6',
];
- if (method_exists($this, 'expectException')) {
- $this->expectException(TransformationFailedException::class);
- $this->expectExceptionMessage('This amount of "minutes" is invalid');
- } else {
- $this->setExpectedException(TransformationFailedException::class, 'This amount of "minutes" is invalid');
- }
+ $this->expectException(TransformationFailedException::class);
+ $this->expectExceptionMessage('This amount of "minutes" is invalid');
$transformer->reverseTransform($input);
}
@@ -211,12 +210,8 @@ public function testReverseTransformWithWrongInvertType()
$input = [
'invert' => '1',
];
- if (method_exists($this, 'expectException')) {
- $this->expectException(TransformationFailedException::class);
- $this->expectExceptionMessage('The value of "invert" must be boolean');
- } else {
- $this->setExpectedException(TransformationFailedException::class, 'The value of "invert" must be boolean');
- }
+ $this->expectException(TransformationFailedException::class);
+ $this->expectExceptionMessage('The value of "invert" must be boolean');
$transformer->reverseTransform($input);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php
index 84b037838c65f..796ba0d3793d9 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToStringTransformer;
@@ -20,6 +21,8 @@
*/
class DateIntervalToStringTransformerTest extends DateIntervalTestCase
{
+ use ForwardCompatTestTrait;
+
public function dataProviderISO()
{
$data = [
@@ -75,7 +78,7 @@ public function testTransformEmpty()
public function testTransformExpectsDateTime()
{
$transformer = new DateIntervalToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
+ $this->expectException(UnexpectedTypeException::class);
$transformer->transform('1234');
}
@@ -96,7 +99,7 @@ public function testReverseTransformDateString($format, $input, $output)
{
$reverseTransformer = new DateIntervalToStringTransformer($format, true);
$interval = new \DateInterval($output);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
+ $this->expectException(TransformationFailedException::class);
$this->assertDateIntervalEquals($interval, $reverseTransformer->reverseTransform($input));
}
@@ -109,14 +112,14 @@ public function testReverseTransformEmpty()
public function testReverseTransformExpectsString()
{
$reverseTransformer = new DateIntervalToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
+ $this->expectException(UnexpectedTypeException::class);
$reverseTransformer->reverseTransform(1234);
}
public function testReverseTransformExpectsValidIntervalString()
{
$reverseTransformer = new DateIntervalToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
+ $this->expectException(TransformationFailedException::class);
$reverseTransformer->reverseTransform('10Y');
}
}
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 ec73a64950e93..c074fe88d1701 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
@@ -192,7 +192,7 @@ public function testTransformWrapsIntlErrors()
// HOW TO REPRODUCE?
- //$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
+ //$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
//$transformer->transform(1.5);
}
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 87587bda3af20..4158045ddb4c2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
class DateTimeToStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function dataProvider()
{
$data = [
@@ -111,7 +114,7 @@ public function testTransformExpectsDateTime()
{
$transformer = new DateTimeToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer->transform('1234');
}
@@ -150,7 +153,7 @@ public function testReverseTransformExpectsString()
{
$reverseTransformer = new DateTimeToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$reverseTransformer->reverseTransform(1234);
}
@@ -159,7 +162,7 @@ public function testReverseTransformExpectsValidDateString()
{
$reverseTransformer = new DateTimeToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$reverseTransformer->reverseTransform('2010-2010-2010');
}
@@ -168,7 +171,7 @@ public function testReverseTransformWithNonExistingDate()
{
$reverseTransformer = new DateTimeToStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$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 ecd5b70b97de6..cc184dc278694 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
class DateTimeToTimestampTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testTransform()
{
$transformer = new DateTimeToTimestampTransformer('UTC', 'UTC');
@@ -72,7 +75,7 @@ public function testTransformExpectsDateTime()
{
$transformer = new DateTimeToTimestampTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer->transform('1234');
}
@@ -109,7 +112,7 @@ public function testReverseTransformExpectsValidTimestamp()
{
$reverseTransformer = new DateTimeToTimestampTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$reverseTransformer->reverseTransform('2010-2010-2010');
}
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 c7f61705f97b5..14a4aee7c1ea5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
@@ -48,7 +48,7 @@ public function testTransformExpectsNumeric()
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer->transform('abcd');
}
@@ -76,7 +76,7 @@ public function testReverseTransformExpectsString()
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer->reverseTransform(12345);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
index e9bfa8704360f..e2dfc481b3514 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
@@ -115,7 +115,7 @@ public function testTransformExpectsNumeric()
{
$transformer = new PercentToLocalizedStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer->transform('foo');
}
@@ -124,7 +124,7 @@ public function testReverseTransformExpectsString()
{
$transformer = new PercentToLocalizedStringTransformer();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer->reverseTransform(1);
}
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 50355a1d64542..85c6e99495492 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Tests\Fixtures\Author;
use Symfony\Component\Form\Tests\Fixtures\AuthorType;
class CollectionTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CollectionType';
public function testContainsNoChildByDefault()
@@ -61,7 +64,7 @@ public function testThrowsExceptionIfObjectIsNotTraversable()
$form = $this->factory->create(static::TESTED_TYPE, null, [
'entry_type' => TextTypeTest::TESTED_TYPE,
]);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$form->setData(new \stdClass());
}
diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
index 4bf4a6dad9a0e..36b2777e4196a 100644
--- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
@@ -52,13 +52,13 @@ public function testNoSetName()
public function testAddNameNoStringAndNoInteger()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$this->builder->add(true);
}
public function testAddTypeNoString()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$this->builder->add('foo', 1234);
}
@@ -170,12 +170,8 @@ public function testAddButton()
public function testGetUnknown()
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
- $this->expectExceptionMessage('The child with the name "foo" does not exist.');
- } else {
- $this->setExpectedException('Symfony\Component\Form\Exception\InvalidArgumentException', 'The child with the name "foo" does not exist.');
- }
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The child with the name "foo" does not exist.');
$this->builder->get('foo');
}
diff --git a/src/Symfony/Component/Form/Tests/FormConfigTest.php b/src/Symfony/Component/Form/Tests/FormConfigTest.php
index db32fb1a1e631..55405f0f1470e 100644
--- a/src/Symfony/Component/Form/Tests/FormConfigTest.php
+++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormConfigBuilder;
/**
@@ -19,6 +20,8 @@
*/
class FormConfigTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function getHtml4Ids()
{
return [
@@ -72,10 +75,8 @@ public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $expectedExcept
{
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
- if (null !== $expectedException && method_exists($this, 'expectException')) {
+ if (null !== $expectedException) {
$this->expectException($expectedException);
- } elseif (null !== $expectedException) {
- $this->setExpectedException($expectedException);
}
$formConfigBuilder = new FormConfigBuilder($name, null, $dispatcher);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
index caf2029927008..1f2582145613e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\HttpFoundation\Tests\File;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
class FileTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
protected $file;
public function testGetMimeTypeUsesMimeTypeGuessers()
@@ -64,7 +67,7 @@ public function testGuessExtensionWithReset()
public function testConstructWhenFileNotExists()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
new File(__DIR__.'/Fixtures/not_here');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
index 9f3c87c9806e5..299fc7a24be3f 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
@@ -32,7 +32,7 @@ public function testGuessImageWithoutExtension()
public function testGuessImageWithDirectory()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
}
@@ -56,7 +56,7 @@ public function testGuessFileWithUnknownExtension()
public function testGuessWithIncorrectPath()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
}
@@ -75,7 +75,7 @@ public function testGuessWithNonReadablePath()
@chmod($path, 0333);
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
MimeTypeGuesser::getInstance()->guess($path);
} else {
$this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
index f886ebcd11f89..3a203b4dac494 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
@@ -28,7 +28,7 @@ private function doSetUp()
public function testConstructWhenFileNotExists()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
new UploadedFile(
__DIR__.'/Fixtures/not_here',
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 3f7ba60179e8b..e0e719d38c50e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -2121,12 +2121,8 @@ public function testHostValidity($host, $isValid, $expectedHost = null, $expecte
$this->assertSame($expectedPort, $request->getPort());
}
} else {
- if (method_exists($this, 'expectException')) {
- $this->expectException(SuspiciousOperationException::class);
- $this->expectExceptionMessage('Invalid Host');
- } else {
- $this->setExpectedException(SuspiciousOperationException::class, 'Invalid Host');
- }
+ $this->expectException(SuspiciousOperationException::class);
+ $this->expectExceptionMessage('Invalid Host');
$request->getHost();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
index b20b12ab59ed6..c1c0b58f9edea 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\HttpKernel\Tests\Config;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Config\FileLocator;
class FileLocatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLocate()
{
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
@@ -30,7 +33,7 @@ public function testLocate()
$kernel
->expects($this->never())
->method('locateResource');
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
+ $this->expectException('LogicException');
$locator->locate('/some/path');
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
index 098b89f9e1255..ea26738e7c2ff 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
@@ -13,6 +13,7 @@
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpFoundation\Request;
@@ -20,6 +21,8 @@
class ContainerControllerResolverTest extends ControllerResolverTest
{
+ use ForwardCompatTestTrait;
+
public function testGetControllerService()
{
$container = $this->createMockContainer();
@@ -237,12 +240,8 @@ public function testGetControllerOnNonUndefinedFunction($controller, $exceptionN
{
// All this logic needs to be duplicated, since calling parent::testGetControllerOnNonUndefinedFunction will override the expected excetion and not use the regex
$resolver = $this->createControllerResolver();
- if (method_exists($this, 'expectException')) {
- $this->expectException($exceptionName);
- $this->expectExceptionMessageRegExp($exceptionMessage);
- } else {
- $this->setExpectedExceptionRegExp($exceptionName, $exceptionMessage);
- }
+ $this->expectException($exceptionName);
+ $this->expectExceptionMessageRegExp($exceptionMessage);
$request = Request::create('/');
$request->attributes->set('_controller', $controller);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
index 6a28eab26bb52..8912f151eb45f 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController;
@@ -20,6 +21,8 @@
class ControllerResolverTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetControllerWithoutControllerParameter()
{
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
@@ -118,12 +121,8 @@ public function testGetControllerWithFunction()
public function testGetControllerOnNonUndefinedFunction($controller, $exceptionName = null, $exceptionMessage = null)
{
$resolver = $this->createControllerResolver();
- if (method_exists($this, 'expectException')) {
- $this->expectException($exceptionName);
- $this->expectExceptionMessage($exceptionMessage);
- } else {
- $this->setExpectedException($exceptionName, $exceptionMessage);
- }
+ $this->expectException($exceptionName);
+ $this->expectExceptionMessage($exceptionMessage);
$request = Request::create('/');
$request->attributes->set('_controller', $controller);
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index 52e02f6667a8d..34d4256f3d505 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -332,7 +332,7 @@ public function testFormatTypeCurrency($formatter, $value)
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
}
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
+ $this->expectException($exceptionCode);
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
}
@@ -715,7 +715,7 @@ public function testParseTypeDefault()
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
}
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
+ $this->expectException($exceptionCode);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
@@ -841,7 +841,7 @@ public function testParseTypeCurrency()
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
}
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
+ $this->expectException($exceptionCode);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);
diff --git a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
index a47495f6a5c56..8c08b82fd58af 100644
--- a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
+++ b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Intl\Tests\Util;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Exception\RuntimeException;
use Symfony\Component\Intl\Util\GitRepository;
@@ -21,6 +22,8 @@
*/
class GitRepositoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private $targetDir;
const REPO_URL = 'https://github.com/symfony/intl.git';
@@ -39,11 +42,7 @@ protected function cleanup()
public function testItThrowsAnExceptionIfInitialisedWithNonGitDirectory()
{
- if (method_exists($this, 'expectException')) {
- $this->expectException(RuntimeException::class);
- } else {
- $this->setExpectedException(RuntimeException::class);
- }
+ $this->expectException(RuntimeException::class);
@mkdir($this->targetDir, 0777, true);
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php
index 18d1c02d488e1..173461357d9c5 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Ldap\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
use Symfony\Component\Ldap\Adapter\ExtLdap\Query;
@@ -23,6 +24,8 @@
*/
class AdapterTest extends LdapTestCase
{
+ use ForwardCompatTestTrait;
+
public function testLdapEscape()
{
$ldap = new Adapter();
@@ -74,7 +77,7 @@ public function testLdapQueryIterator()
public function testLdapQueryWithoutBind()
{
$ldap = new Adapter($this->getLdapConfig());
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
+ $this->expectException(NotBoundException::class);
$query = $ldap->createQuery('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))', []);
$query->execute();
}
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
index 547789aaa94dc..089b83b40b9e7 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
@@ -62,7 +62,7 @@ public function testLdapAddAndRemove()
*/
public function testLdapAddInvalidEntry()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class);
+ $this->expectException(LdapException::class);
$this->executeSearchQuery(1);
// The entry is missing a subject name
@@ -108,7 +108,7 @@ public function testLdapUpdate()
public function testLdapUnboundAdd()
{
$this->adapter = new Adapter($this->getLdapConfig());
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
+ $this->expectException(NotBoundException::class);
$em = $this->adapter->getEntryManager();
$em->add(new Entry(''));
}
@@ -119,7 +119,7 @@ public function testLdapUnboundAdd()
public function testLdapUnboundRemove()
{
$this->adapter = new Adapter($this->getLdapConfig());
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
+ $this->expectException(NotBoundException::class);
$em = $this->adapter->getEntryManager();
$em->remove(new Entry(''));
}
@@ -130,7 +130,7 @@ public function testLdapUnboundRemove()
public function testLdapUnboundUpdate()
{
$this->adapter = new Adapter($this->getLdapConfig());
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
+ $this->expectException(NotBoundException::class);
$em = $this->adapter->getEntryManager();
$em->update(new Entry(''));
}
diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php
index f25593d8f75ec..ac8453fbd763f 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php
@@ -81,7 +81,7 @@ public function testLdapCreate()
public function testCreateWithInvalidAdapterName()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(DriverNotFoundException::class);
+ $this->expectException(DriverNotFoundException::class);
Ldap::create('foo');
}
}
diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
index 259128ebd7ea9..2f69cc14deec5 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
@@ -549,12 +549,8 @@ public function testResolveFailsIfInvalidType($actualType, $allowedType, $except
$this->resolver->setDefined('option');
$this->resolver->setAllowedTypes('option', $allowedType);
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
- $this->expectExceptionMessage($exceptionMessage);
- } else {
- $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException', $exceptionMessage);
- }
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage($exceptionMessage);
$this->resolver->resolve(['option' => $actualType]);
}
diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
index ff0ea508e50f0..f9df9ff294a7f 100644
--- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\Exception\ProcessFailedException;
/**
@@ -19,6 +20,8 @@
*/
class ProcessFailedExceptionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* tests ProcessFailedException throws exception if the process was successful.
*/
@@ -29,12 +32,8 @@ public function testProcessFailedExceptionThrowsException()
->method('isSuccessful')
->willReturn(true);
- if (method_exists($this, 'expectException')) {
- $this->expectException(\InvalidArgumentException::class);
- $this->expectExceptionMessage('Expected a failed process, but the given process was successful.');
- } else {
- $this->setExpectedException(\InvalidArgumentException::class, 'Expected a failed process, but the given process was successful.');
- }
+ $this->expectException(\InvalidArgumentException::class);
+ $this->expectExceptionMessage('Expected a failed process, but the given process was successful.');
new ProcessFailedException($process);
}
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index fd40aaa9e13f3..a8d21b354caac 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -960,12 +960,8 @@ public function testMethodsThatNeedARunningProcess($method)
{
$process = $this->getProcess('foo');
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Process\Exception\LogicException');
- $this->expectExceptionMessage(sprintf('Process must be started before calling %s.', $method));
- } else {
- $this->setExpectedException('Symfony\Component\Process\Exception\LogicException', sprintf('Process must be started before calling %s.', $method));
- }
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage(sprintf('Process must be started before calling %s.', $method));
$process->{$method}();
}
@@ -1614,12 +1610,8 @@ private function skipIfNotEnhancedSigchild($expectException = true)
if (!$expectException) {
$this->markTestSkipped('PHP is compiled with --enable-sigchild.');
} elseif (self::$notEnhancedSigchild) {
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
- $this->expectExceptionMessage('This PHP has been compiled with --enable-sigchild.');
- } else {
- $this->setExpectedException('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild.');
- }
+ $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectExceptionMessage('This PHP has been compiled with --enable-sigchild.');
}
}
}
diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
index a4d754cb14a6c..309b5333708a7 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Tests\Generator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
@@ -20,6 +21,8 @@
class UrlGeneratorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testAbsoluteUrlWithPort80()
{
$routes = $this->getRoutes('test', new Route('/testing'));
@@ -368,7 +371,7 @@ public function testAdjacentVariables()
// 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->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException');
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$generator->generate('test', ['x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml']);
}
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
index d8f7a84518614..9429b1171a9de 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -225,7 +225,7 @@ public function testMatchOverriddenRoute()
$matcher = $this->getUrlMatcher($collection);
$this->assertEquals(['_route' => 'foo'], $matcher->match('/foo1'));
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$this->assertEquals([], $matcher->match('/foo'));
}
@@ -282,7 +282,7 @@ public function testAdjacentVariables()
// z and _format are optional.
$this->assertEquals(['w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'], $matcher->match('/wwwwwxy'));
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$matcher->match('/wxy.html');
}
@@ -297,7 +297,7 @@ public function testOptionalVariableWithNoRealSeparator()
// 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->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$matcher->match('/ge');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
index c60a59b375d3e..28aff4af31f09 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authorization;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
@@ -20,6 +21,8 @@
class AccessDecisionManagerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @expectedException \InvalidArgumentException
*/
@@ -147,12 +150,8 @@ public function testVotingWrongTypeNoVoteMethod()
$exception = LogicException::class;
$message = sprintf('stdClass should implement the %s interface when used as voter.', VoterInterface::class);
- if (method_exists($this, 'expectException')) {
- $this->expectException($exception);
- $this->expectExceptionMessage($message);
- } else {
- $this->setExpectedException($exception, $message);
- }
+ $this->expectException($exception);
+ $this->expectExceptionMessage($message);
$adm = new AccessDecisionManager([new \stdClass()]);
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
index e72dab9b9edf0..bcfbeab2d2e86 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -580,12 +580,8 @@ public function testPreventsComplexExternalEntities()
public function testDecodeEmptyXml()
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
- $this->expectExceptionMessage('Invalid XML data, it can not be empty.');
- } else {
- $this->setExpectedException('Symfony\Component\Serializer\Exception\UnexpectedValueException', 'Invalid XML data, it can not be empty.');
- }
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectExceptionMessage('Invalid XML data, it can not be empty.');
$this->encoder->decode(' ', 'xml');
}
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index be7ec0bb15529..6a19c98dcdaf6 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -89,7 +89,7 @@ public function testUnsetHelper()
$foo = new \Symfony\Component\Templating\Tests\Fixtures\SimpleHelper('foo');
$engine->set($foo);
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\LogicException');
+ $this->expectException('\LogicException');
unset($engine['foo']);
}
diff --git a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
index e39ef39ec51fc..a941b66a5589b 100644
--- a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
+++ b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Catalogue;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\MessageCatalogueInterface;
abstract class AbstractOperationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetEmptyDomains()
{
$this->assertEquals(
@@ -41,7 +44,7 @@ public function testGetMergedDomains()
public function testGetMessagesFromUnknownDomain()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
$this->createOperation(
new MessageCatalogue('en'),
new MessageCatalogue('en')
diff --git a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
index 08f55e9022b89..6083b68f7a0d4 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\QtFileLoader;
class QtFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new QtFileLoader();
@@ -63,12 +66,8 @@ public function testLoadEmptyResource()
$loader = new QtFileLoader();
$resource = __DIR__.'/../fixtures/empty.xlf';
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
- $this->expectExceptionMessage(sprintf('Unable to load "%s".', $resource));
- } else {
- $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s".', $resource));
- }
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $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 7cb9f54fde2e2..af46c02d7693c 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\XliffFileLoader;
class XliffFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new XliffFileLoader();
@@ -149,12 +152,8 @@ public function testParseEmptyFile()
$loader = new XliffFileLoader();
$resource = __DIR__.'/../fixtures/empty.xlf';
- if (method_exists($this, 'expectException')) {
- $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
- $this->expectExceptionMessage(sprintf('Unable to load "%s":', $resource));
- } else {
- $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s":', $resource));
- }
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectExceptionMessage(sprintf('Unable to load "%s":', $resource));
$loader->load($resource, 'en', 'domain1');
}
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintTest.php b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
index d1f41ce5ee97d..cc36eaac8c647 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
@@ -22,6 +23,8 @@
class ConstraintTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSetProperties()
{
$constraint = new ConstraintA([
@@ -35,7 +38,7 @@ public function testSetProperties()
public function testSetNotExistingPropertyThrowsException()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
new ConstraintA([
'foo' => 'bar',
@@ -46,14 +49,14 @@ public function testMagicPropertiesAreNotAllowed()
{
$constraint = new ConstraintA();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
$constraint->foo = 'bar';
}
public function testInvalidAndRequiredOptionsPassed()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
new ConstraintC([
'option1' => 'default',
@@ -101,14 +104,14 @@ public function testDontSetDefaultPropertyIfValuePropertyExists()
public function testSetUndefinedDefaultProperty()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new ConstraintB('foo');
}
public function testRequiredOptionsMustBeDefined()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\MissingOptionsException');
+ $this->expectException('Symfony\Component\Validator\Exception\MissingOptionsException');
new ConstraintC();
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
index 3a84694cc7aca..b2f30e7ad1c5d 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -41,6 +42,8 @@ public function getValue()
*/
abstract class AbstractComparisonValidatorTestCase extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected static function addPhp5Dot5Comparisons(array $comparisons)
{
$result = $comparisons;
@@ -163,12 +166,8 @@ public function testInvalidValuePath()
{
$constraint = $this->createConstraint(['propertyPath' => 'foo']);
- if (method_exists($this, 'expectException')) {
- $this->expectException(ConstraintDefinitionException::class);
- $this->expectExceptionMessage(sprintf('Invalid property path "foo" provided to "%s" constraint', \get_class($constraint)));
- } else {
- $this->setExpectedException(ConstraintDefinitionException::class, sprintf('Invalid property path "foo" provided to "%s" constraint', \get_class($constraint)));
- }
+ $this->expectException(ConstraintDefinitionException::class);
+ $this->expectExceptionMessage(sprintf('Invalid property path "foo" provided to "%s" constraint', \get_class($constraint)));
$object = new ComparisonTest_Class(5);
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
index f45b7c931a070..bb1c2fed0cef7 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
@@ -43,14 +43,14 @@ private function doTearDown()
public function testAddConstraintDoesNotAcceptValid()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->metadata->addConstraint(new Valid());
}
public function testAddConstraintRequiresClassConstraints()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->metadata->addConstraint(new PropertyConstraint());
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
index 05aef47e84aaf..fd62ea80f2832 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\GetterMetadata;
use Symfony\Component\Validator\Tests\Fixtures\Entity;
class GetterMetadataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
public function testInvalidPropertyName()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
new GetterMetadata(self::CLASSNAME, 'foobar');
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
index d6b20a0c8dcb9..f0a9c762f57ee 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Choice;
@@ -29,6 +30,8 @@
class XmlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoadClassMetadataReturnsTrueIfSuccessful()
{
$loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml');
@@ -114,7 +117,7 @@ public function testThrowExceptionIfDocTypeIsSet()
$loader = new XmlFileLoader(__DIR__.'/withdoctype.xml');
$metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\Symfony\Component\Validator\Exception\MappingException');
+ $this->expectException('\Symfony\Component\Validator\Exception\MappingException');
$loader->loadClassMetadata($metadata);
}
@@ -129,7 +132,7 @@ public function testDoNotModifyStateIfExceptionIsThrown()
try {
$loader->loadClassMetadata($metadata);
} catch (MappingException $e) {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\Symfony\Component\Validator\Exception\MappingException');
+ $this->expectException('\Symfony\Component\Validator\Exception\MappingException');
$loader->loadClassMetadata($metadata);
}
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
index afa50cbee6485..158bebdbc779e 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Choice;
@@ -26,6 +27,8 @@
class YamlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoadClassMetadataReturnsFalseIfEmpty()
{
$loader = new YamlFileLoader(__DIR__.'/empty-mapping.yml');
@@ -69,7 +72,7 @@ public function testDoNotModifyStateIfExceptionIsThrown()
$loader->loadClassMetadata($metadata);
} catch (\InvalidArgumentException $e) {
// Call again. Again an exception should be thrown
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\InvalidArgumentException');
+ $this->expectException('\InvalidArgumentException');
$loader->loadClassMetadata($metadata);
}
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
index a47a447e3e99e..cab61e9225dd0 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
@@ -41,7 +41,7 @@ private function doTearDown()
public function testAddConstraintRequiresClassConstraints()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$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 9fea435dff279..3a85317385f03 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
@@ -12,17 +12,20 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\PropertyMetadata;
use Symfony\Component\Validator\Tests\Fixtures\Entity;
class PropertyMetadataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
public function testInvalidPropertyName()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
new PropertyMetadata(self::CLASSNAME, 'foobar');
}
@@ -50,7 +53,7 @@ public function testGetPropertyValueFromRemovedProperty()
$metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
$metadata->name = 'test';
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
$metadata->getPropertyValue($entity);
}
}
diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php
index 2d69916420aec..58f1719d9e7d9 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -307,12 +307,8 @@ public function testParseUnquotedAsteriskFollowedByAComment()
*/
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
{
- if (method_exists($this, 'expectExceptionMessage')) {
- $this->expectException(ParseException::class);
- $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
- } else {
- $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
- }
+ $this->expectException(ParseException::class);
+ $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
}
@@ -327,12 +323,8 @@ public function getReservedIndicators()
*/
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
{
- if (method_exists($this, 'expectExceptionMessage')) {
- $this->expectException(ParseException::class);
- $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
- } else {
- $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
- }
+ $this->expectException(ParseException::class);
+ $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
}
@@ -700,11 +692,7 @@ public function getBinaryData()
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
- if (method_exists($this, 'expectException')) {
- $this->expectExceptionMessageRegExp($expectedMessage);
- } else {
- $this->setExpectedExceptionRegExp(ParseException::class, $expectedMessage);
- }
+ $this->expectExceptionMessageRegExp($expectedMessage);
Inline::parse($data);
}
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index 1a60f7979a1ed..f2412fc56784a 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -1488,11 +1488,7 @@ public function getBinaryData()
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
- if (method_exists($this, 'expectException')) {
- $this->expectExceptionMessageRegExp($expectedMessage);
- } else {
- $this->setExpectedExceptionRegExp(ParseException::class, $expectedMessage);
- }
+ $this->expectExceptionMessageRegExp($expectedMessage);
$this->parser->parse($data);
}
@@ -1559,12 +1555,8 @@ public function testParseDateAsMappingValue()
*/
public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
{
- if (method_exists($this, 'expectException')) {
- $this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
- } else {
- $this->setExpectedException('\Symfony\Component\Yaml\Exception\ParseException', sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
- }
+ $this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
$this->parser->parse($yaml);
}
From 725187ff77661441ae23fb02f0adf6928fd6e303 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 1 Aug 2019 23:06:09 +0200
Subject: [PATCH 028/147] cs fix
---
.../Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
index 84a26faebe99a..f77239ef09e86 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
@@ -30,6 +30,6 @@ protected function createMock($originalClassName): MockObject
->disableOriginalClone()
->disableArgumentCloning()
->disallowMockingUnknownTypes()
- ->getMock();
+ ->getMock();
}
}
From 3a626e8778028277ebef032c7cfa63984f430104 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Fri, 2 Aug 2019 00:48:42 +0200
Subject: [PATCH 029/147] Fix deprecated phpunit annotation
---
...erEventListenersAndSubscribersPassTest.php | 11 +-
.../CompilerPass/RegisterMappingsPassTest.php | 9 +-
.../DoctrineExtensionTest.php | 10 +-
.../CollectionToArrayTransformerTest.php | 4 +-
.../Tests/Form/Type/EntityTypeTest.php | 16 +-
.../Security/User/EntityUserProviderTest.php | 10 +-
.../Constraints/UniqueEntityValidatorTest.php | 22 +-
.../Bridge/Twig/Tests/AppVariableTest.php | 24 +-
.../Twig/Tests/Command/LintCommandTest.php | 8 +-
.../Extension/HttpKernelExtensionTest.php | 4 +-
.../Extension/StopwatchExtensionTest.php | 7 +-
.../Extension/TranslationExtensionTest.php | 21 +-
.../Tests/Translation/TwigExtractorTest.php | 5 +-
.../Bridge/Twig/Tests/TwigEngineTest.php | 7 +-
.../Tests/Command/RouterDebugCommandTest.php | 7 +-
.../Command/TranslationDebugCommandTest.php | 4 +-
.../Tests/Command/YamlLintCommandTest.php | 4 +-
.../Tests/Controller/ControllerTraitTest.php | 17 +-
.../Controller/TemplateControllerTest.php | 9 +-
.../Compiler/AddConsoleCommandPassTest.php | 15 +-
.../AddConstraintValidatorsPassTest.php | 9 +-
.../Compiler/CachePoolPassTest.php | 6 +-
.../Compiler/CachePoolPrunerPassTest.php | 9 +-
.../Compiler/FormPassTest.php | 9 +-
.../Compiler/ProfilerPassTest.php | 6 +-
.../Compiler/SerializerPassTest.php | 15 +-
.../WorkflowGuardListenerPassTest.php | 24 +-
.../DependencyInjection/ConfigurationTest.php | 6 +-
.../FrameworkExtensionTest.php | 45 ++--
.../PhpFrameworkExtensionTest.php | 11 +-
.../Functional/CachePoolClearCommandTest.php | 6 +-
.../Tests/Functional/CachePoolsTest.php | 7 +-
.../Tests/Routing/RouterTest.php | 21 +-
.../Tests/Templating/DelegatingEngineTest.php | 9 +-
.../Templating/Loader/TemplateLocatorTest.php | 7 +-
.../Tests/Templating/PhpEngineTest.php | 7 +-
.../Templating/TemplateNameParserTest.php | 4 +-
.../Tests/Translation/TranslatorTest.php | 18 +-
.../ConstraintValidatorFactoryTest.php | 7 +-
.../Compiler/AddSecurityVotersPassTest.php | 4 +-
.../CompleteConfigurationTest.php | 21 +-
.../MainConfigurationTest.php | 11 +-
.../GuardAuthenticationFactoryTest.php | 13 +-
.../SecurityExtensionTest.php | 25 +-
.../UserPasswordEncoderCommandTest.php | 6 +-
.../Compiler/TwigLoaderPassTest.php | 4 +-
.../Tests/Loader/FilesystemLoaderTest.php | 17 +-
.../Tests/Profiler/TemplateManagerTest.php | 4 +-
.../Component/Asset/Tests/PackagesTest.php | 11 +-
.../Component/Asset/Tests/UrlPackageTest.php | 11 +-
.../JsonManifestVersionStrategyTest.php | 13 +-
.../Component/BrowserKit/Tests/CookieTest.php | 6 +-
.../Cache/Tests/Adapter/ChainAdapterTest.php | 15 +-
.../Tests/Adapter/MaxIdLengthAdapterTest.php | 9 +-
.../Tests/Adapter/MemcachedAdapterTest.php | 10 +-
.../Cache/Tests/Adapter/ProxyAdapterTest.php | 9 +-
.../Cache/Tests/Adapter/RedisAdapterTest.php | 8 +-
.../Tests/Adapter/TagAwareAdapterTest.php | 4 +-
.../Component/Cache/Tests/CacheItemTest.php | 11 +-
.../Cache/Tests/Simple/ChainCacheTest.php | 15 +-
.../Cache/Tests/Simple/MemcachedCacheTest.php | 10 +-
.../Cache/Tests/Simple/RedisCacheTest.php | 8 +-
.../Tests/ClassCollectionLoaderTest.php | 7 +-
.../Config/Tests/ConfigCacheFactoryTest.php | 9 +-
.../Config/Tests/Definition/ArrayNodeTest.php | 28 +-
.../Tests/Definition/BooleanNodeTest.php | 5 +-
.../Builder/ArrayNodeDefinitionTest.php | 13 +-
.../Builder/BooleanNodeDefinitionTest.php | 9 +-
.../Builder/EnumNodeDefinitionTest.php | 15 +-
.../Definition/Builder/ExprBuilderTest.php | 19 +-
.../Definition/Builder/NodeBuilderTest.php | 11 +-
.../Builder/NumericNodeDefinitionTest.php | 45 ++--
.../Config/Tests/Definition/EnumNodeTest.php | 15 +-
.../Config/Tests/Definition/FloatNodeTest.php | 5 +-
.../Tests/Definition/IntegerNodeTest.php | 5 +-
.../Config/Tests/Definition/MergeTest.php | 11 +-
.../Tests/Definition/NormalizationTest.php | 9 +-
.../Tests/Definition/ScalarNodeTest.php | 4 +-
.../Config/Tests/FileLocatorTest.php | 19 +-
.../Tests/Loader/DelegatingLoaderTest.php | 7 +-
.../Config/Tests/Loader/LoaderTest.php | 7 +-
.../Resource/ClassExistenceResourceTest.php | 9 +-
.../Tests/Resource/DirectoryResourceTest.php | 6 +-
.../Tests/Resource/FileResourceTest.php | 6 +-
.../Config/Tests/Util/XmlUtilsTest.php | 6 +-
.../Console/Tests/ApplicationTest.php | 64 ++---
.../Console/Tests/Command/CommandTest.php | 24 +-
.../ContainerCommandLoaderTest.php | 7 +-
.../FactoryCommandLoaderTest.php | 7 +-
.../AddConsoleCommandPassTest.php | 21 +-
.../OutputFormatterStyleStackTest.php | 7 +-
.../Tests/Helper/ProgressIndicatorTest.php | 27 +-
.../Tests/Helper/QuestionHelperTest.php | 47 ++--
.../Helper/SymfonyQuestionHelperTest.php | 9 +-
.../Console/Tests/Helper/TableStyleTest.php | 9 +-
.../Console/Tests/Helper/TableTest.php | 18 +-
.../Console/Tests/Input/InputArgumentTest.php | 12 +-
.../Tests/Input/InputDefinitionTest.php | 54 ++--
.../Console/Tests/Input/InputOptionTest.php | 30 +--
.../Console/Tests/Input/InputTest.php | 39 ++-
.../Tests/Logger/ConsoleLoggerTest.php | 7 +-
.../Console/Tests/Output/StreamOutputTest.php | 6 +-
.../Tests/Tester/CommandTesterTest.php | 12 +-
.../Tests/CssSelectorConverterTest.php | 9 +-
.../Tests/XPath/TranslatorTest.php | 27 +-
.../Debug/Tests/DebugClassLoaderTest.php | 24 +-
.../Debug/Tests/ErrorHandlerTest.php | 5 +-
.../Tests/ChildDefinitionTest.php | 19 +-
.../Compiler/AutoAliasServicePassTest.php | 11 +-
.../Tests/Compiler/AutowirePassTest.php | 76 ++----
.../CheckArgumentsValidityPassTest.php | 5 +-
.../CheckCircularReferencesPassTest.php | 27 +-
.../CheckDefinitionValidityPassTest.php | 23 +-
...tionOnInvalidReferenceBehaviorPassTest.php | 11 +-
.../CheckReferenceValidityPassTest.php | 7 +-
.../DefinitionErrorExceptionPassTest.php | 9 +-
.../InlineServiceDefinitionsPassTest.php | 9 +-
.../MergeExtensionConfigurationPassTest.php | 9 +-
.../RegisterEnvVarProcessorsPassTest.php | 9 +-
.../RegisterServiceSubscribersPassTest.php | 21 +-
...ReplaceAliasByActualDefinitionPassTest.php | 7 +-
.../Compiler/ResolveBindingsPassTest.php | 17 +-
.../ResolveChildDefinitionsPassTest.php | 9 +-
.../Tests/Compiler/ResolveClassPassTest.php | 9 +-
.../Compiler/ResolveFactoryClassPassTest.php | 9 +-
.../ResolveInstanceofConditionalsPassTest.php | 21 +-
.../ResolveNamedArgumentsPassTest.php | 27 +-
.../ResolveReferencesToAliasesPassTest.php | 7 +-
.../Compiler/ServiceLocatorTagPassTest.php | 15 +-
.../Tests/ContainerBuilderTest.php | 102 +++----
.../Tests/ContainerTest.php | 21 +-
.../Tests/DefinitionDecoratorTest.php | 11 +-
.../Tests/DefinitionTest.php | 24 +-
.../Tests/Dumper/PhpDumperTest.php | 18 +-
.../Tests/EnvVarProcessorTest.php | 31 ++-
.../Tests/Extension/ExtensionTest.php | 9 +-
.../Tests/Loader/DirectoryLoaderTest.php | 6 +-
.../Tests/Loader/FileLoaderTest.php | 6 +-
.../Tests/Loader/IniFileLoaderTest.php | 18 +-
.../Tests/Loader/PhpFileLoaderTest.php | 15 +-
.../Tests/Loader/XmlFileLoaderTest.php | 28 +-
.../Tests/Loader/YamlFileLoaderTest.php | 94 +++----
.../EnvPlaceholderParameterBagTest.php | 16 +-
.../ParameterBag/FrozenParameterBagTest.php | 19 +-
.../Tests/ServiceLocatorTest.php | 33 +--
.../DomCrawler/Tests/CrawlerTest.php | 34 +--
.../Component/DomCrawler/Tests/FormTest.php | 23 +-
.../Component/DomCrawler/Tests/ImageTest.php | 7 +-
.../Component/DomCrawler/Tests/LinkTest.php | 11 +-
.../Component/Dotenv/Tests/DotenvTest.php | 7 +-
.../RegisterListenersPassTest.php | 24 +-
.../Tests/GenericEventTest.php | 4 +-
.../Tests/ImmutableEventDispatcherTest.php | 16 +-
.../Tests/ExpressionFunctionTest.php | 15 +-
.../Tests/ExpressionLanguageTest.php | 27 +-
.../ExpressionLanguage/Tests/LexerTest.php | 12 +-
.../ExpressionLanguage/Tests/ParserTest.php | 23 +-
.../Filesystem/Tests/FilesystemTest.php | 72 ++---
.../Filesystem/Tests/LockHandlerTest.php | 15 +-
.../Component/Finder/Tests/FinderTest.php | 21 +-
.../Iterator/CustomFilterIteratorTest.php | 7 +-
.../Component/Form/Tests/ButtonTest.php | 4 +-
.../Form/Tests/Command/DebugCommandTest.php | 10 +-
.../Component/Form/Tests/CompoundFormTest.php | 11 +-
.../DependencyInjection/FormPassTest.php | 9 +-
.../ArrayToPartsTransformerTest.php | 12 +-
.../BaseDateTimeTransformerTest.php | 15 +-
.../BooleanToStringTransformerTest.php | 8 +-
.../ChoiceToValueTransformerTest.php | 2 +-
.../ChoicesToValuesTransformerTest.php | 8 +-
.../DateTimeToArrayTransformerTest.php | 91 ++-----
...imeToHtml5LocalDateTimeTransformerTest.php | 18 +-
...teTimeToLocalizedStringTransformerTest.php | 36 +--
.../DateTimeToRfc3339TransformerTest.php | 14 +-
.../DateTimeZoneToStringTransformerTest.php | 11 +-
...ntegerToLocalizedStringTransformerTest.php | 26 +-
...NumberToLocalizedStringTransformerTest.php | 77 ++----
...ercentToLocalizedStringTransformerTest.php | 40 +--
.../ValueToDuplicatesTransformerTest.php | 12 +-
.../MergeCollectionListenerTest.php | 2 +-
.../EventListener/ResizeFormListenerTest.php | 8 +-
.../Extension/Core/Type/BirthdayTypeTest.php | 8 +-
.../Extension/Core/Type/ButtonTypeTest.php | 8 +-
.../Extension/Core/Type/ChoiceTypeTest.php | 8 +-
.../Extension/Core/Type/DateTypeTest.php | 43 +--
.../Extension/Core/Type/FormTypeTest.php | 11 +-
.../Extension/Core/Type/RepeatedTypeTest.php | 12 +-
.../Extension/Core/Type/TimeTypeTest.php | 19 +-
.../Tests/Extension/Core/Type/UrlTypeTest.php | 8 +-
.../DependencyInjectionExtensionTest.php | 9 +-
.../HttpFoundationRequestHandlerTest.php | 11 +-
.../ViolationMapper/ViolationPathTest.php | 35 +--
.../Component/Form/Tests/FormConfigTest.php | 4 +-
.../Component/Form/Tests/FormFactoryTest.php | 12 +-
.../Component/Form/Tests/FormRegistryTest.php | 24 +-
.../Component/Form/Tests/Guess/GuessTest.php | 7 +-
.../Form/Tests/NativeRequestHandlerTest.php | 4 +-
.../Tests/Resources/TranslationFilesTest.php | 5 +-
.../Component/Form/Tests/SimpleFormTest.php | 75 ++----
.../Form/Tests/Util/OrderedHashMapTest.php | 7 +-
.../Tests/BinaryFileResponseTest.php | 4 +-
.../HttpFoundation/Tests/CookieTest.php | 9 +-
.../Tests/ExpressionRequestMatcherTest.php | 7 +-
.../Tests/File/UploadedFileTest.php | 4 +-
.../HttpFoundation/Tests/FileBagTest.php | 4 +-
.../HttpFoundation/Tests/HeaderBagTest.php | 7 +-
.../HttpFoundation/Tests/IpUtilsTest.php | 5 +-
.../HttpFoundation/Tests/JsonResponseTest.php | 14 +-
.../Tests/RedirectResponseTest.php | 15 +-
.../HttpFoundation/Tests/RequestTest.php | 12 +-
.../Tests/ResponseHeaderBagTest.php | 13 +-
.../HttpFoundation/Tests/ResponseTest.php | 11 +-
.../Handler/MongoDbSessionHandlerTest.php | 8 +-
.../Handler/NativeFileSessionHandlerTest.php | 7 +-
.../Storage/Handler/PdoSessionHandlerTest.php | 12 +-
.../Storage/MockArraySessionStorageTest.php | 4 +-
.../Storage/MockFileSessionStorageTest.php | 4 +-
.../Storage/NativeSessionStorageTest.php | 16 +-
.../Storage/Proxy/AbstractProxyTest.php | 4 +-
.../Storage/Proxy/SessionHandlerProxyTest.php | 2 +-
.../Tests/StreamedResponseTest.php | 11 +-
.../HttpKernel/Tests/Bundle/BundleTest.php | 9 +-
.../CacheClearer/Psr6CacheClearerTest.php | 9 +-
.../Tests/CacheWarmer/CacheWarmerTest.php | 4 +-
.../Tests/Controller/ArgumentResolverTest.php | 20 +-
.../ContainerControllerResolverTest.php | 18 +-
.../Controller/ControllerResolverTest.php | 6 +-
.../ArgumentMetadataTest.php | 7 +-
.../FragmentRendererPassTest.php | 6 +-
...sterControllerArgumentLocatorsPassTest.php | 51 ++--
.../ResettableServicePassTest.php | 9 +-
.../EventListener/FragmentListenerTest.php | 11 +-
.../EventListener/RouterListenerTest.php | 8 +-
.../ValidateRequestListenerTest.php | 4 +-
.../Fragment/EsiFragmentRendererTest.php | 11 +-
.../Tests/Fragment/FragmentHandlerTest.php | 14 +-
.../Fragment/HIncludeFragmentRendererTest.php | 7 +-
.../Fragment/InlineFragmentRendererTest.php | 7 +-
.../Fragment/RoutableFragmentRendererTest.php | 7 +-
.../Fragment/SsiFragmentRendererTest.php | 11 +-
.../HttpKernel/Tests/HttpCache/EsiTest.php | 11 +-
.../HttpKernel/Tests/HttpCache/SsiTest.php | 11 +-
.../HttpKernel/Tests/HttpKernelTest.php | 23 +-
.../Component/HttpKernel/Tests/KernelTest.php | 32 +--
.../HttpKernel/Tests/Log/LoggerTest.php | 12 +-
.../Intl/Tests/Collator/CollatorTest.php | 31 +--
.../Bundle/Reader/BundleEntryReaderTest.php | 16 +-
.../Bundle/Reader/IntlBundleReaderTest.php | 12 +-
.../Bundle/Reader/JsonBundleReaderTest.php | 20 +-
.../Bundle/Reader/PhpBundleReaderTest.php | 16 +-
.../AbstractCurrencyDataProviderTest.php | 4 +-
.../AbstractLanguageDataProviderTest.php | 2 +-
.../Intl/Tests/Data/Util/RingBufferTest.php | 8 +-
.../DateFormatter/IntlDateFormatterTest.php | 39 +--
.../Intl/Tests/Locale/LocaleTest.php | 68 ++---
.../NumberFormatter/NumberFormatterTest.php | 56 ++--
.../Adapter/ExtLdap/EntryManagerTest.php | 9 +-
src/Symfony/Component/Lock/Tests/LockTest.php | 11 +-
.../Lock/Tests/Store/CombinedStoreTest.php | 8 +-
.../Tests/Store/ExpiringStoreTestTrait.php | 6 +-
.../Lock/Tests/Store/FlockStoreTest.php | 14 +-
.../Debug/OptionsResolverIntrospectorTest.php | 63 ++---
.../Tests/OptionsResolverTest.php | 251 +++++-------------
.../Process/Tests/ProcessBuilderTest.php | 17 +-
.../Component/Process/Tests/ProcessTest.php | 98 +++----
.../Tests/PropertyAccessorArrayAccessTest.php | 4 +-
.../Tests/PropertyAccessorCollectionTest.php | 16 +-
.../Tests/PropertyAccessorTest.php | 60 ++---
.../Tests/PropertyPathBuilderTest.php | 26 +-
.../PropertyAccess/Tests/PropertyPathTest.php | 49 ++--
.../Component/PropertyInfo/Tests/TypeTest.php | 9 +-
.../Routing/Tests/Annotation/RouteTest.php | 7 +-
.../Dumper/PhpGeneratorDumperTest.php | 8 +-
.../Tests/Generator/UrlGeneratorTest.php | 52 +---
.../Loader/AnnotationClassLoaderTest.php | 8 +-
.../Tests/Loader/AnnotationFileLoaderTest.php | 6 +-
.../Tests/Loader/ObjectRouteLoaderTest.php | 17 +-
.../Tests/Loader/XmlFileLoaderTest.php | 25 +-
.../Tests/Loader/YamlFileLoaderTest.php | 17 +-
.../Tests/Matcher/DumpedUrlMatcherTest.php | 15 +-
.../Matcher/Dumper/PhpMatcherDumperTest.php | 4 +-
.../Matcher/RedirectableUrlMatcherTest.php | 7 +-
.../Routing/Tests/Matcher/UrlMatcherTest.php | 36 +--
.../Tests/RouteCollectionBuilderTest.php | 7 +-
.../Routing/Tests/RouteCompilerTest.php | 25 +-
.../Component/Routing/Tests/RouteTest.php | 5 +-
.../Component/Routing/Tests/RouterTest.php | 18 +-
.../AuthenticationProviderManagerTest.php | 11 +-
.../AnonymousAuthenticationProviderTest.php | 13 +-
.../DaoAuthenticationProviderTest.php | 27 +-
.../LdapBindAuthenticationProviderTest.php | 27 +-
...uthenticatedAuthenticationProviderTest.php | 17 +-
.../RememberMeAuthenticationProviderTest.php | 17 +-
.../SimpleAuthenticationProviderTest.php | 11 +-
.../UserAuthenticationProviderTest.php | 41 +--
.../RememberMe/InMemoryTokenProviderTest.php | 11 +-
.../Token/RememberMeTokenTest.php | 11 +-
.../Token/UsernamePasswordTokenTest.php | 7 +-
.../AccessDecisionManagerTest.php | 4 +-
.../AuthorizationCheckerTest.php | 4 +-
.../Encoder/Argon2iPasswordEncoderTest.php | 4 +-
.../Encoder/BCryptPasswordEncoderTest.php | 15 +-
.../Tests/Encoder/BasePasswordEncoderTest.php | 7 +-
.../Core/Tests/Encoder/EncoderFactoryTest.php | 7 +-
.../MessageDigestPasswordEncoderTest.php | 11 +-
.../Encoder/Pbkdf2PasswordEncoderTest.php | 11 +-
.../Encoder/PlaintextPasswordEncoderTest.php | 7 +-
.../Tests/Resources/TranslationFilesTest.php | 5 +-
.../Core/Tests/User/ChainUserProviderTest.php | 11 +-
.../Tests/User/InMemoryUserProviderTest.php | 11 +-
.../Core/Tests/User/LdapUserProviderTest.php | 23 +-
.../Core/Tests/User/UserCheckerTest.php | 19 +-
.../Security/Core/Tests/User/UserTest.php | 7 +-
.../Constraints/UserPasswordValidatorTest.php | 4 +-
.../NativeSessionTokenStorageTest.php | 4 +-
.../TokenStorage/SessionTokenStorageTest.php | 8 +-
.../GuardAuthenticationListenerTest.php | 4 +-
.../GuardAuthenticationProviderTest.php | 14 +-
.../SimpleAuthenticationHandlerTest.php | 12 +-
.../Tests/Firewall/AccessListenerTest.php | 11 +-
.../BasicAuthenticationListenerTest.php | 9 +-
.../Tests/Firewall/ContextListenerTest.php | 19 +-
.../Tests/Firewall/LogoutListenerTest.php | 11 +-
.../Tests/Firewall/RememberMeListenerTest.php | 9 +-
.../RemoteUserAuthenticationListenerTest.php | 7 +-
.../Tests/Firewall/SwitchUserListenerTest.php | 22 +-
...PasswordFormAuthenticationListenerTest.php | 15 +-
...PasswordJsonAuthenticationListenerTest.php | 33 +--
.../X509AuthenticationListenerTest.php | 7 +-
.../Security/Http/Tests/HttpUtilsTest.php | 19 +-
.../Tests/Logout/LogoutUrlGeneratorTest.php | 18 +-
.../AbstractRememberMeServicesTest.php | 10 +-
.../SessionAuthenticationStrategyTest.php | 9 +-
.../Tests/Annotation/GroupsTest.php | 15 +-
.../Tests/Annotation/MaxDepthTest.php | 14 +-
.../SerializerPassTest.php | 15 +-
.../Tests/Encoder/ChainDecoderTest.php | 4 +-
.../Tests/Encoder/ChainEncoderTest.php | 4 +-
.../Tests/Encoder/JsonDecodeTest.php | 2 +-
.../Tests/Encoder/JsonEncodeTest.php | 2 +-
.../Tests/Encoder/JsonEncoderTest.php | 4 +-
.../Tests/Encoder/XmlEncoderTest.php | 14 +-
.../Factory/CacheMetadataFactoryTest.php | 7 +-
.../Mapping/Loader/YamlFileLoaderTest.php | 4 +-
.../AbstractObjectNormalizerTest.php | 17 +-
.../Normalizer/DataUriNormalizerTest.php | 8 +-
.../Normalizer/DateIntervalNormalizerTest.php | 24 +-
.../Normalizer/DateTimeNormalizerTest.php | 26 +-
.../Normalizer/GetSetMethodNormalizerTest.php | 14 +-
.../JsonSerializableNormalizerTest.php | 10 +-
.../Tests/Normalizer/ObjectNormalizerTest.php | 36 +--
.../Normalizer/PropertyNormalizerTest.php | 14 +-
.../Serializer/Tests/SerializerTest.php | 39 +--
.../Stopwatch/Tests/StopwatchEventTest.php | 11 +-
.../Stopwatch/Tests/StopwatchTest.php | 12 +-
.../Templating/Tests/DelegatingEngineTest.php | 21 +-
.../Templating/Tests/PhpEngineTest.php | 2 +-
.../TranslationExtractorPassTest.php | 9 +-
.../Translation/Tests/IntervalTest.php | 7 +-
.../Tests/Loader/CsvFileLoaderTest.php | 11 +-
.../Tests/Loader/IcuDatFileLoaderTest.php | 11 +-
.../Tests/Loader/IcuResFileLoaderTest.php | 11 +-
.../Tests/Loader/IniFileLoaderTest.php | 7 +-
.../Tests/Loader/JsonFileLoaderTest.php | 13 +-
.../Tests/Loader/MoFileLoaderTest.php | 11 +-
.../Tests/Loader/PhpFileLoaderTest.php | 11 +-
.../Tests/Loader/PoFileLoaderTest.php | 7 +-
.../Tests/Loader/QtFileLoaderTest.php | 12 +-
.../Tests/Loader/XliffFileLoaderTest.php | 22 +-
.../Tests/Loader/YamlFileLoaderTest.php | 15 +-
.../Tests/MessageCatalogueTest.php | 15 +-
.../Translation/Tests/MessageSelectorTest.php | 5 +-
.../Translation/Tests/TranslatorTest.php | 39 +--
.../Validator/Tests/ConstraintTest.php | 16 +-
.../AbstractComparisonValidatorTestCase.php | 10 +-
.../Validator/Tests/Constraints/AllTest.php | 11 +-
.../Tests/Constraints/AllValidatorTest.php | 7 +-
.../Constraints/CallbackValidatorTest.php | 11 +-
.../Tests/Constraints/ChoiceValidatorTest.php | 15 +-
.../Tests/Constraints/CollectionTest.php | 23 +-
.../Constraints/CollectionValidatorTest.php | 7 +-
.../Tests/Constraints/CompositeTest.php | 19 +-
.../Tests/Constraints/CountValidatorTest.php | 7 +-
.../Constraints/CountryValidatorTest.php | 7 +-
.../Constraints/CurrencyValidatorTest.php | 7 +-
.../Constraints/DateTimeValidatorTest.php | 7 +-
.../Tests/Constraints/DateValidatorTest.php | 7 +-
.../Tests/Constraints/EmailValidatorTest.php | 7 +-
.../Validator/Tests/Constraints/FileTest.php | 7 +-
.../Tests/Constraints/FileValidatorTest.php | 8 +-
.../Tests/Constraints/ImageValidatorTest.php | 32 +--
.../Tests/Constraints/IpValidatorTest.php | 11 +-
.../Tests/Constraints/IsbnValidatorTest.php | 7 +-
.../Tests/Constraints/IssnValidatorTest.php | 7 +-
.../Constraints/LanguageValidatorTest.php | 7 +-
.../Tests/Constraints/LengthValidatorTest.php | 7 +-
.../Tests/Constraints/LocaleValidatorTest.php | 7 +-
.../Tests/Constraints/LuhnValidatorTest.php | 5 +-
.../Tests/Constraints/RegexValidatorTest.php | 7 +-
.../Tests/Constraints/TimeValidatorTest.php | 7 +-
.../Tests/Constraints/UrlValidatorTest.php | 9 +-
.../Tests/Constraints/UuidValidatorTest.php | 11 +-
...ontainerConstraintValidatorFactoryTest.php | 7 +-
.../AddConstraintValidatorsPassTest.php | 9 +-
.../Tests/Mapping/ClassMetadataTest.php | 20 +-
.../Factory/BlackHoleMetadataFactoryTest.php | 7 +-
.../LazyLoadingMetadataFactoryTest.php | 7 +-
.../Tests/Mapping/GetterMetadataTest.php | 6 +-
.../Mapping/Loader/YamlFileLoaderTest.php | 2 +-
.../Tests/Resources/TranslationFilesTest.php | 5 +-
.../Tests/Validator/AbstractTest.php | 8 +-
.../Tests/Validator/AbstractValidatorTest.php | 8 +-
.../Workflow/Tests/DefinitionBuilderTest.php | 7 +-
.../Workflow/Tests/DefinitionTest.php | 25 +-
.../Component/Workflow/Tests/RegistryTest.php | 12 +-
.../Workflow/Tests/TransitionTest.php | 9 +-
.../Validator/StateMachineValidatorTest.php | 21 +-
.../Tests/Validator/WorkflowValidatorTest.php | 14 +-
.../Component/Workflow/Tests/WorkflowTest.php | 26 +-
.../Yaml/Tests/Command/LintCommandTest.php | 4 +-
.../Component/Yaml/Tests/DumperTest.php | 18 +-
.../Component/Yaml/Tests/InlineTest.php | 68 ++---
.../Component/Yaml/Tests/ParserTest.php | 88 +++---
src/Symfony/Component/Yaml/Tests/YamlTest.php | 15 +-
424 files changed, 2585 insertions(+), 4124 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
index 8ae9a912b4d0f..1b204a5c3259b 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
@@ -13,17 +13,18 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
class RegisterEventListenersAndSubscribersPassTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- */
+ use ForwardCompatTestTrait;
+
public function testExceptionOnAbstractTaggedSubscriber()
{
+ $this->expectException('InvalidArgumentException');
$container = $this->createBuilder();
$abstractDefinition = new Definition('stdClass');
@@ -35,11 +36,9 @@ public function testExceptionOnAbstractTaggedSubscriber()
$this->process($container);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testExceptionOnAbstractTaggedListener()
{
+ $this->expectException('InvalidArgumentException');
$container = $this->createBuilder();
$abstractDefinition = new Definition('stdClass');
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
index 0bb2642a7696e..7dd9b666789cc 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
@@ -4,17 +4,18 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterMappingsPass;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class RegisterMappingsPassTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageould Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"
- */
+ use ForwardCompatTestTrait;
+
public function testNoDriverParmeterException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->getExpectedExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
$container = $this->createBuilder();
$this->process($container, [
'manager.param.one',
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
index c93d8f8d7278e..e24a78ff34e54 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
@@ -52,11 +52,9 @@ private function doSetUp()
});
}
- /**
- * @expectedException \LogicException
- */
public function testFixManagersAutoMappingsWithTwoAutomappings()
{
+ $this->expectException('LogicException');
$emConfigs = [
'em1' => [
'auto_mapping' => true,
@@ -241,12 +239,10 @@ public function testServiceCacheDriver()
$this->assertTrue($container->hasAlias('doctrine.orm.default_metadata_cache'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage "unrecognized_type" is an unrecognized Doctrine cache driver.
- */
public function testUnrecognizedCacheDriverException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('"unrecognized_type" is an unrecognized Doctrine cache driver.');
$cacheName = 'metadata_cache';
$container = $this->createContainer();
$objectManager = [
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
index 113e07e29562c..e2129dc66d0b9 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
@@ -65,11 +65,9 @@ public function testTransformNull()
$this->assertSame([], $this->transformer->transform(null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformExpectsArrayOrCollection()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->transformer->transform('Foo');
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index 3a78eb57b0b0a..f7b2360efb5eb 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -118,19 +118,15 @@ protected function persist(array $entities)
// be managed!
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\MissingOptionsException
- */
public function testClassOptionIsRequired()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\MissingOptionsException');
$this->factory->createNamed('name', static::TESTED_TYPE);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- */
public function testInvalidClassOption()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$this->factory->createNamed('name', static::TESTED_TYPE, null, [
'class' => 'foo',
]);
@@ -190,11 +186,9 @@ public function testSetDataToUninitializedEntityWithNonRequiredQueryBuilder()
$this->assertEquals([1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')], $view->vars['choices']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@@ -202,11 +196,9 @@ public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
index 54a20bec33d34..b60a08b2ff712 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
@@ -83,12 +83,10 @@ public function testLoadUserByUsernameWithUserLoaderRepositoryAndWithoutProperty
$this->assertSame($user, $provider->loadUserByUsername('user1'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage You must either make the "Symfony\Bridge\Doctrine\Tests\Fixtures\User" entity Doctrine Repository ("Doctrine\ORM\EntityRepository") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.
- */
public function testLoadUserByUsernameWithNonUserLoaderRepositoryAndWithoutProperty()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('You must either make the "Symfony\Bridge\Doctrine\Tests\Fixtures\User" entity Doctrine Repository ("Doctrine\ORM\EntityRepository") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.');
$em = DoctrineTestHelper::createTestEntityManager();
$this->createSchema($em);
@@ -168,11 +166,9 @@ public function testLoadUserByUserNameShouldLoadUserWhenProperInterfaceProvided(
$provider->loadUserByUsername('name');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLoadUserByUserNameShouldDeclineInvalidInterface()
{
+ $this->expectException('InvalidArgumentException');
$repository = $this->getMockBuilder('\Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
$provider = new EntityUserProvider(
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
index e5eaf0138ec58..15e3b5f79647f 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
@@ -278,11 +278,9 @@ public function testValidateUniquenessWithIgnoreNullDisabled()
->assertRaised();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgnoreNullEnabled()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new UniqueEntity([
'message' => 'myMessage',
'fields' => ['name', 'name2'],
@@ -589,12 +587,10 @@ public function testValidateUniquenessWithArrayValue()
->assertRaised();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- * @expectedExceptionMessage Object manager "foo" does not exist.
- */
public function testDedicatedEntityManagerNullObject()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectExceptionMessage('Object manager "foo" does not exist.');
$constraint = new UniqueEntity([
'message' => 'myMessage',
'fields' => ['name'],
@@ -611,12 +607,10 @@ public function testDedicatedEntityManagerNullObject()
$this->validator->validate($entity, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- * @expectedExceptionMessage Unable to find the object manager associated with an entity of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity"
- */
public function testEntityManagerNullObject()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectExceptionMessage('Unable to find the object manager associated with an entity of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity"');
$constraint = new UniqueEntity([
'message' => 'myMessage',
'fields' => ['name'],
@@ -695,12 +689,10 @@ public function testValidateInheritanceUniqueness()
->assertRaised();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- * @expectedExceptionMessage The "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity" entity repository does not support the "Symfony\Bridge\Doctrine\Tests\Fixtures\Person" entity. The entity should be an instance of or extend "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity".
- */
public function testInvalidateRepositoryForInheritance()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectExceptionMessage('The "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity" entity repository does not support the "Symfony\Bridge\Doctrine\Tests\Fixtures\Person" entity. The entity should be an instance of or extend "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity".');
$constraint = new UniqueEntity([
'message' => 'myMessage',
'fields' => ['name'],
diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
index e6484f634e1c6..a461ef4c55fbe 100644
--- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
@@ -117,51 +117,39 @@ public function testGetUserWithNoToken()
$this->assertNull($this->appVariable->getUser());
}
- /**
- * @expectedException \RuntimeException
- */
public function testEnvironmentNotSet()
{
+ $this->expectException('RuntimeException');
$this->appVariable->getEnvironment();
}
- /**
- * @expectedException \RuntimeException
- */
public function testDebugNotSet()
{
+ $this->expectException('RuntimeException');
$this->appVariable->getDebug();
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetTokenWithTokenStorageNotSet()
{
+ $this->expectException('RuntimeException');
$this->appVariable->getToken();
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetUserWithTokenStorageNotSet()
{
+ $this->expectException('RuntimeException');
$this->appVariable->getUser();
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetRequestWithRequestStackNotSet()
{
+ $this->expectException('RuntimeException');
$this->appVariable->getRequest();
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetSessionWithRequestStackNotSet()
{
+ $this->expectException('RuntimeException');
$this->appVariable->getSession();
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
index a52ad549f80eb..55efa1d4bcf56 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
@@ -48,11 +48,9 @@ public function testLintIncorrectFile()
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
}
- /**
- * @expectedException \RuntimeException
- */
public function testLintFileNotReadable()
{
+ $this->expectException('RuntimeException');
$tester = $this->createCommandTester();
$filename = $this->createFile('');
unlink($filename);
@@ -74,11 +72,11 @@ public function testLintFileCompileTimeException()
/**
* @group legacy
* @expectedDeprecation Passing a command name as the first argument of "Symfony\Bridge\Twig\Command\LintCommand::__construct()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.
- * @expectedException \RuntimeException
- * @expectedExceptionMessage The Twig environment needs to be set.
*/
public function testLegacyLintCommand()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('The Twig environment needs to be set.');
$command = new LintCommand();
$application = new Application();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
index d3d64f053897b..bcee512a21fbf 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
@@ -25,11 +25,9 @@ class HttpKernelExtensionTest extends TestCase
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \Twig\Error\RuntimeError
- */
public function testFragmentWithError()
{
+ $this->expectException('Twig\Error\RuntimeError');
$renderer = $this->getFragmentHandler($this->throwException(new \Exception('foo')));
$this->renderTemplate($renderer);
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
index 1af65e4c19a7d..cac643f45b014 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\StopwatchExtension;
use Twig\Environment;
use Twig\Error\RuntimeError;
@@ -19,11 +20,11 @@
class StopwatchExtensionTest extends TestCase
{
- /**
- * @expectedException \Twig\Error\SyntaxError
- */
+ use ForwardCompatTestTrait;
+
public function testFailIfStoppingWrongEvent()
{
+ $this->expectException('Twig\Error\SyntaxError');
$this->testTiming('{% stopwatch "foo" %}{% endstopwatch "bar" %}', []);
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
index ef4bf9e1114e4..087ddf195426f 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Translator;
@@ -20,6 +21,8 @@
class TranslationExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testEscaping()
{
$output = $this->getTemplate('{% trans %}Percent: %value%%% (%msg%){% endtrans %}')->render(['value' => 12, 'msg' => 'approx.']);
@@ -45,30 +48,24 @@ public function testTrans($template, $expected, array $variables = [])
$this->assertEquals($expected, $this->getTemplate($template)->render($variables));
}
- /**
- * @expectedException \Twig\Error\SyntaxError
- * @expectedExceptionMessage Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.
- */
public function testTransUnknownKeyword()
{
+ $this->expectException('Twig\Error\SyntaxError');
+ $this->expectExceptionMessage('Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.');
$output = $this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render();
}
- /**
- * @expectedException \Twig\Error\SyntaxError
- * @expectedExceptionMessage A message inside a trans tag must be a simple text in "index" at line 2.
- */
public function testTransComplexBody()
{
+ $this->expectException('Twig\Error\SyntaxError');
+ $this->expectExceptionMessage('A message inside a trans tag must be a simple text in "index" at line 2.');
$output = $this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render();
}
- /**
- * @expectedException \Twig\Error\SyntaxError
- * @expectedExceptionMessage A message inside a transchoice tag must be a simple text in "index" at line 2.
- */
public function testTransChoiceComplexBody()
{
+ $this->expectException('Twig\Error\SyntaxError');
+ $this->expectExceptionMessage('A message inside a transchoice tag must be a simple text in "index" at line 2.');
$output = $this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render();
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
index 5dd5bb79d77b5..4b82573391f9f 100644
--- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests\Translation;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Translation\TwigExtractor;
use Symfony\Component\Translation\MessageCatalogue;
@@ -21,6 +22,8 @@
class TwigExtractorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getExtractData
*/
@@ -76,11 +79,11 @@ public function getExtractData()
}
/**
- * @expectedException \Twig\Error\Error
* @dataProvider resourcesWithSyntaxErrorsProvider
*/
public function testExtractSyntaxError($resources)
{
+ $this->expectException('Twig\Error\Error');
$twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
$twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
diff --git a/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php b/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php
index ab932eebc3dcf..b198fff13a2b1 100644
--- a/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\Templating\TemplateReference;
use Twig\Environment;
@@ -19,6 +20,8 @@
class TwigEngineTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testExistsWithTemplateInstances()
{
$engine = $this->getTwig();
@@ -58,11 +61,9 @@ public function testRender()
$this->assertSame('foo', $engine->render(new TemplateReference('index')));
}
- /**
- * @expectedException \Twig\Error\SyntaxError
- */
public function testRenderWithError()
{
+ $this->expectException('Twig\Error\SyntaxError');
$engine = $this->getTwig();
$engine->render(new TemplateReference('error'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
index 4790f271de3ff..b6ff5aa7c2e73 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -21,6 +22,8 @@
class RouterDebugCommandTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDebugAllRoutes()
{
$tester = $this->createCommandTester();
@@ -39,11 +42,9 @@ public function testDebugSingleRoute()
$this->assertContains('Route Name | foo', $tester->getDisplay());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testDebugInvalidRoute()
{
+ $this->expectException('InvalidArgumentException');
$this->createCommandTester()->execute(['name' => 'test']);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index f5f6001ecd17e..ab9df092daac1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -97,11 +97,9 @@ public function testDebugCustomDirectory()
$this->assertRegExp('/unused/', $tester->getDisplay());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testDebugInvalidDirectory()
{
+ $this->expectException('InvalidArgumentException');
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel->expects($this->once())
->method('getBundle')
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
index 6c3c0aa74a510..9ace5673074bb 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
@@ -61,11 +61,9 @@ public function testLintIncorrectFile()
$this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
}
- /**
- * @expectedException \RuntimeException
- */
public function testLintFileNotReadable()
{
+ $this->expectException('RuntimeException');
$tester = $this->createCommandTester();
$filename = $this->createFile('');
unlink($filename);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
index da950ce0c8041..5cefd5cff2ce8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
@@ -31,6 +32,8 @@
abstract class ControllerTraitTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
abstract protected function createController();
public function testForward()
@@ -87,12 +90,10 @@ public function testGetUserWithEmptyTokenStorage()
$this->assertNull($controller->getUser());
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage The SecurityBundle is not registered in your application.
- */
public function testGetUserWithEmptyContainer()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('The SecurityBundle is not registered in your application.');
$controller = $this->createController();
$controller->setContainer(new Container());
@@ -274,11 +275,9 @@ public function testFileFromPathWithCustomizedFileName()
$this->assertContains('test.php', $response->headers->get('content-disposition'));
}
- /**
- * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
- */
public function testFileWhichDoesNotExist()
{
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
$controller = $this->createController();
/* @var BinaryFileResponse $response */
@@ -299,11 +298,9 @@ public function testIsGranted()
$this->assertTrue($controller->isGranted('foo'));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
- */
public function testdenyAccessUnlessGranted()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
$authorizationChecker = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface')->getMock();
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(false);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php
index 9dba1c05a2bcb..5972595d96666 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Controller\TemplateController;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -20,6 +21,8 @@
*/
class TemplateControllerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testTwig()
{
$twig = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
@@ -77,12 +80,10 @@ public function testLegacyTemplating()
$this->assertEquals('bar', $controller->templateAction('mytemplate')->getContent());
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.
- */
public function testNoTwigNorTemplating()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
$controller = new TemplateController();
$controller->templateAction('mytemplate')->getContent();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
index 3681ca2047c1b..8b999941b7f4f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -22,6 +23,8 @@
*/
class AddConsoleCommandPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider visibilityProvider
*/
@@ -63,12 +66,10 @@ public function visibilityProvider()
];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "my-command" tagged "console.command" must not be abstract.
- */
public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The service "my-command" tagged "console.command" must not be abstract.');
$container = new ContainerBuilder();
$container->addCompilerPass(new AddConsoleCommandPass());
@@ -80,12 +81,10 @@ public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
$container->compile();
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".
- */
public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".');
$container = new ContainerBuilder();
$container->addCompilerPass(new AddConsoleCommandPass());
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php
index 6fdf8a51ebd27..f0f16698eeda7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -24,6 +25,8 @@
*/
class AddConstraintValidatorsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testThatConstraintValidatorServicesAreProcessed()
{
$container = new ContainerBuilder();
@@ -46,12 +49,10 @@ public function testThatConstraintValidatorServicesAreProcessed()
$this->assertEquals($expected, $container->getDefinition((string) $validatorFactory->getArgument(0)));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.
- */
public function testAbstractConstraintValidator()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.');
$container = new ContainerBuilder();
$validatorFactory = $container->register('validator.validator_factory')
->addArgument([]);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
index ef29ae8bca85e..a8d0e2d9fedbf 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
@@ -96,12 +96,10 @@ public function testArgsAreReplaced()
$this->assertSame(3, $cachePool->getArgument(2));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid "cache.pool" tag for service "app.cache_pool": accepted attributes are
- */
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid "cache.pool" tag for service "app.cache_pool": accepted attributes are');
$container = new ContainerBuilder();
$container->setParameter('kernel.debug', false);
$container->setParameter('kernel.name', 'app');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php
index 2ef2e1535ed8e..e1175fea8eea2 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
@@ -21,6 +22,8 @@
class CachePoolPrunerPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCompilerPassReplacesCommandArgument()
{
$container = new ContainerBuilder();
@@ -56,12 +59,10 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
$this->assertCount($aliasesBefore, $container->getAliases());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Class "Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\NotFound" used for service "pool.not-found" cannot be found.
- */
public function testCompilerPassThrowsOnInvalidDefinitionClass()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Class "Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\NotFound" used for service "pool.not-found" cannot be found.');
$container = new ContainerBuilder();
$container->register('console.command.cache_pool_prune')->addArgument([]);
$container->register('pool.not-found', NotFound::class)->addTag('cache.pool');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
index b5e3c9f241cfb..8c73d9650a00b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -24,6 +25,8 @@
*/
class FormPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDoNothingIfFormExtensionNotLoaded()
{
$container = new ContainerBuilder();
@@ -124,12 +127,10 @@ public function addTaggedTypeExtensionsDataProvider()
];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage extended-type attribute, none was configured for the "my.type_extension" service
- */
public function testAddTaggedFormTypeExtensionWithoutExtendedTypeAttribute()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('extended-type attribute, none was configured for the "my.type_extension" service');
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
index b693165f8b996..bb4c5e00b4b6c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class ProfilerPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* Tests that collectors that specify a template but no "id" will throw
* an exception (both are needed if the template is specified).
@@ -24,11 +27,10 @@ class ProfilerPassTest extends TestCase
* Thus, a fully-valid tag looks something like this:
*
*
- *
- * @expectedException \InvalidArgumentException
*/
public function testTemplateNoIdThrowsException()
{
+ $this->expectException('InvalidArgumentException');
$builder = new ContainerBuilder();
$builder->register('profiler', 'ProfilerClass');
$builder->register('my_collector_service')
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
index e1a7b0be635d7..9cf8d0fc0c85c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -25,12 +26,12 @@
*/
class SerializerPassTest extends TestCase
{
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must tag at least one service as "serializer.normalizer" to use the "serializer" service
- */
+ use ForwardCompatTestTrait;
+
public function testThrowExceptionWhenNoNormalizers()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must tag at least one service as "serializer.normalizer" to use the "serializer" service');
$container = new ContainerBuilder();
$container->register('serializer');
@@ -38,12 +39,10 @@ public function testThrowExceptionWhenNoNormalizers()
$serializerPass->process($container);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must tag at least one service as "serializer.encoder" to use the "serializer" service
- */
public function testThrowExceptionWhenNoEncoders()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must tag at least one service as "serializer.encoder" to use the "serializer" service');
$container = new ContainerBuilder();
$container->register('serializer')
->addArgument([])
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
index c20660820b006..e1595fabc37cf 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
@@ -55,12 +55,10 @@ public function testNoExeptionIfAllDependenciesArePresent()
$this->assertFalse($this->container->hasParameter('workflow.has_guard_listeners'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- * @expectedExceptionMessage The "security.token_storage" service is needed to be able to use the workflow guard listener.
- */
public function testExceptionIfTheTokenStorageServiceIsNotPresent()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
+ $this->expectExceptionMessage('The "security.token_storage" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
$this->container->register('security.authentication.trust_resolver', AuthenticationTrustResolverInterface::class);
@@ -69,12 +67,10 @@ public function testExceptionIfTheTokenStorageServiceIsNotPresent()
$this->compilerPass->process($this->container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- * @expectedExceptionMessage The "security.authorization_checker" service is needed to be able to use the workflow guard listener.
- */
public function testExceptionIfTheAuthorizationCheckerServiceIsNotPresent()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
+ $this->expectExceptionMessage('The "security.authorization_checker" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.token_storage', TokenStorageInterface::class);
$this->container->register('security.authentication.trust_resolver', AuthenticationTrustResolverInterface::class);
@@ -83,12 +79,10 @@ public function testExceptionIfTheAuthorizationCheckerServiceIsNotPresent()
$this->compilerPass->process($this->container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- * @expectedExceptionMessage The "security.authentication.trust_resolver" service is needed to be able to use the workflow guard listener.
- */
public function testExceptionIfTheAuthenticationTrustResolverServiceIsNotPresent()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
+ $this->expectExceptionMessage('The "security.authentication.trust_resolver" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.token_storage', TokenStorageInterface::class);
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
@@ -97,12 +91,10 @@ public function testExceptionIfTheAuthenticationTrustResolverServiceIsNotPresent
$this->compilerPass->process($this->container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- * @expectedExceptionMessage The "security.role_hierarchy" service is needed to be able to use the workflow guard listener.
- */
public function testExceptionIfTheRoleHierarchyServiceIsNotPresent()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
+ $this->expectExceptionMessage('The "security.role_hierarchy" service is needed to be able to use the workflow guard listener.');
$this->container->setParameter('workflow.has_guard_listeners', true);
$this->container->register('security.token_storage', TokenStorageInterface::class);
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
index b64efd67de01b..bf986714c5832 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -107,10 +107,10 @@ public function getTestValidSessionName()
/**
* @dataProvider getTestInvalidSessionName
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*/
public function testInvalidSessionName($sessionName)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$processor = new Processor();
$processor->processConfiguration(
new Configuration(true),
@@ -163,10 +163,10 @@ public function getTestValidTrustedProxiesData()
/**
* @group legacy
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*/
public function testInvalidTypeTrustedProxies()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$processor = new Processor();
$configuration = new Configuration(true);
$processor->processConfiguration($configuration, [
@@ -179,10 +179,10 @@ public function testInvalidTypeTrustedProxies()
/**
* @group legacy
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*/
public function testInvalidValueTrustedProxies()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$processor = new Processor();
$configuration = new Configuration(true);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index ef074bd163a1c..7517b1a42f677 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
use Doctrine\Common\Annotations\Annotation;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -47,6 +48,8 @@
abstract class FrameworkExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
private static $containerCache = [];
abstract protected function loadFromFile(ContainerBuilder $container, $file);
@@ -106,12 +109,10 @@ public function testPropertyAccessCacheWithDebug()
$this->assertSame(ArrayAdapter::class, $cache->getClass(), 'ArrayAdapter should be used in debug mode');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage CSRF protection needs sessions to be enabled.
- */
public function testCsrfProtectionNeedsSessionToBeEnabled()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('CSRF protection needs sessions to be enabled.');
$this->createContainerFromFile('csrf_needs_session');
}
@@ -252,39 +253,31 @@ public function testDeprecatedWorkflowMissingType()
$container = $this->createContainerFromFile('workflows_without_type');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage "type" and "service" cannot be used together.
- */
public function testWorkflowCannotHaveBothTypeAndService()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('"type" and "service" cannot be used together.');
$this->createContainerFromFile('workflow_with_type_and_service');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage "supports" and "support_strategy" cannot be used together.
- */
public function testWorkflowCannotHaveBothSupportsAndSupportStrategy()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('"supports" and "support_strategy" cannot be used together.');
$this->createContainerFromFile('workflow_with_support_and_support_strategy');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage "supports" or "support_strategy" should be configured.
- */
public function testWorkflowShouldHaveOneOfSupportsAndSupportStrategy()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('"supports" or "support_strategy" should be configured.');
$this->createContainerFromFile('workflow_without_support_and_support_strategy');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage "arguments" and "service" cannot be used together.
- */
public function testWorkflowCannotHaveBothArgumentsAndService()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('"arguments" and "service" cannot be used together.');
$this->createContainerFromFile('workflow_with_arguments_and_service');
}
@@ -430,11 +423,9 @@ public function testRouter()
$this->assertEquals('xml', $arguments[2]['resource_type'], '->registerRouterConfiguration() sets routing resource type');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testRouterRequiresResourceOption()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$container = $this->createContainer();
$loader = new FrameworkExtension();
$loader->load([['router' => true]], $container);
@@ -473,11 +464,9 @@ public function testNullSessionHandler()
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testNullSessionHandlerWithSavePath()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->createContainerFromFile('session_savepath');
}
@@ -645,11 +634,9 @@ public function testTranslatorHelperIsNotRegisteredWhenTranslatorIsDisabled()
$this->assertFalse($container->has('templating.helper.translator'));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testTemplatingRequiresAtLeastOneEngine()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$container = $this->createContainer();
$loader = new FrameworkExtension();
$loader->load([['templating' => null]], $container);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
index ec39372b1dcde..6f36888de4136 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
@@ -11,23 +11,24 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
class PhpFrameworkExtensionTest extends FrameworkExtensionTest
{
+ use ForwardCompatTestTrait;
+
protected function loadFromFile(ContainerBuilder $container, $file)
{
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
$loader->load($file.'.php');
}
- /**
- * @expectedException \LogicException
- */
public function testAssetsCannotHavePathAndUrl()
{
+ $this->expectException('LogicException');
$this->createContainerFromClosure(function ($container) {
$container->loadFromExtension('framework', [
'assets' => [
@@ -38,11 +39,9 @@ public function testAssetsCannotHavePathAndUrl()
});
}
- /**
- * @expectedException \LogicException
- */
public function testAssetPackageCannotHavePathAndUrl()
{
+ $this->expectException('LogicException');
$this->createContainerFromClosure(function ($container) {
$container->loadFromExtension('framework', [
'assets' => [
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
index 7ae8258c60911..95cf725ce9c7e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
@@ -68,12 +68,10 @@ public function testCallClearer()
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- * @expectedExceptionMessage You have requested a non-existent service "unknown_pool"
- */
public function testClearUnexistingPool()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
+ $this->expectExceptionMessage('You have requested a non-existent service "unknown_pool"');
$this->createCommandTester()
->execute(['pools' => ['unknown_pool']], ['decorated' => false]);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
index ebf6561a6156d..f3a69dfcc7c3d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
class CachePoolsTest extends AbstractWebTestCase
{
+ use ForwardCompatTestTrait;
+
public function testCachePools()
{
$this->doTestCachePools([], AdapterInterface::class);
@@ -34,7 +37,7 @@ public function testRedisCachePools()
throw $e;
}
$this->markTestSkipped($e->getMessage());
- } catch (\PHPUnit_Framework_Error_Warning $e) {
+ } catch (\PHPUnit\Framework\Error\Warning $e) {
if (0 !== strpos($e->getMessage(), 'unable to connect to')) {
throw $e;
}
@@ -59,7 +62,7 @@ public function testRedisCustomCachePools()
throw $e;
}
$this->markTestSkipped($e->getMessage());
- } catch (\PHPUnit_Framework_Error_Warning $e) {
+ } catch (\PHPUnit\Framework\Error\Warning $e) {
if (0 !== strpos($e->getMessage(), 'unable to connect to')) {
throw $e;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
index 9fe45527cffe8..2280a4bec590a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Routing;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
use Symfony\Component\Routing\Route;
@@ -19,6 +20,8 @@
class RouterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGenerateWithServiceParam()
{
$routes = new RouteCollection();
@@ -133,12 +136,10 @@ public function testPatternPlaceholders()
);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Using "%env(FOO)%" is not allowed in routing configuration.
- */
public function testEnvPlaceholders()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Using "%env(FOO)%" is not allowed in routing configuration.');
$routes = new RouteCollection();
$routes->add('foo', new Route('/%env(FOO)%'));
@@ -168,12 +169,10 @@ public function testHostPlaceholders()
);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
- * @expectedExceptionMessage You have requested a non-existent parameter "nope".
- */
public function testExceptionOnNonExistentParameter()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException');
+ $this->expectExceptionMessage('You have requested a non-existent parameter "nope".');
$routes = new RouteCollection();
$routes->add('foo', new Route('/%nope%'));
@@ -184,12 +183,10 @@ public function testExceptionOnNonExistentParameter()
$router->getRouteCollection()->get('foo');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.
- */
public function testExceptionOnNonStringParameter()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.');
$routes = new RouteCollection();
$routes->add('foo', new Route('/%object%'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
index 1fae0526d5d1b..41094ad2aa726 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
use Symfony\Component\HttpFoundation\Response;
class DelegatingEngineTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupportsRetrievesEngineFromTheContainer()
{
$container = $this->getContainerMock([
@@ -43,12 +46,10 @@ public function testGetExistingEngine()
$this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php'));
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage No engine is able to work with the template "template.php"
- */
public function testGetInvalidEngine()
{
+ $this->expectException('RuntimeException');
+ $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);
$container = $this->getContainerMock([
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
index c78b7e5b2910f..d4d0cebfd6145 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
class TemplateLocatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLocateATemplate()
{
$template = new TemplateReference('bundle', 'controller', 'name', 'format', 'engine');
@@ -77,11 +80,9 @@ public function testThrowsExceptionWhenTemplateNotFound()
}
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testThrowsAnExceptionWhenTemplateIsNotATemplateReferenceInterface()
{
+ $this->expectException('InvalidArgumentException');
$locator = new TemplateLocator($this->getFileLocator());
$locator->locate('template');
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
index 9628828afaecb..0e9f7dd20e4f6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
use Symfony\Bundle\FrameworkBundle\Templating\PhpEngine;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -23,6 +24,8 @@
class PhpEngineTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testEvaluateAddsAppGlobal()
{
$container = $this->getContainer();
@@ -43,11 +46,9 @@ public function testEvaluateWithoutAvailableRequest()
$this->assertEmpty($globals['app']->getRequest());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testGetInvalidHelper()
{
+ $this->expectException('InvalidArgumentException');
$container = $this->getContainer();
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
$engine = new PhpEngine(new TemplateNameParser(), $container, $loader);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
index 0866c6ba65031..180d0c938b8d7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
@@ -77,11 +77,9 @@ public function parseProvider()
];
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testParseValidNameWithNotFoundBundle()
{
+ $this->expectException('InvalidArgumentException');
$this->parser->parse('BarBundle:Post:index.html.php');
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
index 0ca3216a2b572..3c23f9a06c56e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
@@ -110,10 +110,10 @@ public function testTransWithCachingOmittingLocale()
/**
* @group legacy
* @expectedDeprecation The "Symfony\Bundle\FrameworkBundle\Translation\Translator::__construct()" method takes the default locale as the 3rd argument since Symfony 3.3. Not passing it is deprecated and will trigger an error in 4.0.
- * @expectedException \InvalidArgumentException
*/
public function testTransWithCachingWithInvalidLocaleOmittingLocale()
{
+ $this->expectException('InvalidArgumentException');
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir], 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale', null);
@@ -159,11 +159,11 @@ public function testGetDefaultLocaleOmittingLocale()
/**
* @group legacy
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Missing third $defaultLocale argument.
*/
public function testGetDefaultLocaleOmittingLocaleWithPsrContainer()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Missing third $defaultLocale argument.');
$container = $this->getMockBuilder(ContainerInterface::class)->getMock();
$translator = new Translator($container, new MessageFormatter());
}
@@ -250,12 +250,10 @@ public function testTransWithCaching()
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid "invalid locale" locale.
- */
public function testTransWithCachingWithInvalidLocale()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid "invalid locale" locale.');
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir], 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale');
@@ -285,12 +283,10 @@ public function testGetDefaultLocale()
$this->assertSame('en', $translator->getLocale());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
- * @expectedExceptionMessage The Translator does not support the following options: 'foo'
- */
public function testInvalidOptions()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The Translator does not support the following options: \'foo\'');
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
(new Translator($container, new MessageFormatter(), 'en', [], ['foo' => 'bar']));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
index 8afe604c3a46d..8a3af2f2f2700 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Validator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Validator\Constraint;
@@ -23,6 +24,8 @@
*/
class ConstraintValidatorFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetInstanceCreatesValidator()
{
$factory = new ConstraintValidatorFactory(new Container());
@@ -59,11 +62,9 @@ public function testGetInstanceReturnsServiceWithAlias()
$this->assertSame($validator, $factory->getInstance(new ConstraintAliasStub()));
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ValidatorException
- */
public function testGetInstanceInvalidValidatorClass()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
$constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock();
$constraint
->expects($this->exactly(2))
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
index a97054cd70c82..b3825c5a8c851 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
@@ -24,11 +24,9 @@ class AddSecurityVotersPassTest extends TestCase
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- */
public function testNoVoters()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$container = new ContainerBuilder();
$container
->register('security.access.decision_manager', AccessDecisionManager::class)
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
index c31fe9de20f61..65243c7e4cf4c 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -22,6 +23,8 @@
abstract class CompleteConfigurationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
abstract protected function getLoader(ContainerBuilder $container);
abstract protected function getFileExtension();
@@ -553,12 +556,10 @@ public function testCustomAccessDecisionManagerService()
$this->assertSame('app.access_decision_manager', (string) $container->getAlias('security.access.decision_manager'), 'The custom access decision manager service is aliased');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.
- */
public function testAccessDecisionManagerServiceAndStrategyCannotBeUsedAtTheSameTime()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.');
$this->getContainer('access_decision_manager_service_and_strategy');
}
@@ -573,21 +574,17 @@ public function testAccessDecisionManagerOptionsAreNotOverriddenByImplicitStrate
$this->assertFalse($accessDecisionManagerDefinition->getArgument(3));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage Invalid firewall "main": user provider "undefined" not found.
- */
public function testFirewallUndefinedUserProvider()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
$this->getContainer('firewall_undefined_provider');
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage Invalid firewall "main": user provider "undefined" not found.
- */
public function testFirewallListenerUndefinedProvider()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
$this->getContainer('listener_undefined_provider');
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php
index d7566df0fa5c2..1097d9064c509 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\MainConfiguration;
use Symfony\Component\Config\Definition\Processor;
class MainConfigurationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* The minimal, required config needed to not have any required validation
* issues.
@@ -33,11 +36,9 @@ class MainConfigurationTest extends TestCase
],
];
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testNoConfigForProvider()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$config = [
'providers' => [
'stub' => [],
@@ -49,11 +50,9 @@ public function testNoConfigForProvider()
$processor->processConfiguration($configuration, [$config]);
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testManyConfigForProvider()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$config = [
'providers' => [
'stub' => [
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php
index 81db40412a30f..b6fa11875bedd 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Security\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\GuardAuthenticationFactory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -20,6 +21,8 @@
class GuardAuthenticationFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getValidConfigurationTests
*/
@@ -37,11 +40,11 @@ public function testAddValidConfiguration(array $inputConfig, array $expectedCon
}
/**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @dataProvider getInvalidConfigurationTests
*/
public function testAddInvalidConfiguration(array $inputConfig)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$factory = new GuardAuthenticationFactory();
$nodeDefinition = new ArrayNodeDefinition('guard');
$factory->addConfiguration($nodeDefinition);
@@ -130,11 +133,9 @@ public function testExistingDefaultEntryPointUsed()
$this->assertEquals('some_default_entry_point', $entryPointId);
}
- /**
- * @expectedException \LogicException
- */
public function testCannotOverrideDefaultEntryPoint()
{
+ $this->expectException('LogicException');
// any existing default entry point is used
$config = [
'authenticators' => ['authenticator123'],
@@ -143,11 +144,9 @@ public function testCannotOverrideDefaultEntryPoint()
$this->executeCreate($config, 'some_default_entry_point');
}
- /**
- * @expectedException \LogicException
- */
public function testMultipleAuthenticatorsRequiresEntryPoint()
{
+ $this->expectException('LogicException');
// any existing default entry point is used
$config = [
'authenticators' => ['authenticator123', 'authenticatorABC'],
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
index 59f2ff037a385..e3328ad0ddc96 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\UserProvider\DummyProvider;
@@ -19,12 +20,12 @@
class SecurityExtensionTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The check_path "/some_area/login_check" for login method "form_login" is not matched by the firewall pattern "/secured_area/.*".
- */
+ use ForwardCompatTestTrait;
+
public function testInvalidCheckPath()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The check_path "/some_area/login_check" for login method "form_login" is not matched by the firewall pattern "/secured_area/.*".');
$container = $this->getRawContainer();
$container->loadFromExtension('security', [
@@ -46,12 +47,10 @@ public function testInvalidCheckPath()
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage No authentication listener registered for firewall "some_firewall"
- */
public function testFirewallWithoutAuthenticationListener()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('No authentication listener registered for firewall "some_firewall"');
$container = $this->getRawContainer();
$container->loadFromExtension('security', [
@@ -70,12 +69,10 @@ public function testFirewallWithoutAuthenticationListener()
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage Unable to create definition for "security.user.provider.concrete.my_foo" user provider
- */
public function testFirewallWithInvalidUserProvider()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('Unable to create definition for "security.user.provider.concrete.my_foo" user provider');
$container = $this->getRawContainer();
$extension = $container->getExtension('security');
@@ -186,11 +183,11 @@ public function testConfiguresLogoutOnUserChangeForContextListenersCorrectly()
/**
* @group legacy
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage Firewalls "some_firewall" and "some_other_firewall" need to have the same value for option "logout_on_user_change" as they are sharing the context "my_context"
*/
public function testThrowsIfLogoutOnUserChangeDifferentForSharedContext()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('Firewalls "some_firewall" and "some_other_firewall" need to have the same value for option "logout_on_user_change" as they are sharing the context "my_context"');
$container = $this->getRawContainer();
$container->loadFromExtension('security', [
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
index 0380f5cb1295f..bb0aed9bd82ed 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
@@ -208,12 +208,10 @@ public function testNonInteractiveEncodePasswordUsesFirstUserClass()
$this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $this->passwordEncoderCommandTester->getDisplay());
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage There are no configured encoders for the "security" extension.
- */
public function testThrowsExceptionOnNoConfiguredEncoders()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('There are no configured encoders for the "security" extension.');
$application = new ConsoleApplication();
$application->add(new UserPasswordEncoderCommand($this->getMockBuilder(EncoderFactoryInterface::class)->getMock(), []));
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
index a65aa03c57d3e..46911e37c7b16 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
@@ -90,11 +90,9 @@ public function testMapperPassWithTwoTaggedLoadersWithPriority()
$this->assertEquals('test_loader_1', (string) $calls[1][1][0]);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- */
public function testMapperPassWithZeroTaggedLoaders()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->pass->process($this->builder);
}
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
index 906a0bc10806c..9e5eb299b3586 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Bundle\TwigBundle\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
class FilesystemLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetSourceContext()
{
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
@@ -51,11 +54,9 @@ public function testExists()
$this->assertTrue($loader->exists($template));
}
- /**
- * @expectedException \Twig\Error\LoaderError
- */
public function testTwigErrorIfLocatorThrowsInvalid()
{
+ $this->expectException('Twig\Error\LoaderError');
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$parser
->expects($this->once())
@@ -75,11 +76,9 @@ public function testTwigErrorIfLocatorThrowsInvalid()
$loader->getCacheKey('name.format.engine');
}
- /**
- * @expectedException \Twig\Error\LoaderError
- */
public function testTwigErrorIfLocatorReturnsFalse()
{
+ $this->expectException('Twig\Error\LoaderError');
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$parser
->expects($this->once())
@@ -99,12 +98,10 @@ public function testTwigErrorIfLocatorReturnsFalse()
$loader->getCacheKey('name.format.engine');
}
- /**
- * @expectedException \Twig\Error\LoaderError
- * @expectedExceptionMessageRegExp /Unable to find template "name\.format\.engine" \(looked into: .*Tests.Loader.\.\..DependencyInjection.Fixtures.Resources.views\)/
- */
public function testTwigErrorIfTemplateDoesNotExist()
{
+ $this->expectException('Twig\Error\LoaderError');
+ $this->expectExceptionMessageRegExp('/Unable to find template "name\.format\.engine" \(looked into: .*Tests.Loader.\.\..DependencyInjection.Fixtures.Resources.views\)/');
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
index 387fefa981585..d4fb9f402cb4e 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
@@ -56,11 +56,9 @@ private function doSetUp()
$this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
- */
public function testGetNameOfInvalidTemplate()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\NotFoundHttpException');
$this->templateManager->getName(new Profile('token'), 'notexistingpanel');
}
diff --git a/src/Symfony/Component/Asset/Tests/PackagesTest.php b/src/Symfony/Component/Asset/Tests/PackagesTest.php
index b751986d48dd0..0ab1505a8aa0f 100644
--- a/src/Symfony/Component/Asset/Tests/PackagesTest.php
+++ b/src/Symfony/Component/Asset/Tests/PackagesTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Asset\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\Packages;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
class PackagesTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetterSetters()
{
$packages = new Packages();
@@ -55,20 +58,16 @@ public function testGetUrl()
$this->assertEquals('/foo?a', $packages->getUrl('/foo', 'a'));
}
- /**
- * @expectedException \Symfony\Component\Asset\Exception\LogicException
- */
public function testNoDefaultPackage()
{
+ $this->expectException('Symfony\Component\Asset\Exception\LogicException');
$packages = new Packages();
$packages->getPackage();
}
- /**
- * @expectedException \Symfony\Component\Asset\Exception\InvalidArgumentException
- */
public function testUndefinedPackage()
{
+ $this->expectException('Symfony\Component\Asset\Exception\InvalidArgumentException');
$packages = new Packages();
$packages->getPackage('a');
}
diff --git a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
index a68c59a1249c1..c95228ab7c659 100644
--- a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
+++ b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Asset\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
class UrlPackageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getConfigs
*/
@@ -88,19 +91,15 @@ public function testVersionStrategyGivesAbsoluteURL()
$this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
}
- /**
- * @expectedException \Symfony\Component\Asset\Exception\LogicException
- */
public function testNoBaseUrls()
{
+ $this->expectException('Symfony\Component\Asset\Exception\LogicException');
new UrlPackage([], new EmptyVersionStrategy());
}
- /**
- * @expectedException \Symfony\Component\Asset\Exception\InvalidArgumentException
- */
public function testWrongBaseUrl()
{
+ $this->expectException('Symfony\Component\Asset\Exception\InvalidArgumentException');
new UrlPackage(['not-a-url'], new EmptyVersionStrategy());
}
diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
index 9da2b4ada2856..83f6885a2c01c 100644
--- a/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
+++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Asset\Tests\VersionStrategy;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy;
class JsonManifestVersionStrategyTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetVersion()
{
$strategy = $this->createStrategy('manifest-valid.json');
@@ -37,21 +40,17 @@ public function testApplyVersionWhenKeyDoesNotExistInManifest()
$this->assertEquals('css/other.css', $strategy->getVersion('css/other.css'));
}
- /**
- * @expectedException \RuntimeException
- */
public function testMissingManifestFileThrowsException()
{
+ $this->expectException('RuntimeException');
$strategy = $this->createStrategy('non-existent-file.json');
$strategy->getVersion('main.js');
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Error parsing JSON
- */
public function testManifestFileWithBadJSONThrowsException()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Error parsing JSON');
$strategy = $this->createStrategy('manifest-invalid.json');
$strategy->getVersion('main.js');
}
diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
index 11acfa8471522..249703e82e96e 100644
--- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
@@ -197,12 +197,10 @@ public function testIsExpired()
$this->assertFalse($cookie->isExpired());
}
- /**
- * @expectedException \UnexpectedValueException
- * @expectedExceptionMessage The cookie expiration time "string" is not valid.
- */
public function testConstructException()
{
+ $this->expectException('UnexpectedValueException');
+ $this->expectExceptionMessage('The cookie expiration time "string" is not valid.');
$cookie = new Cookie('foo', 'bar', 'string');
}
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
index 3b42697fe1385..4688a3736cbfd 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ChainAdapter;
@@ -24,26 +25,24 @@
*/
class ChainAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
public function createCachePool($defaultLifetime = 0)
{
return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime);
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage At least one adapter must be specified.
- */
public function testEmptyAdaptersException()
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('At least one adapter must be specified.');
new ChainAdapter([]);
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage The class "stdClass" does not implement
- */
public function testInvalidAdapterException()
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The class "stdClass" does not implement');
new ChainAdapter([new \stdClass()]);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php
index 8bea26810c07d..b54007bbbb08e 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
class MaxIdLengthAdapterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLongKey()
{
$cache = $this->getMockBuilder(MaxIdLengthAdapter::class)
@@ -62,12 +65,10 @@ public function testLongKeyVersioning()
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)])));
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Namespace must be 26 chars max, 40 given ("----------------------------------------")
- */
public function testTooLongNamespace()
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")');
$cache = $this->getMockBuilder(MaxIdLengthAdapter::class)
->setConstructorArgs([str_repeat('-', 40)])
->getMock();
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
index a69a922089706..b4fc5f87f9b37 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
@@ -66,11 +66,11 @@ public function testOptions()
/**
* @dataProvider provideBadOptions
- * @expectedException \ErrorException
- * @expectedExceptionMessage constant(): Couldn't find constant Memcached::
*/
public function testBadOptions($name, $value)
{
+ $this->expectException('ErrorException');
+ $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
MemcachedAdapter::createConnection([], [$name => $value]);
}
@@ -96,12 +96,10 @@ public function testDefaultOptions()
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\CacheException
- * @expectedExceptionMessage MemcachedAdapter: "serializer" option must be "php" or "igbinary".
- */
public function testOptionSerializer()
{
+ $this->expectException('Symfony\Component\Cache\Exception\CacheException');
+ $this->expectExceptionMessage('MemcachedAdapter: "serializer" option must be "php" or "igbinary".');
if (!\Memcached::HAVE_JSON) {
$this->markTestSkipped('Memcached::HAVE_JSON required');
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
index f69ad67939f79..93e070671f8ed 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ProxyAdapter;
use Symfony\Component\Cache\CacheItem;
@@ -21,6 +22,8 @@
*/
class ProxyAdapterTest extends AdapterTestCase
{
+ use ForwardCompatTestTrait;
+
protected $skippedTests = [
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.',
'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.',
@@ -32,12 +35,10 @@ public function createCachePool($defaultLifetime = 0)
return new ProxyAdapter(new ArrayAdapter(), '', $defaultLifetime);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage OK bar
- */
public function testProxyfiedItem()
{
+ $this->expectException('Exception');
+ $this->expectExceptionMessage('OK bar');
$item = new CacheItem();
$pool = new ProxyAdapter(new TestingArrayAdapter($item));
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
index d4de198e29bec..b5db20a14aba4 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
@@ -58,11 +58,11 @@ public function testCreateConnection()
/**
* @dataProvider provideFailedCreateConnection
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Redis connection failed
*/
public function testFailedCreateConnection($dsn)
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Redis connection failed');
RedisAdapter::createConnection($dsn);
}
@@ -77,11 +77,11 @@ public function provideFailedCreateConnection()
/**
* @dataProvider provideInvalidCreateConnection
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid Redis DSN
*/
public function testInvalidCreateConnection($dsn)
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid Redis DSN');
RedisAdapter::createConnection($dsn);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
index 96103b0fed43b..627822d61f03a 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
@@ -33,11 +33,9 @@ private static function doTearDownAfterClass()
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
}
- /**
- * @expectedException \Psr\Cache\InvalidArgumentException
- */
public function testInvalidTag()
{
+ $this->expectException('Psr\Cache\InvalidArgumentException');
$pool = $this->createCachePool();
$item = $pool->getItem('foo');
$item->tag(':');
diff --git a/src/Symfony/Component/Cache/Tests/CacheItemTest.php b/src/Symfony/Component/Cache/Tests/CacheItemTest.php
index fff5202b178a8..3c70b915a8ba8 100644
--- a/src/Symfony/Component/Cache/Tests/CacheItemTest.php
+++ b/src/Symfony/Component/Cache/Tests/CacheItemTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Cache\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\CacheItem;
class CacheItemTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testValidKey()
{
$this->assertSame('foo', CacheItem::validateKey('foo'));
@@ -23,11 +26,11 @@ public function testValidKey()
/**
* @dataProvider provideInvalidKey
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Cache key
*/
public function testInvalidKey($key)
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Cache key');
CacheItem::validateKey($key);
}
@@ -66,11 +69,11 @@ public function testTag()
/**
* @dataProvider provideInvalidKey
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Cache tag
*/
public function testInvalidTag($tag)
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Cache tag');
$item = new CacheItem();
$item->tag($tag);
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
index aa77887919b74..b9642843e3b80 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Cache\Tests\Simple;
use Psr\SimpleCache\CacheInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Simple\ArrayCache;
use Symfony\Component\Cache\Simple\ChainCache;
@@ -22,26 +23,24 @@
*/
class ChainCacheTest extends CacheTestCase
{
+ use ForwardCompatTestTrait;
+
public function createSimpleCache($defaultLifetime = 0)
{
return new ChainCache([new ArrayCache($defaultLifetime), new FilesystemCache('', $defaultLifetime)], $defaultLifetime);
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage At least one cache must be specified.
- */
public function testEmptyCachesException()
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('At least one cache must be specified.');
new ChainCache([]);
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage The class "stdClass" does not implement
- */
public function testInvalidCacheException()
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The class "stdClass" does not implement');
new ChainCache([new \stdClass()]);
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
index 570666c51df79..dd7c07d741892 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
@@ -76,11 +76,11 @@ public function testOptions()
/**
* @dataProvider provideBadOptions
- * @expectedException \ErrorException
- * @expectedExceptionMessage constant(): Couldn't find constant Memcached::
*/
public function testBadOptions($name, $value)
{
+ $this->expectException('ErrorException');
+ $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
MemcachedCache::createConnection([], [$name => $value]);
}
@@ -105,12 +105,10 @@ public function testDefaultOptions()
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
}
- /**
- * @expectedException \Symfony\Component\Cache\Exception\CacheException
- * @expectedExceptionMessage MemcachedAdapter: "serializer" option must be "php" or "igbinary".
- */
public function testOptionSerializer()
{
+ $this->expectException('Symfony\Component\Cache\Exception\CacheException');
+ $this->expectExceptionMessage('MemcachedAdapter: "serializer" option must be "php" or "igbinary".');
if (!\Memcached::HAVE_JSON) {
$this->markTestSkipped('Memcached::HAVE_JSON required');
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
index 9f7359ddbef1f..5485c69869ec3 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
@@ -48,11 +48,11 @@ public function testCreateConnection()
/**
* @dataProvider provideFailedCreateConnection
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Redis connection failed
*/
public function testFailedCreateConnection($dsn)
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Redis connection failed');
RedisCache::createConnection($dsn);
}
@@ -67,11 +67,11 @@ public function provideFailedCreateConnection()
/**
* @dataProvider provideInvalidCreateConnection
- * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid Redis DSN
*/
public function testInvalidCreateConnection($dsn)
{
+ $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid Redis DSN');
RedisCache::createConnection($dsn);
}
diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
index 816f3c39451fd..ba14198f09673 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\ClassLoader\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\ClassLoader\Tests\Fixtures\DeclaredClass;
use Symfony\Component\ClassLoader\Tests\Fixtures\WarmedClass;
@@ -26,6 +27,8 @@
*/
class ClassCollectionLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testTraitDependencies()
{
require_once __DIR__.'/Fixtures/deps/traits.php';
@@ -208,11 +211,9 @@ public function getFixNamespaceDeclarationsDataWithoutTokenizer()
];
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testUnableToLoadClassException()
{
+ $this->expectException('InvalidArgumentException');
if (is_file($file = sys_get_temp_dir().'/foo.php')) {
unlink($file);
}
diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php
index 24e3224ce5ba0..595a4f25b459c 100644
--- a/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php
+++ b/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php
@@ -12,16 +12,17 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\ConfigCacheFactory;
class ConfigCacheFactoryTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid type for callback argument. Expected callable, but got "object".
- */
+ use ForwardCompatTestTrait;
+
public function testCacheWithInvalidCallback()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid type for callback argument. Expected callable, but got "object".');
$cacheFactory = new ConfigCacheFactory(true);
$cacheFactory->cache('file', new \stdClass());
diff --git a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
index 2440a2eb9537c..32ac55067ef57 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
@@ -21,21 +21,17 @@ class ArrayNodeTest extends TestCase
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
- */
public function testNormalizeThrowsExceptionWhenFalseIsNotAllowed()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
$node = new ArrayNode('root');
$node->normalize(false);
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage Unrecognized option "foo" under "root"
- */
public function testExceptionThrownOnUnrecognizedChild()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('Unrecognized option "foo" under "root"');
$node = new ArrayNode('root');
$node->normalize(['foo' => 'bar']);
}
@@ -179,24 +175,20 @@ public function getPreNormalizedNormalizedOrderedData()
];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Child nodes must be named.
- */
public function testAddChildEmptyName()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Child nodes must be named.');
$node = new ArrayNode('root');
$childNode = new ArrayNode('');
$node->addChild($childNode);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage A child node named "foo" already exists.
- */
public function testAddChildNameAlreadyExists()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('A child node named "foo" already exists.');
$node = new ArrayNode('root');
$childNode = new ArrayNode('foo');
@@ -206,12 +198,10 @@ public function testAddChildNameAlreadyExists()
$node->addChild($childNodeWithSameName);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage The node at path "foo" has no default value.
- */
public function testGetDefaultValueWithoutDefaultValue()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('The node at path "foo" has no default value.');
$node = new ArrayNode('foo');
$node->getDefaultValue();
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
index bfa2fd3e287ec..df10377d4a928 100644
--- a/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\BooleanNode;
class BooleanNodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getValidValues
*/
@@ -48,10 +51,10 @@ public function getValidValues()
/**
* @dataProvider getInvalidValues
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
public function testNormalizeThrowsExceptionOnInvalidValues($value)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
$node = new BooleanNode('test');
$node->normalize($value);
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
index 4ad7eabf31666..976b46c27446c 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;
@@ -19,6 +20,8 @@
class ArrayNodeDefinitionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testAppendingSomeNode()
{
$parent = new ArrayNodeDefinition('root');
@@ -36,11 +39,11 @@ public function testAppendingSomeNode()
}
/**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
* @dataProvider providePrototypeNodeSpecificCalls
*/
public function testPrototypeNodeSpecificOption($method, $args)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
$node = new ArrayNodeDefinition('root');
\call_user_func_array([$node, $method], $args);
@@ -58,11 +61,9 @@ public function providePrototypeNodeSpecificCalls()
];
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
- */
public function testConcreteNodeSpecificOption()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
$node = new ArrayNodeDefinition('root');
$node
->addDefaultsIfNotSet()
@@ -71,11 +72,9 @@ public function testConcreteNodeSpecificOption()
$node->getNode();
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
- */
public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaultChildren()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
$node = new ArrayNodeDefinition('root');
$node
->defaultValue([])
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php
index c0d347f3d3191..dd605b80b0147 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php
@@ -12,16 +12,17 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition;
class BooleanNodeDefinitionTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
- * @expectedExceptionMessage ->cannotBeEmpty() is not applicable to BooleanNodeDefinition.
- */
+ use ForwardCompatTestTrait;
+
public function testCannotBeEmptyThrowsAnException()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.');
$def = new BooleanNodeDefinition('foo');
$def->cannotBeEmpty();
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php
index 26f8586dcb578..6247bfaea39d8 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition;
class EnumNodeDefinitionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testWithOneValue()
{
$def = new EnumNodeDefinition('foo');
@@ -34,22 +37,18 @@ public function testWithOneDistinctValue()
$this->assertEquals(['foo'], $node->getValues());
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must call ->values() on enum nodes.
- */
public function testNoValuesPassed()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must call ->values() on enum nodes.');
$def = new EnumNodeDefinition('foo');
$def->getNode();
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage ->values() must be called with at least one value.
- */
public function testWithNoValues()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('->values() must be called with at least one value.');
$def = new EnumNodeDefinition('foo');
$def->values([]);
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
index 191bf1c0b5fd7..4332b60ddcfdf 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class ExprBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testAlwaysExpression()
{
$test = $this->getTestBuilder()
@@ -164,11 +167,9 @@ public function castToArrayValues()
yield [['value'], ['value']];
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testThenInvalid()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$test = $this->getTestBuilder()
->ifString()
->thenInvalid('Invalid value')
@@ -185,21 +186,17 @@ public function testThenUnsetExpression()
$this->assertEquals([], $this->finalizeTestBuilder($test));
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must specify an if part.
- */
public function testEndIfPartNotSpecified()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must specify an if part.');
$this->getTestBuilder()->end();
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must specify a then part.
- */
public function testEndThenPartNotSpecified()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must specify a then part.');
$builder = $this->getTestBuilder();
$builder->ifPart = 'test';
$builder->end();
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php
index cd77dd702bce6..cf91b69216c4a 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php
@@ -12,25 +12,24 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder;
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition;
class NodeBuilderTest extends TestCase
{
- /**
- * @expectedException \RuntimeException
- */
+ use ForwardCompatTestTrait;
+
public function testThrowsAnExceptionWhenTryingToCreateANonRegisteredNodeType()
{
+ $this->expectException('RuntimeException');
$builder = new BaseNodeBuilder();
$builder->node('', 'foobar');
}
- /**
- * @expectedException \RuntimeException
- */
public function testThrowsAnExceptionWhenTheNodeClassIsNotFound()
{
+ $this->expectException('RuntimeException');
$builder = new BaseNodeBuilder();
$builder
->setNodeClass('noclasstype', '\\foo\\bar\\noclass')
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
index 31342503d8d08..cfd71f4196d99 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
@@ -12,48 +12,43 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition;
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition;
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition;
class NumericNodeDefinitionTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage You cannot define a min(4) as you already have a max(3)
- */
+ use ForwardCompatTestTrait;
+
public function testIncoherentMinAssertion()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('You cannot define a min(4) as you already have a max(3)');
$def = new NumericNodeDefinition('foo');
$def->max(3)->min(4);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage You cannot define a max(2) as you already have a min(3)
- */
public function testIncoherentMaxAssertion()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('You cannot define a max(2) as you already have a min(3)');
$node = new NumericNodeDefinition('foo');
$node->min(3)->max(2);
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The value 4 is too small for path "foo". Should be greater than or equal to 5
- */
public function testIntegerMinAssertion()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The value 4 is too small for path "foo". Should be greater than or equal to 5');
$def = new IntegerNodeDefinition('foo');
$def->min(5)->getNode()->finalize(4);
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The value 4 is too big for path "foo". Should be less than or equal to 3
- */
public function testIntegerMaxAssertion()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The value 4 is too big for path "foo". Should be less than or equal to 3');
$def = new IntegerNodeDefinition('foo');
$def->max(3)->getNode()->finalize(4);
}
@@ -65,22 +60,18 @@ public function testIntegerValidMinMaxAssertion()
$this->assertEquals(4, $node->finalize(4));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The value 400 is too small for path "foo". Should be greater than or equal to 500
- */
public function testFloatMinAssertion()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The value 400 is too small for path "foo". Should be greater than or equal to 500');
$def = new FloatNodeDefinition('foo');
$def->min(5E2)->getNode()->finalize(4e2);
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The value 4.3 is too big for path "foo". Should be less than or equal to 0.3
- */
public function testFloatMaxAssertion()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The value 4.3 is too big for path "foo". Should be less than or equal to 0.3');
$def = new FloatNodeDefinition('foo');
$def->max(0.3)->getNode()->finalize(4.3);
}
@@ -92,12 +83,10 @@ public function testFloatValidMinMaxAssertion()
$this->assertEquals(4.5, $node->finalize(4.5));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
- * @expectedExceptionMessage ->cannotBeEmpty() is not applicable to NumericNodeDefinition.
- */
public function testCannotBeEmptyThrowsAnException()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('->cannotBeEmpty() is not applicable to NumericNodeDefinition.');
$def = new NumericNodeDefinition('foo');
$def->cannotBeEmpty();
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php
index 206bfdd5b98ff..75625a6fbdee0 100644
--- a/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php
@@ -12,22 +12,23 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\EnumNode;
class EnumNodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testFinalizeValue()
{
$node = new EnumNode('foo', null, ['foo', 'bar']);
$this->assertSame('foo', $node->finalize('foo'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage $values must contain at least one element.
- */
public function testConstructionWithNoValues()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('$values must contain at least one element.');
new EnumNode('foo', null, []);
}
@@ -43,12 +44,10 @@ public function testConstructionWithOneDistinctValue()
$this->assertSame('foo', $node->finalize('foo'));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar"
- */
public function testFinalizeWithInvalidValue()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar"');
$node = new EnumNode('foo', null, ['foo', 'bar']);
$node->finalize('foobar');
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
index 8268fe83ba7be..16b570930d213 100644
--- a/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\FloatNode;
class FloatNodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getValidValues
*/
@@ -54,10 +57,10 @@ public function getValidValues()
/**
* @dataProvider getInvalidValues
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
public function testNormalizeThrowsExceptionOnInvalidValues($value)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
$node = new FloatNode('test');
$node->normalize($value);
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
index b4c17e1cb9a35..b7fb73caf6b16 100644
--- a/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\IntegerNode;
class IntegerNodeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getValidValues
*/
@@ -49,10 +52,10 @@ public function getValidValues()
/**
* @dataProvider getInvalidValues
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
public function testNormalizeThrowsExceptionOnInvalidValues($value)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
$node = new IntegerNode('test');
$node->normalize($value);
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/MergeTest.php b/src/Symfony/Component/Config/Tests/Definition/MergeTest.php
index 5d37e137bd764..db72d7f8fc8e7 100644
--- a/src/Symfony/Component/Config/Tests/Definition/MergeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/MergeTest.php
@@ -12,15 +12,16 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class MergeTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException
- */
+ use ForwardCompatTestTrait;
+
public function testForbiddenOverwrite()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException');
$tb = new TreeBuilder();
$tree = $tb
->root('root', 'array')
@@ -92,11 +93,9 @@ public function testUnsetKey()
], $tree->merge($a, $b));
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- */
public function testDoesNotAllowNewKeysInSubsequentConfigs()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$tb = new TreeBuilder();
$tree = $tb
->root('config', 'array')
diff --git a/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php b/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php
index d6544ccc817eb..db67a9f4916bf 100644
--- a/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\NodeInterface;
class NormalizationTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getEncoderTests
*/
@@ -169,12 +172,10 @@ public function getNumericKeysTests()
return array_map(function ($v) { return [$v]; }, $configs);
}
- /**
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
- * @expectedExceptionMessage The attribute "id" must be set for path "root.thing".
- */
public function testNonAssociativeArrayThrowsExceptionIfAttributeNotSet()
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
+ $this->expectExceptionMessage('The attribute "id" must be set for path "root.thing".');
$denormalized = [
'thing' => [
['foo', 'bar'], ['baz', 'qux'],
diff --git a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
index 36f25667ce319..e59421211d2a9 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
@@ -77,10 +77,10 @@ public function testSetDeprecated()
/**
* @dataProvider getInvalidValues
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
public function testNormalizeThrowsExceptionOnInvalidValues($value)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
$node = new ScalarNode('test');
$node->normalize($value);
}
@@ -143,12 +143,12 @@ public function getValidNonEmptyValues()
/**
* @dataProvider getEmptyValues
- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*
* @param mixed $value
*/
public function testNotAllowedEmptyValuesThrowException($value)
{
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$node = new ScalarNode('test');
$node->setAllowEmptyValue(false);
$node->finalize($value);
diff --git a/src/Symfony/Component/Config/Tests/FileLocatorTest.php b/src/Symfony/Component/Config/Tests/FileLocatorTest.php
index 0bd97f7d8a38e..6e2b1a045d6f9 100644
--- a/src/Symfony/Component/Config/Tests/FileLocatorTest.php
+++ b/src/Symfony/Component/Config/Tests/FileLocatorTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
class FileLocatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getIsAbsolutePathTests
*/
@@ -86,33 +89,27 @@ public function testLocate()
);
}
- /**
- * @expectedException \Symfony\Component\Config\Exception\FileLocatorFileNotFoundException
- * @expectedExceptionMessage The file "foobar.xml" does not exist
- */
public function testLocateThrowsAnExceptionIfTheFileDoesNotExists()
{
+ $this->expectException('Symfony\Component\Config\Exception\FileLocatorFileNotFoundException');
+ $this->expectExceptionMessage('The file "foobar.xml" does not exist');
$loader = new FileLocator([__DIR__.'/Fixtures']);
$loader->locate('foobar.xml', __DIR__);
}
- /**
- * @expectedException \Symfony\Component\Config\Exception\FileLocatorFileNotFoundException
- */
public function testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath()
{
+ $this->expectException('Symfony\Component\Config\Exception\FileLocatorFileNotFoundException');
$loader = new FileLocator([__DIR__.'/Fixtures']);
$loader->locate(__DIR__.'/Fixtures/foobar.xml', __DIR__);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage An empty file name is not valid to be located.
- */
public function testLocateEmpty()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('An empty file name is not valid to be located.');
$loader = new FileLocator([__DIR__.'/Fixtures']);
$loader->locate(null, __DIR__);
diff --git a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
index 6556962d1f15c..ca8780370d8a4 100644
--- a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
+++ b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderResolver;
class DelegatingLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$loader = new DelegatingLoader($resolver = new LoaderResolver());
@@ -56,11 +59,9 @@ public function testLoad()
$loader->load('foo');
}
- /**
- * @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
- */
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
{
+ $this->expectException('Symfony\Component\Config\Exception\FileLoaderLoadException');
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
$loader->expects($this->once())->method('supports')->willReturn(false);
$resolver = new LoaderResolver([$loader]);
diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
index 0c6e3fc025d19..55a6f70672fd1 100644
--- a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
+++ b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Loader\Loader;
class LoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetSetResolver()
{
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
@@ -43,11 +46,9 @@ public function testResolve()
$this->assertSame($resolvedLoader, $loader->resolve('foo.xml'), '->resolve() finds a loader');
}
- /**
- * @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
- */
public function testResolveWhenResolverCannotFindLoader()
{
+ $this->expectException('Symfony\Component\Config\Exception\FileLoaderLoadException');
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
$resolver->expects($this->once())
->method('resolve')
diff --git a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
index 5612e7ca24636..8807d9fb0e235 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
@@ -13,12 +13,15 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fixtures\BadParent;
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
class ClassExistenceResourceTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testToString()
{
$res = new ClassExistenceResource('BarClass');
@@ -86,12 +89,10 @@ public function testBadParentWithTimestamp()
$this->assertTrue($res->isFresh(time()));
}
- /**
- * @expectedException \ReflectionException
- * @expectedExceptionMessage Class Symfony\Component\Config\Tests\Fixtures\MissingParent not found
- */
public function testBadParentWithNoTimestamp()
{
+ $this->expectException('ReflectionException');
+ $this->expectExceptionMessage('Class Symfony\Component\Config\Tests\Fixtures\MissingParent not found');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
index 6e86f9142dc88..2bdd3849b2fc5 100644
--- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
@@ -66,12 +66,10 @@ public function testGetPattern()
$this->assertEquals('bar', $resource->getPattern());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /The directory ".*" does not exist./
- */
public function testResourceDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/The directory ".*" does not exist./');
$resource = new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999));
}
diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
index 091d9630e0ef2..8aa0e4b3ac9a6 100644
--- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
@@ -56,12 +56,10 @@ public function testToString()
$this->assertSame(realpath($this->file), (string) $this->resource);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /The file ".*" does not exist./
- */
public function testResourceDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/The file ".*" does not exist./');
$resource = new FileResource('/____foo/foobar'.mt_rand(1, 999999));
}
diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
index 8c5d0a957f0f2..3f54a1e68ef45 100644
--- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
+++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
@@ -65,12 +65,10 @@ public function testLoadFile()
$this->assertSame([], libxml_get_errors());
}
- /**
- * @expectedException \Symfony\Component\Config\Util\Exception\InvalidXmlException
- * @expectedExceptionMessage The XML is not valid
- */
public function testParseWithInvalidValidatorCallable()
{
+ $this->expectException('Symfony\Component\Config\Util\Exception\InvalidXmlException');
+ $this->expectExceptionMessage('The XML is not valid');
$fixtures = __DIR__.'/../Fixtures/Util/';
$mock = $this->getMockBuilder(__NAMESPACE__.'\Validator')->getMock();
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 362c549d9b11d..f39eb1ea4fca1 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -201,12 +201,10 @@ public function testAdd()
$this->assertEquals([$foo, $foo1], [$commands['foo:bar'], $commands['foo:bar1']], '->addCommands() registers an array of commands');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Command class "Foo5Command" is not correctly initialized. You probably forgot to call the parent constructor.
- */
public function testAddCommandWithEmptyConstructor()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Command class "Foo5Command" is not correctly initialized. You probably forgot to call the parent constructor.');
$application = new Application();
$application->add(new \Foo5Command());
}
@@ -269,12 +267,10 @@ public function testSilentHelp()
$this->assertEmpty($tester->getDisplay(true));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- * @expectedExceptionMessage The command "foofoo" does not exist.
- */
public function testGetInvalidCommand()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage('The command "foofoo" does not exist.');
$application = new Application();
$application->get('foofoo');
}
@@ -328,22 +324,18 @@ public function testFindNonAmbiguous()
$this->assertEquals('test-ambiguous', $application->find('test')->getName());
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- * @expectedExceptionMessage There are no commands defined in the "bar" namespace.
- */
public function testFindInvalidNamespace()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage('There are no commands defined in the "bar" namespace.');
$application = new Application();
$application->findNamespace('bar');
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- * @expectedExceptionMessage Command "foo1" is not defined
- */
public function testFindUniqueNameButNamespaceName()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage('Command "foo1" is not defined');
$application = new Application();
$application->add(new \FooCommand());
$application->add(new \Foo1Command());
@@ -386,12 +378,10 @@ public function testFindCaseInsensitiveAsFallback()
$this->assertInstanceOf('FooSameCaseLowercaseCommand', $application->find('FoO:BaR'), '->find() will fallback to case insensitivity');
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- * @expectedExceptionMessage Command "FoO:BaR" is ambiguous
- */
public function testFindCaseInsensitiveSuggestions()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage('Command "FoO:BaR" is ambiguous');
$application = new Application();
$application->add(new \FooSameCaseLowercaseCommand());
$application->add(new \FooSameCaseUppercaseCommand());
@@ -479,12 +469,12 @@ public function testFindCommandWithMissingNamespace()
}
/**
- * @dataProvider provideInvalidCommandNamesSingle
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- * @expectedExceptionMessage Did you mean this
+ * @dataProvider provideInvalidCommandNamesSingle
*/
public function testFindAlternativeExceptionMessageSingle($name)
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage('Did you mean this');
$application = new Application();
$application->add(new \Foo3Command());
$application->find($name);
@@ -660,12 +650,10 @@ public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces()
$this->assertEquals('foo:sublong', $application->findNamespace('f:sub'));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- * @expectedExceptionMessage Command "foo::bar" is not defined.
- */
public function testFindWithDoubleColonInNameThrowsException()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
+ $this->expectExceptionMessage('Command "foo::bar" is not defined.');
$application = new Application();
$application->add(new \FooCommand());
$application->add(new \Foo4Command());
@@ -1035,12 +1023,10 @@ public function testRunDispatchesExitCodeOneForExceptionCodeZero()
$this->assertTrue($passedRightValue, '-> exit code 1 was passed in the console.terminate event');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage An option with shortcut "e" already exists.
- */
public function testAddingOptionWithDuplicateShortcut()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('An option with shortcut "e" already exists.');
$dispatcher = new EventDispatcher();
$application = new Application();
$application->setAutoExit(false);
@@ -1063,11 +1049,11 @@ public function testAddingOptionWithDuplicateShortcut()
}
/**
- * @expectedException \LogicException
* @dataProvider getAddingAlreadySetDefinitionElementData
*/
public function testAddingAlreadySetDefinitionElementData($def)
{
+ $this->expectException('LogicException');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@@ -1216,12 +1202,10 @@ public function testRunWithDispatcher()
$this->assertEquals('before.foo.after.'.PHP_EOL, $tester->getDisplay());
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage error
- */
public function testRunWithExceptionAndDispatcher()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('error');
$application = new Application();
$application->setDispatcher($this->getDispatcher());
$application->setAutoExit(false);
@@ -1396,11 +1380,11 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEvent()
/**
* @requires PHP 7
- * @expectedException \LogicException
- * @expectedExceptionMessage error
*/
public function testRunWithErrorAndDispatcher()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('error');
$application = new Application();
$application->setDispatcher($this->getDispatcher());
$application->setAutoExit(false);
@@ -1650,11 +1634,9 @@ public function testRunLazyCommandService()
$this->assertSame(['lazy:alias', 'lazy:alias2'], $command->getAliases());
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- */
public function testGetDisabledLazyCommand()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
$application = new Application();
$application->setCommandLoader(new FactoryCommandLoader(['disabled' => function () { return new DisabledCommand(); }]));
$application->get('disabled');
diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
index 9cb7e45dd7892..ed6b1b3e5d838 100644
--- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
@@ -43,12 +43,10 @@ public function testConstructor()
$this->assertEquals('foo:bar', $command->getName(), '__construct() takes the command name as its first argument');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage The command defined in "Symfony\Component\Console\Command\Command" cannot have an empty name.
- */
public function testCommandNameCannotBeEmpty()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('The command defined in "Symfony\Component\Console\Command\Command" cannot have an empty name.');
(new Application())->add(new Command());
}
@@ -217,12 +215,10 @@ public function testGetHelper()
$this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot retrieve helper "formatter" because there is no HelperSet defined.
- */
public function testGetHelperWithoutHelperSet()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Cannot retrieve helper "formatter" because there is no HelperSet defined.');
$command = new \TestCommand();
$command->getHelper('formatter');
}
@@ -290,22 +286,18 @@ public function testRunNonInteractive()
$this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage You must override the execute() method in the concrete command class.
- */
public function testExecuteMethodNeedsToBeOverridden()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('You must override the execute() method in the concrete command class.');
$command = new Command('foo');
$command->run(new StringInput(''), new NullOutput());
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\InvalidOptionException
- * @expectedExceptionMessage The "--bar" option does not exist.
- */
public function testRunWithInvalidOption()
{
+ $this->expectException('Symfony\Component\Console\Exception\InvalidOptionException');
+ $this->expectExceptionMessage('The "--bar" option does not exist.');
$command = new \TestCommand();
$tester = new CommandTester($command);
$tester->execute(['--bar' => true]);
diff --git a/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php b/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php
index 18d6e77bfba42..67625dc6c118d 100644
--- a/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php
+++ b/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Console\Tests\CommandLoader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Symfony\Component\DependencyInjection\ServiceLocator;
class ContainerCommandLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHas()
{
$loader = new ContainerCommandLoader(new ServiceLocator([
@@ -41,11 +44,9 @@ public function testGet()
$this->assertInstanceOf(Command::class, $loader->get('bar'));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- */
public function testGetUnknownCommandThrows()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
(new ContainerCommandLoader(new ServiceLocator([]), []))->get('unknown');
}
diff --git a/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php b/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php
index 7b9ec837e624f..f0fd40637e6bf 100644
--- a/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php
+++ b/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Console\Tests\CommandLoader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
class FactoryCommandLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHas()
{
$loader = new FactoryCommandLoader([
@@ -40,11 +43,9 @@ public function testGet()
$this->assertInstanceOf(Command::class, $loader->get('bar'));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
- */
public function testGetUnknownCommandThrows()
{
+ $this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
(new FactoryCommandLoader([]))->get('unknown');
}
diff --git a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
index b97d0a8f91998..8ed1b70e86078 100644
--- a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
+++ b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
@@ -24,6 +25,8 @@
class AddConsoleCommandPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider visibilityProvider
*/
@@ -121,12 +124,10 @@ public function visibilityProvider()
];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "my-command" tagged "console.command" must not be abstract.
- */
public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The service "my-command" tagged "console.command" must not be abstract.');
$container = new ContainerBuilder();
$container->setResourceTracking(false);
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
@@ -139,12 +140,10 @@ public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
$container->compile();
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".
- */
public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".');
$container = new ContainerBuilder();
$container->setResourceTracking(false);
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
@@ -227,12 +226,10 @@ public function testProcessOnChildDefinitionWithParentClass()
$this->assertInstanceOf($className, $command);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage The definition for "my-child-command" has no class.
- */
public function testProcessOnChildDefinitionWithoutClass()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('The definition for "my-child-command" has no class.');
$container = new ContainerBuilder();
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php
index e212bf25ec4c0..b170d8d00b2ca 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Console\Tests\Formatter;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Formatter\OutputFormatterStyleStack;
class OutputFormatterStyleStackTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testPush()
{
$stack = new OutputFormatterStyleStack();
@@ -59,11 +62,9 @@ public function testPopNotLast()
$this->assertEquals($s1, $stack->pop());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInvalidPop()
{
+ $this->expectException('InvalidArgumentException');
$stack = new OutputFormatterStyleStack();
$stack->push(new OutputFormatterStyle('white', 'black'));
$stack->pop(new OutputFormatterStyle('yellow', 'blue'));
diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php
index 6c6f86f36e3f9..df3a840927f45 100644
--- a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\ProgressIndicator;
use Symfony\Component\Console\Output\StreamOutput;
@@ -11,6 +12,8 @@
*/
class ProgressIndicatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDefaultIndicator()
{
$bar = new ProgressIndicator($output = $this->getOutputStream());
@@ -100,42 +103,34 @@ public function testCustomIndicatorValues()
);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Must have at least 2 indicator value characters.
- */
public function testCannotSetInvalidIndicatorCharacters()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Must have at least 2 indicator value characters.');
$bar = new ProgressIndicator($this->getOutputStream(), null, 100, ['1']);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Progress indicator already started.
- */
public function testCannotStartAlreadyStartedIndicator()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Progress indicator already started.');
$bar = new ProgressIndicator($this->getOutputStream());
$bar->start('Starting...');
$bar->start('Starting Again.');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Progress indicator has not yet been started.
- */
public function testCannotAdvanceUnstartedIndicator()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Progress indicator has not yet been started.');
$bar = new ProgressIndicator($this->getOutputStream());
$bar->advance();
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Progress indicator has not yet been started.
- */
public function testCannotFinishUnstartedIndicator()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Progress indicator has not yet been started.');
$bar = new ProgressIndicator($this->getOutputStream());
$bar->finish('Finished');
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
index 53819e4be70ed..559f5e11d49bf 100644
--- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Console\Tests\Helper;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\HelperSet;
@@ -25,6 +26,8 @@
*/
class QuestionHelperTest extends AbstractQuestionHelperTest
{
+ use ForwardCompatTestTrait;
+
public function testAskChoice()
{
$questionHelper = new QuestionHelper();
@@ -518,12 +521,10 @@ public function testSelectChoiceFromChoiceList($providedAnswer, $expectedValue)
$this->assertSame($expectedValue, $answer);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The provided answer is ambiguous. Value should be one of env_2 or env_3.
- */
public function testAmbiguousChoiceFromChoicelist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of env_2 or env_3.');
$possibleChoices = [
'env_1' => 'My first environment',
'env_2' => 'My environment',
@@ -748,7 +749,7 @@ public function testLegacyAskHiddenResponse()
}
/**
- * @group legacy
+ * @group legacy
* @dataProvider getAskConfirmationData
*/
public function testLegacyAskConfirmation($question, $expected, $default = true)
@@ -810,7 +811,7 @@ public function testLegacyAskAndValidate()
}
/**
- * @group legacy
+ * @group legacy
* @dataProvider simpleAnswerProvider
*/
public function testLegacySelectChoiceFromSimpleChoices($providedAnswer, $expectedValue)
@@ -834,7 +835,7 @@ public function testLegacySelectChoiceFromSimpleChoices($providedAnswer, $expect
}
/**
- * @group legacy
+ * @group legacy
* @dataProvider mixedKeysChoiceListAnswerProvider
*/
public function testLegacyChoiceFromChoicelistWithMixedKeys($providedAnswer, $expectedValue)
@@ -859,7 +860,7 @@ public function testLegacyChoiceFromChoicelistWithMixedKeys($providedAnswer, $ex
}
/**
- * @group legacy
+ * @group legacy
* @dataProvider answerProvider
*/
public function testLegacySelectChoiceFromChoiceList($providedAnswer, $expectedValue)
@@ -883,12 +884,12 @@ public function testLegacySelectChoiceFromChoiceList($providedAnswer, $expectedV
}
/**
- * @group legacy
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The provided answer is ambiguous. Value should be one of env_2 or env_3.
+ * @group legacy
*/
public function testLegacyAmbiguousChoiceFromChoicelist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of env_2 or env_3.');
$possibleChoices = [
'env_1' => 'My first environment',
'env_2' => 'My environment',
@@ -938,32 +939,26 @@ public function testLegacyChoiceOutputFormattingQuestionForUtf8Keys()
$dialog->ask($this->createInputInterfaceMock(), $output, $question);
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\RuntimeException
- * @expectedExceptionMessage Aborted.
- */
public function testAskThrowsExceptionOnMissingInput()
{
+ $this->expectException('Symfony\Component\Console\Exception\RuntimeException');
+ $this->expectExceptionMessage('Aborted.');
$dialog = new QuestionHelper();
$dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), new Question('What\'s your name?'));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\RuntimeException
- * @expectedExceptionMessage Aborted.
- */
public function testAskThrowsExceptionOnMissingInputForChoiceQuestion()
{
+ $this->expectException('Symfony\Component\Console\Exception\RuntimeException');
+ $this->expectExceptionMessage('Aborted.');
$dialog = new QuestionHelper();
$dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), new ChoiceQuestion('Choice', ['a', 'b']));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\RuntimeException
- * @expectedExceptionMessage Aborted.
- */
public function testAskThrowsExceptionOnMissingInputWithValidator()
{
+ $this->expectException('Symfony\Component\Console\Exception\RuntimeException');
+ $this->expectExceptionMessage('Aborted.');
$dialog = new QuestionHelper();
$question = new Question('What\'s your name?');
@@ -976,12 +971,10 @@ public function testAskThrowsExceptionOnMissingInputWithValidator()
$dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), $question);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Choice question must have at least 1 choice available.
- */
public function testEmptyChoices()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Choice question must have at least 1 choice available.');
new ChoiceQuestion('Question', [], 'irrelevant');
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
index 6f621db95448a..e464303782cda 100644
--- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
@@ -2,6 +2,7 @@
namespace Symfony\Component\Console\Tests\Helper;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
@@ -14,6 +15,8 @@
*/
class SymfonyQuestionHelperTest extends AbstractQuestionHelperTest
{
+ use ForwardCompatTestTrait;
+
public function testAskChoice()
{
$questionHelper = new SymfonyQuestionHelper();
@@ -122,12 +125,10 @@ public function testLabelTrailingBackslash()
$this->assertOutputContains('Question with a trailing \\', $output);
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\RuntimeException
- * @expectedExceptionMessage Aborted.
- */
public function testAskThrowsExceptionOnMissingInput()
{
+ $this->expectException('Symfony\Component\Console\Exception\RuntimeException');
+ $this->expectExceptionMessage('Aborted.');
$dialog = new SymfonyQuestionHelper();
$dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), new Question('What\'s your name?'));
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php b/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php
index 13e918b3a0fe2..2b1c07fd5c841 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php
@@ -12,16 +12,17 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\TableStyle;
class TableStyleTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).
- */
+ use ForwardCompatTestTrait;
+
public function testSetPadTypeWithInvalidType()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
$style = new TableStyle();
$style->setPadType('TEST');
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
index fa7cca3ab576b..c7241cb26d332 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
@@ -729,12 +729,10 @@ public function testColumnStyle()
$this->assertEquals($expected, $this->getOutputContent($output));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
- * @expectedExceptionMessage A cell must be a TableCell, a scalar or an object implementing __toString, array given.
- */
public function testThrowsWhenTheCellInAnArray()
{
+ $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing __toString, array given.');
$table = new Table($output = $this->getOutputStream());
$table
->setHeaders(['ISBN', 'Title', 'Author', 'Price'])
@@ -808,22 +806,18 @@ public function testColumnWidths()
$this->assertEquals($expected, $this->getOutputContent($output));
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
- * @expectedExceptionMessage Style "absent" is not defined.
- */
public function testIsNotDefinedStyleException()
{
+ $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Style "absent" is not defined.');
$table = new Table($this->getOutputStream());
$table->setStyle('absent');
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
- * @expectedExceptionMessage Style "absent" is not defined.
- */
public function testGetStyleDefinition()
{
+ $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Style "absent" is not defined.');
Table::getStyleDefinition('absent');
}
diff --git a/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php b/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
index 7bd0cff1abf44..f381c328b3c9a 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
@@ -94,22 +94,18 @@ public function testSetDefault()
$this->assertEquals([1, 2], $argument->getDefault(), '->setDefault() changes the default value');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot set a default value except for InputArgument::OPTIONAL mode.
- */
public function testSetDefaultWithRequiredArgument()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Cannot set a default value except for InputArgument::OPTIONAL mode.');
$argument = new InputArgument('foo', InputArgument::REQUIRED);
$argument->setDefault('default');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage A default value for an array argument must be an array.
- */
public function testSetDefaultWithArrayArgument()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('A default value for an array argument must be an array.');
$argument = new InputArgument('foo', InputArgument::IS_ARRAY);
$argument->setDefault('default');
}
diff --git a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
index 92fab322f67d7..c2e8361e0bfed 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
@@ -89,12 +89,10 @@ public function testAddArgument()
$this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getArguments(), '->addArgument() adds a InputArgument object');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage An argument with name "foo" already exists.
- */
public function testArgumentsMustHaveDifferentNames()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('An argument with name "foo" already exists.');
$this->initializeArguments();
$definition = new InputDefinition();
@@ -102,12 +100,10 @@ public function testArgumentsMustHaveDifferentNames()
$definition->addArgument($this->foo1);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot add an argument after an array argument.
- */
public function testArrayArgumentHasToBeLast()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Cannot add an argument after an array argument.');
$this->initializeArguments();
$definition = new InputDefinition();
@@ -115,12 +111,10 @@ public function testArrayArgumentHasToBeLast()
$definition->addArgument(new InputArgument('anotherbar'));
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot add a required argument after an optional one.
- */
public function testRequiredArgumentCannotFollowAnOptionalOne()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Cannot add a required argument after an optional one.');
$this->initializeArguments();
$definition = new InputDefinition();
@@ -137,12 +131,10 @@ public function testGetArgument()
$this->assertEquals($this->foo, $definition->getArgument('foo'), '->getArgument() returns a InputArgument by its name');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "bar" argument does not exist.
- */
public function testGetInvalidArgument()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "bar" argument does not exist.');
$this->initializeArguments();
$definition = new InputDefinition();
@@ -209,12 +201,10 @@ public function testSetOptions()
$this->assertEquals(['bar' => $this->bar], $definition->getOptions(), '->setOptions() clears all InputOption objects');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "-f" option does not exist.
- */
public function testSetOptionsClearsOptions()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "-f" option does not exist.');
$this->initializeOptions();
$definition = new InputDefinition([$this->foo]);
@@ -243,12 +233,10 @@ public function testAddOption()
$this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getOptions(), '->addOption() adds a InputOption object');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage An option named "foo" already exists.
- */
public function testAddDuplicateOption()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('An option named "foo" already exists.');
$this->initializeOptions();
$definition = new InputDefinition();
@@ -256,12 +244,10 @@ public function testAddDuplicateOption()
$definition->addOption($this->foo2);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage An option with shortcut "f" already exists.
- */
public function testAddDuplicateShortcutOption()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('An option with shortcut "f" already exists.');
$this->initializeOptions();
$definition = new InputDefinition();
@@ -277,12 +263,10 @@ public function testGetOption()
$this->assertEquals($this->foo, $definition->getOption('foo'), '->getOption() returns a InputOption by its name');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "--bar" option does not exist.
- */
public function testGetInvalidOption()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "--bar" option does not exist.');
$this->initializeOptions();
$definition = new InputDefinition([$this->foo]);
@@ -324,12 +308,10 @@ public function testGetOptionForMultiShortcut()
$this->assertEquals($this->multi, $definition->getOptionForShortcut('mmm'), '->getOptionForShortcut() returns a InputOption by its shortcut');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "-l" option does not exist.
- */
public function testGetOptionForInvalidShortcut()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "-l" option does not exist.');
$this->initializeOptions();
$definition = new InputDefinition([$this->foo]);
diff --git a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
index 78363806f29bf..6bdad84cbd903 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
@@ -27,12 +27,10 @@ public function testConstructor()
$this->assertEquals('foo', $option->getName(), '__construct() removes the leading -- of the option name');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.
- */
public function testArrayModeWithoutValue()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
new InputOption('foo', 'f', InputOption::VALUE_IS_ARRAY);
}
@@ -95,27 +93,21 @@ public function provideInvalidModes()
];
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testEmptyNameIsInvalid()
{
+ $this->expectException('InvalidArgumentException');
new InputOption('');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testDoubleDashNameIsInvalid()
{
+ $this->expectException('InvalidArgumentException');
new InputOption('--');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testSingleDashOptionIsInvalid()
{
+ $this->expectException('InvalidArgumentException');
new InputOption('foo', '-');
}
@@ -164,22 +156,18 @@ public function testSetDefault()
$this->assertEquals([1, 2], $option->getDefault(), '->setDefault() changes the default value');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot set a default value when using InputOption::VALUE_NONE mode.
- */
public function testDefaultValueWithValueNoneMode()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Cannot set a default value when using InputOption::VALUE_NONE mode.');
$option = new InputOption('foo', 'f', InputOption::VALUE_NONE);
$option->setDefault('default');
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage A default value for an array option must be an array.
- */
public function testDefaultValueWithIsArrayMode()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('A default value for an array option must be an array.');
$option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY);
$option->setDefault('default');
}
diff --git a/src/Symfony/Component/Console/Tests/Input/InputTest.php b/src/Symfony/Component/Console/Tests/Input/InputTest.php
index 61608bf27cf4d..a387b0a420c37 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
@@ -19,6 +20,8 @@
class InputTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')]));
@@ -47,22 +50,18 @@ public function testOptions()
$this->assertEquals(['name' => 'foo', 'bar' => null], $input->getOptions(), '->getOptions() returns all option values');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "foo" option does not exist.
- */
public function testSetInvalidOption()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "foo" option does not exist.');
$input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$input->setOption('foo', 'bar');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "foo" option does not exist.
- */
public function testGetInvalidOption()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "foo" option does not exist.');
$input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$input->getOption('foo');
}
@@ -81,43 +80,35 @@ public function testArguments()
$this->assertEquals(['name' => 'foo', 'bar' => 'default'], $input->getArguments(), '->getArguments() returns all argument values, even optional ones');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "foo" argument does not exist.
- */
public function testSetInvalidArgument()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "foo" argument does not exist.');
$input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')]));
$input->setArgument('foo', 'bar');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The "foo" argument does not exist.
- */
public function testGetInvalidArgument()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "foo" argument does not exist.');
$input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')]));
$input->getArgument('foo');
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Not enough arguments (missing: "name").
- */
public function testValidateWithMissingArguments()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Not enough arguments (missing: "name").');
$input = new ArrayInput([]);
$input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED)]));
$input->validate();
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Not enough arguments (missing: "name").
- */
public function testValidateWithMissingRequiredArguments()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Not enough arguments (missing: "name").');
$input = new ArrayInput(['bar' => 'baz']);
$input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL)]));
$input->validate();
diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
index c99eb839b7f31..591f58a62faac 100644
--- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
+++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
@@ -14,6 +14,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
@@ -27,6 +28,8 @@
*/
class ConsoleLoggerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var DummyOutput
*/
@@ -141,11 +144,9 @@ public function provideLevelsAndMessages()
];
}
- /**
- * @expectedException \Psr\Log\InvalidArgumentException
- */
public function testThrowsOnInvalidLevel()
{
+ $this->expectException('Psr\Log\InvalidArgumentException');
$logger = $this->getLogger();
$logger->log('invalid level', 'Foo');
}
diff --git a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
index 78a094ccdb5e1..b9c08db494a9f 100644
--- a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
+++ b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
@@ -39,12 +39,10 @@ public function testConstructor()
$this->assertTrue($output->isDecorated(), '__construct() takes the decorated flag as its second argument');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The StreamOutput class needs a stream as its first argument.
- */
public function testStreamIsRequired()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The StreamOutput class needs a stream as its first argument.');
new StreamOutput('foo');
}
diff --git a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
index cea8090adbedf..24a50c5a83aa0 100644
--- a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
+++ b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
@@ -141,12 +141,10 @@ public function testCommandWithDefaultInputs()
$this->assertEquals(implode('', $questions), $tester->getDisplay(true));
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Aborted.
- */
public function testCommandWithWrongInputsNumber()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Aborted.');
$questions = [
'What\'s your name?',
'How are you?',
@@ -168,12 +166,10 @@ public function testCommandWithWrongInputsNumber()
$tester->execute([]);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Aborted.
- */
public function testCommandWithQuestionsButNoInputs()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Aborted.');
$questions = [
'What\'s your name?',
'How are you?',
diff --git a/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php b/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php
index cd0fd785e53d8..8c96a80e59e5b 100644
--- a/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\CssSelector\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\CssSelectorConverter;
class CssSelectorConverterTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCssToXPath()
{
$converter = new CssSelectorConverter();
@@ -35,12 +38,10 @@ public function testCssToXPathXml()
$this->assertEquals('descendant-or-self::H1', $converter->toXPath('H1'));
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ParseException
- * @expectedExceptionMessage Expected identifier, but found.
- */
public function testParseExceptions()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ParseException');
+ $this->expectExceptionMessage('Expected identifier, but found.');
$converter = new CssSelectorConverter();
$converter->toXPath('h1:');
}
diff --git a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
index a9ab29e2ad622..cd821635ac571 100644
--- a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\CssSelector\Tests\XPath;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\Node\ElementNode;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\Parser\Parser;
@@ -21,6 +22,8 @@
class TranslatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/** @dataProvider getXpathLiteralTestData */
public function testXpathLiteral($value, $literal)
{
@@ -35,31 +38,25 @@ public function testCssToXPath($css, $xpath)
$this->assertEquals($xpath, $translator->cssToXPath($css, ''));
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
- */
public function testCssToXPathPseudoElement()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ExpressionErrorException');
$translator = new Translator();
$translator->registerExtension(new HtmlExtension($translator));
$translator->cssToXPath('e::first-line');
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
- */
public function testGetExtensionNotExistsExtension()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ExpressionErrorException');
$translator = new Translator();
$translator->registerExtension(new HtmlExtension($translator));
$translator->getExtension('fake');
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
- */
public function testAddCombinationNotExistsExtension()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ExpressionErrorException');
$translator = new Translator();
$translator->registerExtension(new HtmlExtension($translator));
$parser = new Parser();
@@ -68,11 +65,9 @@ public function testAddCombinationNotExistsExtension()
$translator->addCombination('fake', $xpath, $combinedXpath);
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
- */
public function testAddFunctionNotExistsFunction()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ExpressionErrorException');
$translator = new Translator();
$translator->registerExtension(new HtmlExtension($translator));
$xpath = new XPathExpr();
@@ -80,22 +75,18 @@ public function testAddFunctionNotExistsFunction()
$translator->addFunction($xpath, $function);
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
- */
public function testAddPseudoClassNotExistsClass()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ExpressionErrorException');
$translator = new Translator();
$translator->registerExtension(new HtmlExtension($translator));
$xpath = new XPathExpr();
$translator->addPseudoClass($xpath, 'fake');
}
- /**
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
- */
public function testAddAttributeMatchingClassNotExistsClass()
{
+ $this->expectException('Symfony\Component\CssSelector\Exception\ExpressionErrorException');
$translator = new Translator();
$translator->registerExtension(new HtmlExtension($translator));
$xpath = new XPathExpr();
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index b01020ec30fd9..215f1bd4fbc81 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -62,12 +62,10 @@ public function testIdempotence()
$this->fail('DebugClassLoader did not register');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage boo
- */
public function testThrowingClass()
{
+ $this->expectException('Exception');
+ $this->expectExceptionMessage('boo');
try {
class_exists(__NAMESPACE__.'\Fixtures\Throwing');
$this->fail('Exception expected');
@@ -142,21 +140,17 @@ class ChildTestingStacking extends TestingStacking { function foo($bar) {} }
}
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Case mismatch between loaded and declared class names
- */
public function testNameCaseMismatch()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Case mismatch between loaded and declared class names');
class_exists(__NAMESPACE__.'\TestingCaseMismatch', true);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Case mismatch between class and real file names
- */
public function testFileCaseMismatch()
{
+ $this->expectException('RuntimeException');
+ $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');
}
@@ -164,12 +158,10 @@ public function testFileCaseMismatch()
class_exists(__NAMESPACE__.'\Fixtures\CaseMismatch', true);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Case mismatch between loaded and declared class names
- */
public function testPsr4CaseMismatch()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Case mismatch between loaded and declared class names');
class_exists(__NAMESPACE__.'\Fixtures\Psr4CaseMismatch', true);
}
diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
index bb7fe413abe63..6e8435198e9dc 100644
--- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
@@ -14,6 +14,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LogLevel;
use Psr\Log\NullLogger;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\BufferingLogger;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\Exception\SilencedErrorContext;
@@ -28,6 +29,8 @@
*/
class ErrorHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testRegister()
{
$handler = ErrorHandler::register();
@@ -573,11 +576,11 @@ public function testHandleFatalErrorOnHHVM()
}
/**
- * @expectedException \Exception
* @group no-hhvm
*/
public function testCustomExceptionHandler()
{
+ $this->expectException('Exception');
$handler = new ErrorHandler();
$handler->setExceptionHandler(function ($e) use ($handler) {
$handler->handleException($e);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php
index cbae0eaaaa9ee..483bed80fe1d5 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
class ChildDefinitionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$def = new ChildDefinition('foo');
@@ -90,11 +93,9 @@ public function testSetArgument()
$this->assertSame(['index_0' => 'foo'], $def->getArguments());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testReplaceArgumentShouldRequireIntegerIndex()
{
+ $this->expectException('InvalidArgumentException');
$def = new ChildDefinition('foo');
$def->replaceArgument('0', 'foo');
@@ -119,11 +120,9 @@ public function testReplaceArgument()
$this->assertSame([0 => 'foo', 1 => 'bar', 'index_1' => 'baz', '$bar' => 'val'], $def->getArguments());
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetArgumentShouldCheckBounds()
{
+ $this->expectException('OutOfBoundsException');
$def = new ChildDefinition('foo');
$def->setArguments([0 => 'foo']);
@@ -137,20 +136,16 @@ public function testDefinitionDecoratorAliasExistsForBackwardsCompatibility()
$this->assertInstanceOf(ChildDefinition::class, new DefinitionDecorator('foo'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\BadMethodCallException
- */
public function testCannotCallSetAutoconfigured()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\BadMethodCallException');
$def = new ChildDefinition('foo');
$def->setAutoconfigured(true);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\BadMethodCallException
- */
public function testCannotCallSetInstanceofConditionals()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\BadMethodCallException');
$def = new ChildDefinition('foo');
$def->setInstanceofConditionals(['Foo' => new ChildDefinition('')]);
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php
index d029636a7cc5d..159342f6fd082 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php
@@ -12,16 +12,17 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class AutoAliasServicePassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
- */
+ use ForwardCompatTestTrait;
+
public function testProcessWithMissingParameter()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException');
$container = new ContainerBuilder();
$container->register('example')
@@ -31,11 +32,9 @@ public function testProcessWithMissingParameter()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- */
public function testProcessWithMissingFormat()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$container = new ContainerBuilder();
$container->register('example')
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
index ce834f5c49c88..2cd26a950ea2a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
@@ -186,12 +186,10 @@ public function testExceptionsAreStored()
$this->assertCount(1, $pass->getAutowiringExceptions());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Invalid service "private_service": constructor of class "Symfony\Component\DependencyInjection\Tests\Compiler\PrivateConstructor" must be public.
- */
public function testPrivateConstructorThrowsAutowireException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Invalid service "private_service": constructor of class "Symfony\Component\DependencyInjection\Tests\Compiler\PrivateConstructor" must be public.');
$container = new ContainerBuilder();
$container->autowire('private_service', __NAMESPACE__.'\PrivateConstructor');
@@ -200,12 +198,10 @@ public function testPrivateConstructorThrowsAutowireException()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "a": argument "$collision" of method "Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "c1", "c2", "c3".
- */
public function testTypeCollision()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "a": argument "$collision" of method "Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "c1", "c2", "c3".');
$container = new ContainerBuilder();
$container->register('c1', __NAMESPACE__.'\CollisionA');
@@ -218,12 +214,10 @@ public function testTypeCollision()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "a": argument "$k" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgument::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\Foo" but no such service exists. You should maybe alias this class to one of these existing services: "a1", "a2".
- */
public function testTypeNotGuessable()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "a": argument "$k" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgument::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\Foo" but no such service exists. You should maybe alias this class to one of these existing services: "a1", "a2".');
$container = new ContainerBuilder();
$container->register('a1', __NAMESPACE__.'\Foo');
@@ -235,12 +229,10 @@ public function testTypeNotGuessable()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "a": argument "$k" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgumentForSubclass::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\A" but no such service exists. You should maybe alias this class to one of these existing services: "a1", "a2".
- */
public function testTypeNotGuessableWithSubclass()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "a": argument "$k" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgumentForSubclass::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\A" but no such service exists. You should maybe alias this class to one of these existing services: "a1", "a2".');
$container = new ContainerBuilder();
$container->register('a1', __NAMESPACE__.'\B');
@@ -252,12 +244,10 @@ public function testTypeNotGuessableWithSubclass()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "a": argument "$collision" of method "Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" but no such service exists.
- */
public function testTypeNotGuessableNoServicesFound()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "a": argument "$collision" of method "Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" but no such service exists.');
$container = new ContainerBuilder();
$aDefinition = $container->register('a', __NAMESPACE__.'\CannotBeAutowired');
@@ -376,12 +366,10 @@ public function testDontTriggerAutowiring()
$this->assertCount(0, $container->getDefinition('bar')->getArguments());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.
- */
public function testClassNotFoundThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.');
$container = new ContainerBuilder();
$aDefinition = $container->register('a', __NAMESPACE__.'\BadTypeHintedArgument');
@@ -393,12 +381,10 @@ public function testClassNotFoundThrowsException()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found).
- */
public function testParentClassNotFoundThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found).');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
@@ -463,12 +449,10 @@ public function testSomeSpecificArgumentsAreSet()
);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "arg_no_type_hint": argument "$bar" of method "Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::__construct()" is type-hinted "array", you should configure its value explicitly.
- */
public function testScalarArgsCannotBeAutowired()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "arg_no_type_hint": argument "$bar" of method "Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::__construct()" is type-hinted "array", you should configure its value explicitly.');
$container = new ContainerBuilder();
$container->register(A::class);
@@ -481,12 +465,10 @@ public function testScalarArgsCannotBeAutowired()
(new AutowirePass())->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "arg_no_type_hint": argument "$foo" of method "Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::__construct()" has no type-hint, you should configure its value explicitly.
- */
public function testNoTypeArgsCannotBeAutowired()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "arg_no_type_hint": argument "$foo" of method "Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::__construct()" has no type-hint, you should configure its value explicitly.');
$container = new ContainerBuilder();
$container->register(A::class);
@@ -615,11 +597,11 @@ public function testSetterInjection()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @exceptedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "setLogger()" does not exist.
*/
public function testWithNonExistingSetterAndAutowiring()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$definition = $container->register(CaseSensitiveClass::class, CaseSensitiveClass::class)->setAutowired(true);
@@ -756,12 +738,10 @@ public function testSetterInjectionCollisionThrowsException()
$this->assertSame('Cannot autowire service "setter_injection_collision": argument "$collision" of method "Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjectionCollision::setMultipleInstancesForOneArg()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "c1", "c2".', $e->getMessage());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "my_service": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\K::__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\IInterface" but no such service exists. Did you create a class that implements this interface?
- */
public function testInterfaceWithNoImplementationSuggestToWriteOne()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "my_service": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\K::__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\IInterface" but no such service exists. Did you create a class that implements this interface?');
$container = new ContainerBuilder();
$aDefinition = $container->register('my_service', K::class);
@@ -827,10 +807,10 @@ public function testWithFactory()
/**
* @dataProvider provideNotWireableCalls
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
*/
public function testNotWireableCalls($method, $expectedMsg)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
$container = new ContainerBuilder();
$foo = $container->register('foo', NotWireable::class)->setAutowired(true)
@@ -899,12 +879,10 @@ public function testTypedReferenceDeprecationNotice()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. Try changing the type-hint to "Symfony\Component\DependencyInjection\Tests\Compiler\IInterface" instead.
- */
public function testExceptionWhenAliasExists()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. Try changing the type-hint to "Symfony\Component\DependencyInjection\Tests\Compiler\IInterface" instead.');
$container = new ContainerBuilder();
// multiple I services... but there *is* IInterface available
@@ -919,12 +897,10 @@ public function testExceptionWhenAliasExists()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
- * @expectedExceptionMessage Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. You should maybe alias this class to one of these existing services: "i", "i2".
- */
public function testExceptionWhenAliasDoesNotExist()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
+ $this->expectExceptionMessage('Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. You should maybe alias this class to one of these existing services: "i", "i2".');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php
index c1e47b308e760..a1a700337cb45 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -20,6 +21,8 @@
*/
class CheckArgumentsValidityPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -41,11 +44,11 @@ public function testProcess()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @dataProvider definitionProvider
*/
public function testException(array $arguments, array $methodCalls)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$definition = $container->register('foo');
$definition->setArguments($arguments);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php
index 8423c5616b3b9..86adf3d42933e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass;
@@ -21,11 +22,11 @@
class CheckCircularReferencesPassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container->register('a')->addArgument(new Reference('b'));
$container->register('b')->addArgument(new Reference('a'));
@@ -33,11 +34,9 @@ public function testProcess()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testProcessWithAliases()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container->register('a')->addArgument(new Reference('b'));
$container->setAlias('b', 'c');
@@ -46,11 +45,9 @@ public function testProcessWithAliases()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testProcessWithFactory()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container
@@ -64,11 +61,9 @@ public function testProcessWithFactory()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testProcessDetectsIndirectCircularReference()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container->register('a')->addArgument(new Reference('b'));
$container->register('b')->addArgument(new Reference('c'));
@@ -77,11 +72,9 @@ public function testProcessDetectsIndirectCircularReference()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testProcessDetectsIndirectCircularReferenceWithFactory()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container->register('a')->addArgument(new Reference('b'));
@@ -95,11 +88,9 @@ public function testProcessDetectsIndirectCircularReferenceWithFactory()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testDeepCircularReference()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container->register('a')->addArgument(new Reference('b'));
$container->register('b')->addArgument(new Reference('c'));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
index e1dd60b662be9..26bb1851d4567 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
@@ -12,27 +12,26 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CheckDefinitionValidityPassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- */
+ use ForwardCompatTestTrait;
+
public function testProcessDetectsSyntheticNonPublicDefinitions()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$container->register('a')->setSynthetic(true)->setPublic(false);
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- */
public function testProcessDetectsNonSyntheticNonAbstractDefinitionWithoutClass()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$container->register('a')->setSynthetic(false)->setAbstract(false);
@@ -65,22 +64,18 @@ public function testValidTags()
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- */
public function testInvalidTags()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$container->register('a', 'class')->addTag('foo', ['bar' => ['baz' => 'baz']]);
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
- */
public function testDynamicPublicServiceName()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\EnvParameterException');
$container = new ContainerBuilder();
$env = $container->getParameterBag()->get('env(BAR)');
$container->register("foo.$env", 'class')->setPublic(true);
@@ -88,11 +83,9 @@ public function testDynamicPublicServiceName()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
- */
public function testDynamicPublicAliasName()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\EnvParameterException');
$container = new ContainerBuilder();
$env = $container->getParameterBag()->get('env(BAR)');
$container->setAlias("foo.$env", 'class')->setPublic(true);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php
index 38717eaf1fd5d..faecec987f0bb 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -20,6 +21,8 @@
class CheckExceptionOnInvalidReferenceBehaviorPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -35,11 +38,9 @@ public function testProcess()
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- */
public function testProcessThrowsExceptionOnInvalidReference()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
$container = new ContainerBuilder();
$container
@@ -50,11 +51,9 @@ public function testProcessThrowsExceptionOnInvalidReference()
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- */
public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinition()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
$container = new ContainerBuilder();
$def = new Definition();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
index 22b6fd1542e73..6ac8630b2a95c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
@@ -12,17 +12,18 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class CheckReferenceValidityPassTest extends TestCase
{
- /**
- * @expectedException \RuntimeException
- */
+ use ForwardCompatTestTrait;
+
public function testProcessDetectsReferenceToAbstractDefinition()
{
+ $this->expectException('RuntimeException');
$container = new ContainerBuilder();
$container->register('a')->setAbstract(true);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php
index ce6f0496e0527..528e883dc5148 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php
@@ -12,18 +12,19 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class DefinitionErrorExceptionPassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Things went wrong!
- */
+ use ForwardCompatTestTrait;
+
public function testThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Things went wrong!');
$container = new ContainerBuilder();
$def = new Definition();
$def->addError('Things went wrong!');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
index 6e5c80a7d5cd0..b0aa67cf93ae8 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
@@ -23,6 +24,8 @@
class InlineServiceDefinitionsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -111,12 +114,10 @@ public function testProcessDoesNotInlineMixedServicesLoop()
$this->assertEquals(new Reference('bar'), $container->getDefinition('foo')->getArgument(0));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- * @expectedExceptionMessage Circular reference detected for service "bar", path: "bar -> foo -> bar".
- */
public function testProcessThrowsOnNonSharedLoops()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
+ $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> foo -> bar".');
$container = new ContainerBuilder();
$container
->register('foo')
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
index 1bef795f2b523..b4119253da53e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Resource\FileResource;
@@ -23,6 +24,8 @@
class MergeExtensionConfigurationPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testExpressionLanguageProviderForwarding()
{
$tmpProviders = [];
@@ -102,12 +105,10 @@ public function testOverriddenEnvsAreMerged()
$this->assertSame(['BAZ' => 1, 'FOO' => 0], $container->getEnvCounters());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Using a cast in "env(int:FOO)" is incompatible with resolution at compile time in "Symfony\Component\DependencyInjection\Tests\Compiler\BarExtension". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.
- */
public function testProcessedEnvsAreIncompatibleWithResolve()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Using a cast in "env(int:FOO)" is incompatible with resolution at compile time in "Symfony\Component\DependencyInjection\Tests\Compiler\BarExtension". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.');
$container = new ContainerBuilder();
$container->registerExtension(new BarExtension());
$container->prependExtensionConfig('bar', []);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php
index 3d3fdf7694702..df72aa11369fb 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
class RegisterEnvVarProcessorsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSimpleProcessor()
{
$container = new ContainerBuilder();
@@ -53,12 +56,10 @@ public function testNoProcessor()
$this->assertFalse($container->has('container.env_var_processors_locator'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid type "foo" returned by "Symfony\Component\DependencyInjection\Tests\Compiler\BadProcessor::getProvidedTypes()", expected one of "array", "bool", "float", "int", "string".
- */
public function testBadProcessor()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid type "foo" returned by "Symfony\Component\DependencyInjection\Tests\Compiler\BadProcessor::getProvidedTypes()", expected one of "array", "bool", "float", "int", "string".');
$container = new ContainerBuilder();
$container->register('foo', BadProcessor::class)->addTag('container.env_var_processor');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php
index 0356c97133184..1dfcfad714631 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface as PsrContainerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass;
@@ -28,12 +29,12 @@
class RegisterServiceSubscribersPassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Service "foo" must implement interface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface".
- */
+ use ForwardCompatTestTrait;
+
public function testInvalidClass()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Service "foo" must implement interface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface".');
$container = new ContainerBuilder();
$container->register('foo', CustomDefinition::class)
@@ -44,12 +45,10 @@ public function testInvalidClass()
(new ResolveServiceSubscribersPass())->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "bar" given for service "foo".
- */
public function testInvalidAttributes()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "bar" given for service "foo".');
$container = new ContainerBuilder();
$container->register('foo', TestServiceSubscriber::class)
@@ -118,12 +117,10 @@ public function testWithAttributes()
$this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Service key "test" does not exist in the map returned by "Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::getSubscribedServices()" for service "foo_service".
- */
public function testExtraServiceSubscriber()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Service key "test" does not exist in the map returned by "Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::getSubscribedServices()" for service "foo_service".');
$container = new ContainerBuilder();
$container->register('foo_service', TestServiceSubscriber::class)
->setAutowired(true)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
index f9c755c35e184..a924d2629f2c0 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -21,6 +22,8 @@
class ReplaceAliasByActualDefinitionPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -53,11 +56,9 @@ public function testProcess()
$this->assertSame('b_alias', (string) $resolvedFactory[0]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testProcessWithInvalidAlias()
{
+ $this->expectException('InvalidArgumentException');
$container = new ContainerBuilder();
$container->setAlias('a_alias', 'a');
$this->process($container);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
index 303e3abd49354..e17db39219174 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
@@ -28,6 +29,8 @@
class ResolveBindingsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -49,12 +52,10 @@ public function testProcess()
$this->assertEquals([['setSensitiveClass', [new Reference('foo')]]], $definition->getMethodCalls());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Unused binding "$quz" in service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy".
- */
public function testUnusedBinding()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Unused binding "$quz" in service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy".');
$container = new ContainerBuilder();
$definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class);
@@ -64,12 +65,10 @@ public function testUnusedBinding()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegexp Unused binding "$quz" in service [\s\S]+ Invalid service ".*\\ParentNotExists": class NotExists not found\.
- */
public function testMissingParent()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('Unused binding "$quz" in service [\s\S]+ Invalid service ".*\\ParentNotExists": class NotExists not found\.');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
@@ -119,11 +118,11 @@ public function testScalarSetter()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @exceptedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "setLogger()" does not exist.
*/
public function testWithNonExistingSetterAndBinding()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$bindings = [
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
index 4eca8f7073884..1cb1139c7f419 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
@@ -19,6 +20,8 @@
class ResolveChildDefinitionsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -432,12 +435,10 @@ protected function process(ContainerBuilder $container)
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- * @expectedExceptionMessageRegExp /^Circular reference detected for service "c", path: "c -> b -> a -> c"./
- */
public function testProcessDetectsChildDefinitionIndirectCircularReference()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
+ $this->expectExceptionMessageRegExp('/^Circular reference detected for service "c", path: "c -> b -> a -> c"./');
$container = new ContainerBuilder();
$container->register('a');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php
index 48df3843dc5b1..e791ceae08cb0 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -19,6 +20,8 @@
class ResolveClassPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideValidClassId
*/
@@ -82,12 +85,10 @@ public function testClassFoundChildDefinition()
$this->assertSame(self::class, $child->getClass());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.
- */
public function testAmbiguousChildDefinition()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.');
$container = new ContainerBuilder();
$parent = $container->register('App\Foo', null);
$child = $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo'));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php
index 3438fad0689f3..8511172fb00ef 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -19,6 +20,8 @@
class ResolveFactoryClassPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -71,12 +74,10 @@ public function testIgnoresFulfilledFactories($factory)
$this->assertSame($factory, $container->getDefinition('factory')->getFactory());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The "factory" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?
- */
public function testNotAnyClassThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The "factory" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?');
$container = new ContainerBuilder();
$factory = $container->register('factory');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
index 26560b4ca3249..c019683322c41 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
@@ -20,6 +21,8 @@
class ResolveInstanceofConditionalsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -172,12 +175,10 @@ public function testProcessDoesNotUseAutoconfiguredInstanceofIfNotEnabled()
$this->assertFalse($def->isAutowired());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage "App\FakeInterface" is set as an "instanceof" conditional, but it does not exist.
- */
public function testBadInterfaceThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('"App\FakeInterface" is set as an "instanceof" conditional, but it does not exist.');
$container = new ContainerBuilder();
$def = $container->register('normal_service', self::class);
$def->setInstanceofConditionals([
@@ -200,12 +201,10 @@ public function testBadInterfaceForAutomaticInstanceofIsOk()
$this->assertTrue($container->hasDefinition('normal_service'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines method calls but these are not supported and should be removed.
- */
public function testProcessThrowsExceptionForAutoconfiguredCalls()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines method calls but these are not supported and should be removed.');
$container = new ContainerBuilder();
$container->registerForAutoconfiguration(parent::class)
->addMethodCall('setFoo');
@@ -213,12 +212,10 @@ public function testProcessThrowsExceptionForAutoconfiguredCalls()
(new ResolveInstanceofConditionalsPass())->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines arguments but these are not supported and should be removed.
- */
public function testProcessThrowsExceptionForArguments()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines arguments but these are not supported and should be removed.');
$container = new ContainerBuilder();
$container->registerForAutoconfiguration(parent::class)
->addArgument('bar');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php
index e25d96f5396c2..55fa2ab06de6d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -26,6 +27,8 @@
*/
class ResolveNamedArgumentsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -60,11 +63,9 @@ public function testWithFactory()
$this->assertSame([0 => '123'], $definition->getArguments());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- */
public function testClassNull()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$definition = $container->register(NamedArgumentsDummy::class);
@@ -74,11 +75,9 @@ public function testClassNull()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- */
public function testClassNotExist()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$definition = $container->register(NotExist::class, NotExist::class);
@@ -88,11 +87,9 @@ public function testClassNotExist()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- */
public function testClassNoConstructor()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$container = new ContainerBuilder();
$definition = $container->register(NoConstructor::class, NoConstructor::class);
@@ -102,12 +99,10 @@ public function testClassNoConstructor()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "__construct()" has no argument named "$notFound". Check your service definition.
- */
public function testArgumentNotFound()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "__construct()" has no argument named "$notFound". Check your service definition.');
$container = new ContainerBuilder();
$definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class);
@@ -117,12 +112,10 @@ public function testArgumentNotFound()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1": method "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::createTestDefinition1()" has no argument named "$notFound". Check your service definition.
- */
public function testCorrectMethodReportedInException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1": method "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::createTestDefinition1()" has no argument named "$notFound". Check your service definition.');
$container = new ContainerBuilder();
$container->register(FactoryDummyWithoutReturnTypes::class, FactoryDummyWithoutReturnTypes::class);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php
index 55b47057b1fd5..6c320ae821c05 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -20,6 +21,8 @@
class ResolveReferencesToAliasesPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -51,11 +54,9 @@ public function testProcessRecursively()
$this->assertEquals('foo', (string) $arguments[0]);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testAliasCircularReference()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$container = new ContainerBuilder();
$container->setAlias('bar', 'foo');
$container->setAlias('foo', 'bar');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php
index 27ee7db533f6d..f30c96357910b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -25,12 +26,12 @@
class ServiceLocatorTagPassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid definition for service "foo": an array of references is expected as first argument when the "container.service_locator" tag is set.
- */
+ use ForwardCompatTestTrait;
+
public function testNoServices()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid definition for service "foo": an array of references is expected as first argument when the "container.service_locator" tag is set.');
$container = new ContainerBuilder();
$container->register('foo', ServiceLocator::class)
@@ -40,12 +41,10 @@ public function testNoServices()
(new ServiceLocatorTagPass())->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid definition for service "foo": an array of references is expected as first argument when the "container.service_locator" tag is set, "string" found for key "0".
- */
public function testInvalidServices()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid definition for service "foo": an array of references is expected as first argument when the "container.service_locator" tag is set, "string" found for key "0".');
$container = new ContainerBuilder();
$container->register('foo', ServiceLocator::class)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index a811ac8c36df3..b42d60001df24 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -131,12 +131,10 @@ public function testHas()
$this->assertTrue($builder->has('bar'), '->has() returns true if a service exists');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- * @expectedExceptionMessage You have requested a non-existent service "foo".
- */
public function testGetThrowsExceptionIfServiceDoesNotExist()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
+ $this->expectExceptionMessage('You have requested a non-existent service "foo".');
$builder = new ContainerBuilder();
$builder->get('foo');
}
@@ -148,11 +146,9 @@ public function testGetReturnsNullIfServiceDoesNotExistAndInvalidReferenceIsUsed
$this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service does not exist and NULL_ON_INVALID_REFERENCE is passed as a second argument');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- */
public function testGetThrowsCircularReferenceExceptionIfServiceHasReferenceToItself()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
$builder = new ContainerBuilder();
$builder->register('baz', 'stdClass')->setArguments([new Reference('baz')]);
$builder->get('baz');
@@ -200,21 +196,21 @@ public function testNonSharedServicesReturnsDifferentInstances()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
* @dataProvider provideBadId
*/
public function testBadAliasId($id)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$builder = new ContainerBuilder();
$builder->setAlias($id, 'foo');
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
* @dataProvider provideBadId
*/
public function testBadDefinitionId($id)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$builder = new ContainerBuilder();
$builder->setDefinition($id, new Definition('Foo'));
}
@@ -231,12 +227,10 @@ public function provideBadId()
];
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage You have requested a synthetic service ("foo"). The DIC does not know how to construct this service.
- */
public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('You have requested a synthetic service ("foo"). The DIC does not know how to construct this service.');
$builder = new ContainerBuilder();
$builder->register('foo', 'stdClass')->setSynthetic(true);
@@ -515,11 +509,9 @@ public function testCreateServiceWithIteratorArgument()
$this->assertEquals(0, $i);
}
- /**
- * @expectedException \RuntimeException
- */
public function testCreateSyntheticService()
{
+ $this->expectException('RuntimeException');
$builder = new ContainerBuilder();
$builder->register('foo', 'Bar\FooClass')->setSynthetic(true);
$builder->get('foo');
@@ -543,12 +535,10 @@ public function testResolveServices()
$this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Constructing service "foo" from a parent definition is not supported at build time.
- */
public function testResolveServicesWithDecoratedDefinition()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Constructing service "foo" from a parent definition is not supported at build time.');
$builder = new ContainerBuilder();
$builder->setDefinition('grandpa', new Definition('stdClass'));
$builder->setDefinition('parent', new ChildDefinition('grandpa'));
@@ -624,12 +614,10 @@ public function testMerge()
$this->assertSame(['AInterface' => $childDefA, 'BInterface' => $childDefB], $container->getAutoconfiguredInstanceof());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage "AInterface" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.
- */
public function testMergeThrowsExceptionForDuplicateAutomaticInstanceofDefinitions()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('"AInterface" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.');
$container = new ContainerBuilder();
$config = new ContainerBuilder();
$container->registerForAutoconfiguration('AInterface');
@@ -731,12 +719,10 @@ public function testCompileWithArrayAndAnotherResolveEnv()
putenv('ARRAY');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage A string value must be composed of strings and/or numbers, but found parameter "env(json:ARRAY)" of type array inside string value "ABC %env(json:ARRAY)%".
- */
public function testCompileWithArrayInStringResolveEnv()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('A string value must be composed of strings and/or numbers, but found parameter "env(json:ARRAY)" of type array inside string value "ABC %env(json:ARRAY)%".');
putenv('ARRAY={"foo":"bar"}');
$container = new ContainerBuilder();
@@ -746,12 +732,10 @@ public function testCompileWithArrayInStringResolveEnv()
putenv('ARRAY');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvNotFoundException
- * @expectedExceptionMessage Environment variable not found: "FOO".
- */
public function testCompileWithResolveMissingEnv()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\EnvNotFoundException');
+ $this->expectExceptionMessage('Environment variable not found: "FOO".');
$container = new ContainerBuilder();
$container->setParameter('foo', '%env(FOO)%');
$container->compile(true);
@@ -830,12 +814,10 @@ public function testEnvInId()
$this->assertSame(['baz_bar'], array_keys($container->getDefinition('foo')->getArgument(1)));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException
- * @expectedExceptionMessage Circular reference detected for parameter "env(resolve:DUMMY_ENV_VAR)" ("env(resolve:DUMMY_ENV_VAR)" > "env(resolve:DUMMY_ENV_VAR)").
- */
public function testCircularDynamicEnv()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException');
+ $this->expectExceptionMessage('Circular reference detected for parameter "env(resolve:DUMMY_ENV_VAR)" ("env(resolve:DUMMY_ENV_VAR)" > "env(resolve:DUMMY_ENV_VAR)").');
putenv('DUMMY_ENV_VAR=some%foo%');
$container = new ContainerBuilder();
@@ -849,11 +831,9 @@ public function testCircularDynamicEnv()
}
}
- /**
- * @expectedException \LogicException
- */
public function testMergeLogicException()
{
+ $this->expectException('LogicException');
$container = new ContainerBuilder();
$container->setResourceTracking(false);
$container->compile();
@@ -1103,11 +1083,9 @@ public function testPrivateServiceUser()
$this->assertInstanceOf('BarClass', $container->get('bar_user')->bar);
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testThrowsExceptionWhenSetServiceOnACompiledContainer()
{
+ $this->expectException('BadMethodCallException');
$container = new ContainerBuilder();
$container->setResourceTracking(false);
$container->register('a', 'stdClass')->setPublic(true);
@@ -1134,11 +1112,9 @@ public function testNoExceptionWhenSetSyntheticServiceOnACompiledContainer()
$this->assertEquals($a, $container->get('a'));
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testThrowsExceptionWhenSetDefinitionOnACompiledContainer()
{
+ $this->expectException('BadMethodCallException');
$container = new ContainerBuilder();
$container->setResourceTracking(false);
$container->compile();
@@ -1230,12 +1206,10 @@ public function testInlinedDefinitions()
$this->assertNotSame($bar->foo, $barUser->foo);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- * @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass -> app.test_class".
- */
public function testThrowsCircularExceptionForCircularAliases()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
+ $this->expectExceptionMessage('Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass -> app.test_class".');
$builder = new ContainerBuilder();
$builder->setAliases([
@@ -1288,60 +1262,50 @@ public function testClassFromId()
$this->assertEquals(CaseSensitiveClass::class, $autoloadClass->getClass());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.
- */
public function testNoClassFromGlobalNamespaceClassId()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.');
$container = new ContainerBuilder();
$definition = $container->register(\DateTime::class);
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The definition for "\DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.
- */
public function testNoClassFromGlobalNamespaceClassIdWithLeadingSlash()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The definition for "\DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.');
$container = new ContainerBuilder();
$container->register('\\'.\DateTime::class);
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The definition for "\Symfony\Component\DependencyInjection\Tests\FooClass" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "Symfony\Component\DependencyInjection\Tests\FooClass" to get rid of this error.
- */
public function testNoClassFromNamespaceClassIdWithLeadingSlash()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The definition for "\Symfony\Component\DependencyInjection\Tests\FooClass" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "Symfony\Component\DependencyInjection\Tests\FooClass" to get rid of this error.');
$container = new ContainerBuilder();
$container->register('\\'.FooClass::class);
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The definition for "123_abc" has no class.
- */
public function testNoClassFromNonClassId()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The definition for "123_abc" has no class.');
$container = new ContainerBuilder();
$definition = $container->register('123_abc');
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The definition for "\foo" has no class.
- */
public function testNoClassFromNsSeparatorId()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The definition for "\foo" has no class.');
$container = new ContainerBuilder();
$definition = $container->register('\\foo');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
index 5dbec886e6fb3..57e3e382f4372 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -20,6 +21,8 @@
class ContainerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$sc = new Container();
@@ -331,24 +334,20 @@ public function testGetCircularReference()
}
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- * @expectedExceptionMessage The "request" service is synthetic, it needs to be set at boot time before it can be used.
- */
public function testGetSyntheticServiceThrows()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
+ $this->expectExceptionMessage('The "request" service is synthetic, it needs to be set at boot time before it can be used.');
require_once __DIR__.'/Fixtures/php/services9_compiled.php';
$container = new \ProjectServiceContainer();
$container->get('request');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- * @expectedExceptionMessage The "inlined" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
- */
public function testGetRemovedServiceThrows()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
+ $this->expectExceptionMessage('The "inlined" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.');
require_once __DIR__.'/Fixtures/php/services9_compiled.php';
$container = new \ProjectServiceContainer();
@@ -430,12 +429,10 @@ public function testReset()
$this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Something went terribly wrong!
- */
public function testGetThrowsException()
{
+ $this->expectException('Exception');
+ $this->expectExceptionMessage('Something went terribly wrong!');
$c = new ProjectServiceContainer();
try {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php
index ac58d3455183b..093c5d0608d43 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
/**
@@ -19,6 +20,8 @@
*/
class DefinitionDecoratorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$def = new DefinitionDecorator('foo');
@@ -92,11 +95,9 @@ public function testSetArgument()
$this->assertEquals(['index_0' => 'foo'], $def->getArguments());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testReplaceArgumentShouldRequireIntegerIndex()
{
+ $this->expectException('InvalidArgumentException');
$def = new DefinitionDecorator('foo');
$def->replaceArgument('0', 'foo');
@@ -117,11 +118,9 @@ public function testReplaceArgument()
$this->assertEquals([0 => 'foo', 1 => 'bar', 'index_1' => 'baz'], $def->getArguments());
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetArgumentShouldCheckBounds()
{
+ $this->expectException('OutOfBoundsException');
$def = new DefinitionDecorator('foo');
$def->setArguments([0 => 'foo']);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
index d1f13dc7b8d82..6657761e000a7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
@@ -100,12 +100,10 @@ public function testMethodCalls()
$this->assertEquals([['foo', ['foo']]], $def->getMethodCalls(), '->removeMethodCall() removes a method to call');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Method name cannot be empty.
- */
public function testExceptionOnEmptyMethodCall()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Method name cannot be empty.');
$def = new Definition('stdClass');
$def->addMethodCall('');
}
@@ -168,10 +166,10 @@ public function testSetIsDeprecated()
/**
* @dataProvider invalidDeprecationMessageProvider
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
*/
public function testSetDeprecatedWithInvalidDeprecationTemplate($message)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$def = new Definition('stdClass');
$def->setDeprecated(false, $message);
}
@@ -253,35 +251,29 @@ public function testSetArgument()
$this->assertSame(['foo', 'bar'], $def->getArguments());
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetArgumentShouldCheckBounds()
{
+ $this->expectException('OutOfBoundsException');
$def = new Definition('stdClass');
$def->addArgument('foo');
$def->getArgument(1);
}
- /**
- * @expectedException \OutOfBoundsException
- * @expectedExceptionMessage The index "1" is not in the range [0, 0].
- */
public function testReplaceArgumentShouldCheckBounds()
{
+ $this->expectException('OutOfBoundsException');
+ $this->expectExceptionMessage('The index "1" is not in the range [0, 0].');
$def = new Definition('stdClass');
$def->addArgument('foo');
$def->replaceArgument(1, 'bar');
}
- /**
- * @expectedException \OutOfBoundsException
- * @expectedExceptionMessage Cannot replace arguments if none have been configured yet.
- */
public function testReplaceArgumentWithoutExistingArgumentsShouldCheckBounds()
{
+ $this->expectException('OutOfBoundsException');
+ $this->expectExceptionMessage('Cannot replace arguments if none have been configured yet.');
$def = new Definition('stdClass');
$def->replaceArgument(0, 'bar');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index 4140894fce021..118758ee0cbe5 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -154,10 +154,10 @@ public function testDumpCustomContainerClassWithMandatoryArgumentLessConstructor
/**
* @dataProvider provideInvalidParameters
- * @expectedException \InvalidArgumentException
*/
public function testExportParameters($parameters)
{
+ $this->expectException('InvalidArgumentException');
$container = new ContainerBuilder(new ParameterBag($parameters));
$container->compile();
$dumper = new PhpDumper($container);
@@ -288,11 +288,11 @@ public function testConflictingMethodsWithParent()
/**
* @dataProvider provideInvalidFactories
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Cannot dump definition
*/
public function testInvalidFactories($factory)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Cannot dump definition');
$container = new ContainerBuilder();
$def = new Definition('stdClass');
$def->setPublic(true);
@@ -452,12 +452,10 @@ public function testFileEnvProcessor()
$this->assertStringEqualsFile(__FILE__, $container->getParameter('random'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
- * @expectedExceptionMessage Environment variables "FOO" are never used. Please, check your container's configuration.
- */
public function testUnusedEnvParameter()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\EnvParameterException');
+ $this->expectExceptionMessage('Environment variables "FOO" are never used. Please, check your container\'s configuration.');
$container = new ContainerBuilder();
$container->getParameter('env(FOO)');
$container->compile();
@@ -465,12 +463,10 @@ public function testUnusedEnvParameter()
$dumper->dump();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException
- * @expectedExceptionMessage Circular reference detected for parameter "env(resolve:DUMMY_ENV_VAR)" ("env(resolve:DUMMY_ENV_VAR)" > "env(resolve:DUMMY_ENV_VAR)").
- */
public function testCircularDynamicEnv()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException');
+ $this->expectExceptionMessage('Circular reference detected for parameter "env(resolve:DUMMY_ENV_VAR)" ("env(resolve:DUMMY_ENV_VAR)" > "env(resolve:DUMMY_ENV_VAR)").');
$container = new ContainerBuilder();
$container->setParameter('foo', '%bar%');
$container->setParameter('bar', '%env(resolve:DUMMY_ENV_VAR)%');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
index 972350467a021..a0190af93d72b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
@@ -3,12 +3,15 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\EnvVarProcessor;
class EnvVarProcessorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const TEST_CONST = 'test';
/**
@@ -98,12 +101,12 @@ public function validInts()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Non-numeric env var
* @dataProvider invalidInts
*/
public function testGetEnvIntInvalid($value)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Non-numeric env var');
$processor = new EnvVarProcessor(new Container());
$processor->getEnv('int', 'foo', function ($name) use ($value) {
@@ -148,12 +151,12 @@ public function validFloats()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Non-numeric env var
* @dataProvider invalidFloats
*/
public function testGetEnvFloatInvalid($value)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Non-numeric env var');
$processor = new EnvVarProcessor(new Container());
$processor->getEnv('float', 'foo', function ($name) use ($value) {
@@ -197,12 +200,12 @@ public function validConsts()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage undefined constant
* @dataProvider invalidConsts
*/
public function testGetEnvConstInvalid($value)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('undefined constant');
$processor = new EnvVarProcessor(new Container());
$processor->getEnv('const', 'foo', function ($name) use ($value) {
@@ -246,12 +249,10 @@ public function testGetEnvJson()
$this->assertSame([1], $result);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Syntax error
- */
public function testGetEnvInvalidJson()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Syntax error');
$processor = new EnvVarProcessor(new Container());
$processor->getEnv('json', 'foo', function ($name) {
@@ -262,12 +263,12 @@ public function testGetEnvInvalidJson()
}
/**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Invalid JSON env var
* @dataProvider otherJsonValues
*/
public function testGetEnvJsonOther($value)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Invalid JSON env var');
$processor = new EnvVarProcessor(new Container());
$processor->getEnv('json', 'foo', function ($name) use ($value) {
@@ -287,12 +288,10 @@ public function otherJsonValues()
];
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Unsupported env var prefix
- */
public function testGetEnvUnknown()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Unsupported env var prefix');
$processor = new EnvVarProcessor(new Container());
$processor->getEnv('unknown', 'foo', function ($name) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
index 3c912f2a13678..cd01a897f3f9e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\DependencyInjection\Tests\Extension;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
class ExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getResolvedEnabledFixtures
*/
@@ -34,12 +37,10 @@ public function getResolvedEnabledFixtures()
];
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The config array has no 'enabled' key.
- */
public function testIsConfigEnabledOnNonEnableableConfig()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The config array has no \'enabled\' key.');
$extension = new EnableableExtension();
$extension->isConfigEnabled(new ContainerBuilder(), []);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
index 8de0b7d0de82e..59f7e9ad399a9 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
@@ -61,12 +61,10 @@ public function testImports()
$this->assertEquals(['ini' => 'ini', 'yaml' => 'yaml'], $this->container->getParameterBag()->all(), '->load() takes a single file that imports a directory');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The file "foo" does not exist (in:
- */
public function testExceptionIsRaisedWhenDirectoryDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The file "foo" does not exist (in:');
$this->loader->load('foo/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index 8493642b4c84b..426b720f35d1e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -200,12 +200,10 @@ public function testMissingParentClass()
);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /Expected to find class "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Bar" in file ".+" while importing services from resource "Prototype\/Sub\/\*", but it was not found\! Check the namespace prefix used with the resource/
- */
public function testRegisterClassesWithBadPrefix()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/Expected to find class "Symfony\\\Component\\\DependencyInjection\\\Tests\\\Fixtures\\\Prototype\\\Bar" in file ".+" while importing services from resource "Prototype\/Sub\/\*", but it was not found\! Check the namespace prefix used with the resource/');
$container = new ContainerBuilder();
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
index 87a436c4b520c..06cc8b2ebb6fa 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
@@ -98,30 +98,24 @@ public function getTypeConversions()
];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The file "foo.ini" does not exist (in:
- */
public function testExceptionIsRaisedWhenIniFileDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The file "foo.ini" does not exist (in:');
$this->loader->load('foo.ini');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The "nonvalid.ini" file is not valid.
- */
public function testExceptionIsRaisedWhenIniFileCannotBeParsed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The "nonvalid.ini" file is not valid.');
@$this->loader->load('nonvalid.ini');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The "almostvalid.ini" file is not valid.
- */
public function testExceptionIsRaisedWhenIniFileIsAlmostValid()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The "almostvalid.ini" file is not valid.');
@$this->loader->load('almostvalid.ini');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
index 4f7c16890b121..ab2fb11f69e5f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
@@ -20,6 +21,8 @@
class PhpFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator());
@@ -77,12 +80,10 @@ public function provideConfig()
}
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The service "child_service" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.
- */
public function testAutoConfigureAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The service "child_service" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.');
$fixtures = realpath(__DIR__.'/../Fixtures');
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator());
@@ -90,12 +91,10 @@ public function testAutoConfigureAndChildDefinitionNotAllowed()
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid factory "factory:method": the `service:method` notation is not available when using PHP-based DI configuration. Use "[ref('factory'), 'method']" instead.
- */
public function testFactoryShortNotationNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid factory "factory:method": the `service:method` notation is not available when using PHP-based DI configuration. Use "[ref(\'factory\'), \'method\']" instead.');
$fixtures = realpath(__DIR__.'/../Fixtures');
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator());
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index cafe419c6b027..6c33dba130b12 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -328,22 +328,18 @@ public function testParsesTags()
}
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- */
public function testParseTagsWithoutNameThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('tag_without_name.xml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /The tag name for service ".+" in .* must be a non-empty string/
- */
public function testParseTagWithEmptyNameThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/The tag name for service ".+" in .* must be a non-empty string/');
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('tag_with_empty_name.xml');
@@ -733,36 +729,30 @@ public function testInstanceof()
$this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.
- */
public function testInstanceOfAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The service "child_service" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.');
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('services_instanceof_with_parent.xml');
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The service "child_service" cannot have a "parent" and also have "autoconfigure". Try setting autoconfigure="false" for the service.
- */
public function testAutoConfigureAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The service "child_service" cannot have a "parent" and also have "autoconfigure". Try setting autoconfigure="false" for the service.');
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('services_autoconfigure_with_parent.xml');
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Attribute "autowire" on service "child_service" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.
- */
public function testDefaultsAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Attribute "autowire" on service "child_service" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.');
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('services_defaults_with_parent.xml');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index d4d14a2cba081..94ec672561346 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -45,12 +45,10 @@ private static function doSetUpBeforeClass()
require_once self::$fixturesPath.'/includes/ProjectExtension.php';
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /The file ".+" does not exist./
- */
public function testLoadUnExistFile()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/The file ".+" does not exist./');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini'));
$r = new \ReflectionObject($loader);
$m = $r->getMethod('loadFile');
@@ -59,12 +57,10 @@ public function testLoadUnExistFile()
$m->invoke($loader, 'foo.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /The file ".+" does not contain valid YAML./
- */
public function testLoadInvalidYamlFile()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/The file ".+" does not contain valid YAML./');
$path = self::$fixturesPath.'/ini';
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator($path));
$r = new \ReflectionObject($loader);
@@ -76,10 +72,10 @@ public function testLoadInvalidYamlFile()
/**
* @dataProvider provideInvalidFiles
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
*/
public function testLoadInvalidFile($file)
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load($file.'.yml');
@@ -304,40 +300,32 @@ public function testLoadYamlOnlyWithKeys()
$this->assertEquals(['manager' => [['alias' => 'user']]], $definition->getTags());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /The tag name for service ".+" in .+ must be a non-empty string/
- */
public function testTagWithEmptyNameThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('tag_name_empty_string.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageREgExp /The tag name for service "\.+" must be a non-empty string/
- */
public function testTagWithNonStringNameThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('The tag name for service "\.+" must be a non-empty string');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('tag_name_no_string.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- */
public function testTypesNotArray()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('bad_types1.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- */
public function testTypeNotString()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('bad_types2.yml');
}
@@ -433,12 +421,10 @@ public function testPrototypeWithNamespace()
$this->assertFalse($container->getDefinition(Prototype\OtherDir\Component2\Dir2\Service5::class)->hasTag('foo'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/
- */
public function testPrototypeWithNamespaceAndNoResource()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services_prototype_namespace_without_resource.yml');
@@ -509,58 +495,48 @@ public function testInstanceof()
$this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.
- */
public function testInstanceOfAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The service "child_service" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services_instanceof_with_parent.yml');
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The service "child_service" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.
- */
public function testAutoConfigureAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The service "child_service" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services_autoconfigure_with_parent.yml');
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Attribute "autowire" on service "child_service" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.
- */
public function testDefaultsAndChildDefinitionNotAllowed()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Attribute "autowire" on service "child_service" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services_defaults_with_parent.yml');
$container->compile();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage The value of the "decorates" option for the "bar" service must be the id of the service without the "@" prefix (replace "@foo" with "foo").
- */
public function testDecoratedServicesWithWrongSyntaxThrowsException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The value of the "decorates" option for the "bar" service must be the id of the service without the "@" prefix (replace "@foo" with "foo").');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('bad_decorates.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /Parameter "tags" must be an array for service "Foo\\Bar" in .+services31_invalid_tags\.yml\. Check your YAML syntax./
- */
public function testInvalidTagsWithDefaults()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/Parameter "tags" must be an array for service "Foo\\\Bar" in .+services31_invalid_tags\.yml\. Check your YAML syntax./');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services31_invalid_tags.yml');
}
@@ -649,23 +625,19 @@ public function testAnonymousServicesInInstanceof()
$this->assertFalse($container->has('Bar'));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./
- */
public function testAnonymousServicesWithAliases()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('anonymous_services_alias.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./
- */
public function testAnonymousServicesInParameters()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('anonymous_services_in_parameters.yml');
@@ -681,23 +653,19 @@ public function testAutoConfigureInstanceof()
$this->assertFalse($container->getDefinition('override_defaults_settings_to_false')->isAutoconfigured());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /Service "_defaults" key must be an array, "NULL" given in ".+bad_empty_defaults\.yml"\./
- */
public function testEmptyDefaultsThrowsClearException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/Service "_defaults" key must be an array, "NULL" given in ".+bad_empty_defaults\.yml"\./');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('bad_empty_defaults.yml');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessageRegExp /Service "_instanceof" key must be an array, "NULL" given in ".+bad_empty_instanceof\.yml"\./
- */
public function testEmptyInstanceofThrowsClearException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/Service "_instanceof" key must be an array, "NULL" given in ".+bad_empty_instanceof\.yml"\./');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('bad_empty_instanceof.yml');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
index bd0613e5cd3bc..e0a978580e823 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
@@ -19,11 +19,9 @@ class EnvPlaceholderParameterBagTest extends TestCase
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- */
public function testGetThrowsInvalidArgumentExceptionIfEnvNameContainsNonWordCharacters()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$bag = new EnvPlaceholderParameterBag();
$bag->get('env(%foo%)');
}
@@ -132,12 +130,10 @@ public function testResolveEnvAllowsNull()
$this->assertNull($bag->all()['env(NULL_VAR)']);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The default value of env parameter "ARRAY_VAR" must be scalar or null, array given.
- */
public function testResolveThrowsOnBadDefaultValue()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The default value of env parameter "ARRAY_VAR" must be scalar or null, array given.');
$bag = new EnvPlaceholderParameterBag();
$bag->get('env(ARRAY_VAR)');
$bag->set('env(ARRAY_VAR)', []);
@@ -154,12 +150,10 @@ public function testGetEnvAllowsNull()
$this->assertNull($bag->all()['env(NULL_VAR)']);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The default value of an env() parameter must be scalar or null, but "array" given to "env(ARRAY_VAR)".
- */
public function testGetThrowsOnBadDefaultValue()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The default value of an env() parameter must be scalar or null, but "array" given to "env(ARRAY_VAR)".');
$bag = new EnvPlaceholderParameterBag();
$bag->set('env(ARRAY_VAR)', []);
$bag->get('env(ARRAY_VAR)');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
index b168e0c20a976..532a5a014fef1 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
class FrozenParameterBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$parameters = [
@@ -26,38 +29,30 @@ public function testConstructor()
$this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument');
}
- /**
- * @expectedException \LogicException
- */
public function testClear()
{
+ $this->expectException('LogicException');
$bag = new FrozenParameterBag([]);
$bag->clear();
}
- /**
- * @expectedException \LogicException
- */
public function testSet()
{
+ $this->expectException('LogicException');
$bag = new FrozenParameterBag([]);
$bag->set('foo', 'bar');
}
- /**
- * @expectedException \LogicException
- */
public function testAdd()
{
+ $this->expectException('LogicException');
$bag = new FrozenParameterBag([]);
$bag->add([]);
}
- /**
- * @expectedException \LogicException
- */
public function testRemove()
{
+ $this->expectException('LogicException');
$bag = new FrozenParameterBag(['foo' => 'bar']);
$bag->remove('foo');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php
index aa9ebab6816fc..a88a489bb11ff 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
class ServiceLocatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHas()
{
$locator = new ServiceLocator([
@@ -58,12 +61,10 @@ public function testGetDoesNotMemoize()
$this->assertSame(2, $i);
}
- /**
- * @expectedException \Psr\Container\NotFoundExceptionInterface
- * @expectedExceptionMessage Service "dummy" not found: the container inside "Symfony\Component\DependencyInjection\Tests\ServiceLocatorTest" is a smaller service locator that only knows about the "foo" and "bar" services.
- */
public function testGetThrowsOnUndefinedService()
{
+ $this->expectException('Psr\Container\NotFoundExceptionInterface');
+ $this->expectExceptionMessage('Service "dummy" not found: the container inside "Symfony\Component\DependencyInjection\Tests\ServiceLocatorTest" is a smaller service locator that only knows about the "foo" and "bar" services.');
$locator = new ServiceLocator([
'foo' => function () { return 'bar'; },
'bar' => function () { return 'baz'; },
@@ -72,12 +73,10 @@ public function testGetThrowsOnUndefinedService()
$locator->get('dummy');
}
- /**
- * @expectedException \Psr\Container\NotFoundExceptionInterface
- * @expectedExceptionMessage The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.
- */
public function testThrowsOnUndefinedInternalService()
{
+ $this->expectException('Psr\Container\NotFoundExceptionInterface');
+ $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
$locator = new ServiceLocator([
'foo' => function () use (&$locator) { return $locator->get('bar'); },
]);
@@ -85,12 +84,10 @@ public function testThrowsOnUndefinedInternalService()
$locator->get('foo');
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
- * @expectedExceptionMessage Circular reference detected for service "bar", path: "bar -> baz -> bar".
- */
public function testThrowsOnCircularReference()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
+ $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
$locator = new ServiceLocator([
'foo' => function () use (&$locator) { return $locator->get('bar'); },
'bar' => function () use (&$locator) { return $locator->get('baz'); },
@@ -100,12 +97,10 @@ public function testThrowsOnCircularReference()
$locator->get('foo');
}
- /**
- * @expectedException \Psr\Container\NotFoundExceptionInterface
- * @expectedExceptionMessage Service "foo" not found: even though it exists in the app's container, the container inside "caller" is a smaller service locator that only knows about the "bar" service. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "SomeServiceSubscriber::getSubscribedServices()".
- */
public function testThrowsInServiceSubscriber()
{
+ $this->expectException('Psr\Container\NotFoundExceptionInterface');
+ $this->expectExceptionMessage('Service "foo" not found: even though it exists in the app\'s container, the container inside "caller" is a smaller service locator that only knows about the "bar" service. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "SomeServiceSubscriber::getSubscribedServices()".');
$container = new Container();
$container->set('foo', new \stdClass());
$subscriber = new SomeServiceSubscriber();
@@ -115,12 +110,10 @@ public function testThrowsInServiceSubscriber()
$subscriber->getFoo();
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
- * @expectedExceptionMessage Service "foo" not found: even though it exists in the app's container, the container inside "foo" is a smaller service locator that is empty... Try using dependency injection instead.
- */
public function testGetThrowsServiceNotFoundException()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
+ $this->expectExceptionMessage('Service "foo" not found: even though it exists in the app\'s container, the container inside "foo" is a smaller service locator that is empty... Try using dependency injection instead.');
$container = new Container();
$container->set('foo', new \stdClass());
diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
index 03670f913c0c0..843873c331e3e 100644
--- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
@@ -72,21 +72,17 @@ public function testAdd()
$this->assertEquals('Foo', $crawler->filterXPath('//body')->text(), '->add() adds nodes from a string');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testAddInvalidType()
{
+ $this->expectException('InvalidArgumentException');
$crawler = new Crawler();
$crawler->add(1);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Attaching DOM nodes from multiple documents in the same crawler is forbidden.
- */
public function testAddMultipleDocumentNode()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Attaching DOM nodes from multiple documents in the same crawler is forbidden.');
$crawler = $this->createTestCrawler();
$crawler->addHtmlContent('
', 'UTF-8');
}
@@ -772,22 +768,18 @@ public function testLink()
}
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The selected node should be instance of DOMElement
- */
public function testInvalidLink()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The selected node should be instance of DOMElement');
$crawler = $this->createTestCrawler('http://example.com/bar/');
$crawler->filterXPath('//li/text()')->link();
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The selected node should be instance of DOMElement
- */
public function testInvalidLinks()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The selected node should be instance of DOMElement');
$crawler = $this->createTestCrawler('http://example.com/bar/');
$crawler->filterXPath('//li/text()')->link();
}
@@ -889,12 +881,10 @@ public function testForm()
}
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The selected node should be instance of DOMElement
- */
public function testInvalidForm()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The selected node should be instance of DOMElement');
$crawler = $this->createTestCrawler('http://example.com/bar/');
$crawler->filterXPath('//li/text()')->form();
}
@@ -1002,7 +992,7 @@ public function testChildren()
$this->assertTrue(true, '->children() does not trigger a notice if the node has no children');
} catch (\PHPUnit\Framework\Error\Notice $e) {
$this->fail('->children() does not trigger a notice if the node has no children');
- } catch (\PHPUnit_Framework_Error_Notice $e) {
+ } catch (\PHPUnit\Framework\Error\Notice $e) {
$this->fail('->children() does not trigger a notice if the node has no children');
}
}
@@ -1112,11 +1102,9 @@ public function testEvaluateReturnsACrawlerIfXPathExpressionEvaluatesToANode()
$this->assertSame('input', $crawler->first()->nodeName());
}
- /**
- * @expectedException \LogicException
- */
public function testEvaluateThrowsAnExceptionIfDocumentIsEmpty()
{
+ $this->expectException('LogicException');
(new Crawler())->evaluate('//form/input[1]');
}
diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
index 32a7d9ec7079b..e218a6d863683 100644
--- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
@@ -67,11 +67,10 @@ public function testConstructorThrowsExceptionIfTheNodeHasNoFormAncestor()
/**
* __construct() should throw \\LogicException if the form attribute is invalid.
- *
- * @expectedException \LogicException
*/
public function testConstructorThrowsExceptionIfNoRelatedForm()
{
+ $this->expectException('LogicException');
$dom = new \DOMDocument();
$dom->loadHTML('
@@ -717,20 +716,16 @@ public function testFormFieldRegistryAcceptAnyNames()
$registry->remove('[t:dbt%3adate;]data_daterange_enddate_value');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testFormFieldRegistryGetThrowAnExceptionWhenTheFieldDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
$registry = new FormFieldRegistry();
$registry->get('foo');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testFormFieldRegistrySetThrowAnExceptionWhenTheFieldDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
$registry = new FormFieldRegistry();
$registry->set('foo', null);
}
@@ -807,24 +802,20 @@ public function testFormRegistrySetValues()
]);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Cannot set value on a compound field "foo[bar]".
- */
public function testFormRegistrySetValueOnCompoundField()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Cannot set value on a compound field "foo[bar]".');
$registry = new FormFieldRegistry();
$registry->add($this->getFormFieldMock('foo[bar][baz]'));
$registry->set('foo[bar]', 'fbb');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Unreachable field "0"
- */
public function testFormRegistrySetArrayOnNotCompoundField()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Unreachable field "0"');
$registry = new FormFieldRegistry();
$registry->add($this->getFormFieldMock('bar'));
diff --git a/src/Symfony/Component/DomCrawler/Tests/ImageTest.php b/src/Symfony/Component/DomCrawler/Tests/ImageTest.php
index 7f9c71924f7eb..3308464d18fd8 100644
--- a/src/Symfony/Component/DomCrawler/Tests/ImageTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/ImageTest.php
@@ -12,15 +12,16 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Image;
class ImageTest extends TestCase
{
- /**
- * @expectedException \LogicException
- */
+ use ForwardCompatTestTrait;
+
public function testConstructorWithANonImgTag()
{
+ $this->expectException('LogicException');
$dom = new \DOMDocument();
$dom->loadHTML('
');
diff --git a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php
index 3cbcdbd62b57a..6f869fc64ac7c 100644
--- a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php
@@ -12,26 +12,25 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Link;
class LinkTest extends TestCase
{
- /**
- * @expectedException \LogicException
- */
+ use ForwardCompatTestTrait;
+
public function testConstructorWithANonATag()
{
+ $this->expectException('LogicException');
$dom = new \DOMDocument();
$dom->loadHTML('
');
new Link($dom->getElementsByTagName('div')->item(0), 'http://www.example.com/');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testConstructorWithAnInvalidCurrentUri()
{
+ $this->expectException('InvalidArgumentException');
$dom = new \DOMDocument();
$dom->loadHTML('foo');
diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php
index 97ae5090c9730..69badc9bc2cba 100644
--- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php
+++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Dotenv\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\Dotenv\Exception\FormatException;
class DotenvTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getEnvDataWithFormatErrors
*/
@@ -200,11 +203,9 @@ public function testLoad()
$this->assertSame('BAZ', $bar);
}
- /**
- * @expectedException \Symfony\Component\Dotenv\Exception\PathException
- */
public function testLoadDirectory()
{
+ $this->expectException('Symfony\Component\Dotenv\Exception\PathException');
$dotenv = new Dotenv();
$dotenv->load(__DIR__);
}
diff --git a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
index 801471b47b6e3..847105b079f9c 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\EventDispatcher\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -19,14 +20,15 @@
class RegisterListenersPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* Tests that event subscribers not implementing EventSubscriberInterface
* trigger an exception.
- *
- * @expectedException \InvalidArgumentException
*/
public function testEventSubscriberWithoutInterface()
{
+ $this->expectException('InvalidArgumentException');
$builder = new ContainerBuilder();
$builder->register('event_dispatcher');
$builder->register('my_event_subscriber', 'stdClass')
@@ -63,12 +65,10 @@ public function testValidEventSubscriber()
$this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "foo" tagged "kernel.event_listener" must not be abstract.
- */
public function testAbstractEventListener()
{
+ $this->expectException('InvalidArgumentException');
+ $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', []);
$container->register('event_dispatcher', 'stdClass');
@@ -77,12 +77,10 @@ public function testAbstractEventListener()
$registerListenersPass->process($container);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "foo" tagged "kernel.event_subscriber" must not be abstract.
- */
public function testAbstractEventSubscriber()
{
+ $this->expectException('InvalidArgumentException');
+ $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', []);
$container->register('event_dispatcher', 'stdClass');
@@ -128,12 +126,10 @@ public function testHotPathEvents()
$this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage You have requested a non-existent parameter "subscriber.class"
- */
public function testEventSubscriberUnresolvableClassName()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('You have requested a non-existent parameter "subscriber.class"');
$container = new ContainerBuilder();
$container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
index dfcd2431ecb4d..fb9e1620a7c5f 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
@@ -81,11 +81,9 @@ public function testGetArgument()
$this->assertEquals('Event', $this->event->getArgument('name'));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testGetArgException()
{
+ $this->expectException('\InvalidArgumentException');
$this->event->getArgument('nameNotExist');
}
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
index 6eebf621e3f7e..a786ee2b9b332 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
@@ -71,37 +71,29 @@ public function testHasListenersDelegates()
$this->assertSame('result', $this->dispatcher->hasListeners('event'));
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testAddListenerDisallowed()
{
+ $this->expectException('\BadMethodCallException');
$this->dispatcher->addListener('event', function () { return 'foo'; });
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testAddSubscriberDisallowed()
{
+ $this->expectException('\BadMethodCallException');
$subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock();
$this->dispatcher->addSubscriber($subscriber);
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testRemoveListenerDisallowed()
{
+ $this->expectException('\BadMethodCallException');
$this->dispatcher->removeListener('event', function () { return 'foo'; });
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testRemoveSubscriberDisallowed()
{
+ $this->expectException('\BadMethodCallException');
$subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock();
$this->dispatcher->removeSubscriber($subscriber);
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
index f2710fb1e5e82..8d81c2b9d94d6 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
/**
@@ -21,21 +22,19 @@
*/
class ExpressionFunctionTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage PHP function "fn_does_not_exist" does not exist.
- */
+ use ForwardCompatTestTrait;
+
public function testFunctionDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('PHP function "fn_does_not_exist" does not exist.');
ExpressionFunction::fromPhp('fn_does_not_exist');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage An expression function name must be defined when PHP function "Symfony\Component\ExpressionLanguage\Tests\fn_namespaced" is namespaced.
- */
public function testFunctionNamespaced()
{
+ $this->expectException('InvalidArgumentException');
+ $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 83b608b2b9956..348b37115794c 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ParsedExpression;
@@ -19,6 +20,8 @@
class ExpressionLanguageTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCachedParse()
{
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock();
@@ -94,12 +97,10 @@ public function testCachedParseWithDeprecatedParserCacheInterface()
$this->assertSame($savedParsedExpression, $parsedExpression);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Cache argument has to implement Psr\Cache\CacheItemPoolInterface.
- */
public function testWrongCacheImplementation()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Cache argument has to implement Psr\Cache\CacheItemPoolInterface.');
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemSpoolInterface')->getMock();
$expressionLanguage = new ExpressionLanguage($cacheMock);
}
@@ -146,12 +147,10 @@ public function testShortCircuitOperatorsCompile($expression, array $names, $exp
$this->assertSame($expected, $result);
}
- /**
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
- * @expectedExceptionMessage Unexpected end of expression around position 6 for expression `node.`.
- */
public function testParseThrowsInsteadOfNotice()
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectExceptionMessage('Unexpected end of expression around position 6 for expression `node.`.');
$expressionLanguage = new ExpressionLanguage();
$expressionLanguage->parse('node.', ['node']);
}
@@ -240,10 +239,10 @@ public function testCachingWithDifferentNamesOrder()
/**
* @dataProvider getRegisterCallbacks
- * @expectedException \LogicException
*/
public function testRegisterAfterParse($registerCallback)
{
+ $this->expectException('LogicException');
$el = new ExpressionLanguage();
$el->parse('1 + 1', []);
$registerCallback($el);
@@ -251,31 +250,29 @@ public function testRegisterAfterParse($registerCallback)
/**
* @dataProvider getRegisterCallbacks
- * @expectedException \LogicException
*/
public function testRegisterAfterEval($registerCallback)
{
+ $this->expectException('LogicException');
$el = new ExpressionLanguage();
$el->evaluate('1 + 1');
$registerCallback($el);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessageRegExp /Unable to call method "\w+" of object "\w+"./
- */
public function testCallBadCallable()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessageRegExp('/Unable to call method "\w+" of object "\w+"./');
$el = new ExpressionLanguage();
$el->evaluate('foo.myfunction()', ['foo' => new \stdClass()]);
}
/**
* @dataProvider getRegisterCallbacks
- * @expectedException \LogicException
*/
public function testRegisterAfterCompile($registerCallback)
{
+ $this->expectException('LogicException');
$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 d94dd74f06e60..b26f925cf0f77 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
@@ -40,22 +40,18 @@ public function testTokenize($tokens, $expression)
$this->assertEquals(new TokenStream($tokens, $expression), $this->lexer->tokenize($expression));
}
- /**
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
- * @expectedExceptionMessage Unexpected character "'" around position 33 for expression `service(faulty.expression.example').dummyMethod()`.
- */
public function testTokenizeThrowsErrorWithMessage()
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectExceptionMessage('Unexpected character "\'" around position 33 for expression `service(faulty.expression.example\').dummyMethod()`.');
$expression = "service(faulty.expression.example').dummyMethod()";
$this->lexer->tokenize($expression);
}
- /**
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
- * @expectedExceptionMessage Unclosed "(" around position 7 for expression `service(unclosed.expression.dummyMethod()`.
- */
public function testTokenizeThrowsErrorOnUnclosedBrace()
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $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 d030600fe8fe5..8fcddeb606f66 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
@@ -12,29 +12,28 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\Lexer;
use Symfony\Component\ExpressionLanguage\Node;
use Symfony\Component\ExpressionLanguage\Parser;
class ParserTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
- * @expectedExceptionMessage Variable "foo" is not valid around position 1 for expression `foo`.
- */
+ use ForwardCompatTestTrait;
+
public function testParseWithInvalidName()
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectExceptionMessage('Variable "foo" is not valid around position 1 for expression `foo`.');
$lexer = new Lexer();
$parser = new Parser([]);
$parser->parse($lexer->tokenize('foo'));
}
- /**
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
- * @expectedExceptionMessage Variable "foo" is not valid around position 1 for expression `foo`.
- */
public function testParseWithZeroInNames()
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $this->expectExceptionMessage('Variable "foo" is not valid around position 1 for expression `foo`.');
$lexer = new Lexer();
$parser = new Parser([]);
$parser->parse($lexer->tokenize('foo'), [0]);
@@ -165,10 +164,10 @@ private function createGetAttrNode($node, $item, $type)
/**
* @dataProvider getInvalidPostfixData
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
*/
public function testParseWithInvalidPostfixData($expr, $names = [])
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
$lexer = new Lexer();
$parser = new Parser([]);
$parser->parse($lexer->tokenize($expr), $names);
@@ -196,12 +195,10 @@ public function getInvalidPostfixData()
];
}
- /**
- * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
- * @expectedExceptionMessage Did you mean "baz"?
- */
public function testNameProposal()
{
+ $this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
+ $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 186b2ef3642d5..e8dedf72ac5d1 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -11,11 +11,15 @@
namespace Symfony\Component\Filesystem\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* Test class for Filesystem.
*/
class FilesystemTest extends FilesystemTestCase
{
+ use ForwardCompatTestTrait;
+
public function testCopyCreatesNewFile()
{
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
@@ -29,22 +33,18 @@ public function testCopyCreatesNewFile()
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testCopyFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
$this->filesystem->copy($sourceFilePath, $targetFilePath);
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testCopyUnreadableFileFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
// 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,11 +118,9 @@ public function testCopyOverridesExistingFileIfForced()
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testCopyWithOverrideWithReadOnlyTargetFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
// 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.');
@@ -222,11 +220,9 @@ public function testMkdirCreatesDirectoriesFromTraversableObject()
$this->assertTrue(is_dir($basePath.'3'));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testMkdirCreatesDirectoriesFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
$dir = $basePath.'2';
@@ -244,11 +240,9 @@ public function testTouchCreatesEmptyFile()
$this->assertFileExists($file);
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testTouchFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$file = $this->workspace.\DIRECTORY_SEPARATOR.'1'.\DIRECTORY_SEPARATOR.'2';
$this->filesystem->touch($file);
@@ -380,11 +374,9 @@ public function testFilesExists()
$this->assertTrue($this->filesystem->exists($basePath.'folder'));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testFilesExistsFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Long file names are an issue on Windows');
}
@@ -613,11 +605,9 @@ public function testChownLink()
$this->assertSame($owner, $this->getFileOwner($link));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testChownSymlinkFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfSymlinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -630,11 +620,9 @@ public function testChownSymlinkFails()
$this->filesystem->chown($link, 'user'.time().mt_rand(1000, 9999));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testChownLinkFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfLinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -647,11 +635,9 @@ public function testChownLinkFails()
$this->filesystem->chown($link, 'user'.time().mt_rand(1000, 9999));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testChownFail()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfPosixIsMissing();
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -722,11 +708,9 @@ public function testChgrpLink()
$this->assertSame($group, $this->getFileGroup($link));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testChgrpSymlinkFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfSymlinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -739,11 +723,9 @@ public function testChgrpSymlinkFails()
$this->filesystem->chgrp($link, 'user'.time().mt_rand(1000, 9999));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testChgrpLinkFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfLinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -756,11 +738,9 @@ public function testChgrpLinkFails()
$this->filesystem->chgrp($link, 'user'.time().mt_rand(1000, 9999));
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testChgrpFail()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfPosixIsMissing();
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -781,11 +761,9 @@ public function testRename()
$this->assertFileExists($newPath);
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testRenameThrowsExceptionIfTargetAlreadyExists()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
@@ -809,11 +787,9 @@ public function testRenameOverwritesTheTargetIfItAlreadyExists()
$this->assertFileExists($newPath);
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testRenameThrowsExceptionOnError()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
@@ -1420,11 +1396,9 @@ public function testTempnamWithMockScheme()
$this->assertFileExists($filename);
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testTempnamWithZlibSchemeFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$scheme = 'compress.zlib://';
$dirname = $scheme.$this->workspace;
@@ -1445,11 +1419,9 @@ public function testTempnamWithPHPTempSchemeFails()
$this->assertFileNotExists($filename);
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testTempnamWithPharSchemeFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
// 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.');
@@ -1464,11 +1436,9 @@ public function testTempnamWithPharSchemeFails()
$this->filesystem->tempnam($dirname, $pharname.'/bar');
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- */
public function testTempnamWithHTTPSchemeFails()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$scheme = 'http://';
$dirname = $scheme.$this->workspace;
diff --git a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php
index 14eabc021edb5..5048d99849ff1 100644
--- a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Filesystem\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\LockHandler;
@@ -21,24 +22,22 @@
*/
class LockHandlerTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- * @expectedExceptionMessage Failed to create "/a/b/c/d/e": mkdir(): Permission denied.
- */
+ use ForwardCompatTestTrait;
+
public function testConstructWhenRepositoryDoesNotExist()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectExceptionMessage('Failed to create "/a/b/c/d/e": mkdir(): Permission denied.');
if (!getenv('USER') || 'root' === getenv('USER')) {
$this->markTestSkipped('This test will fail if run under superuser');
}
new LockHandler('lock', '/a/b/c/d/e');
}
- /**
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
- * @expectedExceptionMessage The directory "/" is not writable.
- */
public function testConstructWhenRepositoryIsNotWriteable()
{
+ $this->expectException('Symfony\Component\Filesystem\Exception\IOException');
+ $this->expectExceptionMessage('The directory "/" is not writable.');
if (!getenv('USER') || 'root' === getenv('USER')) {
$this->markTestSkipped('This test will fail if run under superuser');
}
diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php
index c0eac6da12b59..0f2f47caa37d7 100644
--- a/src/Symfony/Component/Finder/Tests/FinderTest.php
+++ b/src/Symfony/Component/Finder/Tests/FinderTest.php
@@ -11,10 +11,13 @@
namespace Symfony\Component\Finder\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Finder\Finder;
class FinderTest extends Iterator\RealIteratorTestCase
{
+ use ForwardCompatTestTrait;
+
public function testCreate()
{
$this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
@@ -311,11 +314,9 @@ public function testIn()
$this->assertIterator($expected, $iterator);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInWithNonExistentDirectory()
{
+ $this->expectException('InvalidArgumentException');
$finder = new Finder();
$finder->in('foobar');
}
@@ -328,11 +329,9 @@ public function testInWithGlob()
$this->assertIterator($this->toAbsoluteFixtures(['A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy']), $finder);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInWithNonDirectoryGlob()
{
+ $this->expectException('InvalidArgumentException');
$finder = new Finder();
$finder->in(__DIR__.'/Fixtures/A/a*');
}
@@ -349,11 +348,9 @@ public function testInWithGlobBrace()
$this->assertIterator($this->toAbsoluteFixtures(['A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy']), $finder);
}
- /**
- * @expectedException \LogicException
- */
public function testGetIteratorWithoutIn()
{
+ $this->expectException('LogicException');
$finder = Finder::create();
$finder->getIterator();
}
@@ -481,11 +478,9 @@ public function testCountFiles()
$this->assertCount($i, $files);
}
- /**
- * @expectedException \LogicException
- */
public function testCountWithoutIn()
{
+ $this->expectException('LogicException');
$finder = Finder::create()->files();
\count($finder);
}
@@ -710,7 +705,7 @@ public function testAccessDeniedException()
$this->fail('Finder should throw an exception when opening a non-readable directory.');
} catch (\Exception $e) {
$expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
- if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) {
+ if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
}
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
index ad0187e032afc..9c6e7db03f9cc 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
@@ -11,15 +11,16 @@
namespace Symfony\Component\Finder\Tests\Iterator;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Finder\Iterator\CustomFilterIterator;
class CustomFilterIteratorTest extends IteratorTestCase
{
- /**
- * @expectedException \InvalidArgumentException
- */
+ use ForwardCompatTestTrait;
+
public function testWithInvalidFilter()
{
+ $this->expectException('InvalidArgumentException');
new CustomFilterIterator(new Iterator(), ['foo']);
}
diff --git a/src/Symfony/Component/Form/Tests/ButtonTest.php b/src/Symfony/Component/Form/Tests/ButtonTest.php
index 7f4344fe63e1f..92430069954f9 100644
--- a/src/Symfony/Component/Form/Tests/ButtonTest.php
+++ b/src/Symfony/Component/Form/Tests/ButtonTest.php
@@ -33,11 +33,9 @@ private function doSetUp()
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
- */
public function testSetParentOnSubmittedButton()
{
+ $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
$button = $this->getButtonBuilder('button')
->getForm()
;
diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
index 77ab8e73b0411..b36b45d9b5367 100644
--- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
@@ -51,12 +51,10 @@ public function testDebugFormTypeOption()
$this->assertContains('Symfony\Component\Form\Extension\Core\Type\FormType (method)', $tester->getDisplay());
}
- /**
- * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
- * @expectedExceptionMessage Could not find type "NonExistentType"
- */
public function testDebugSingleFormTypeNotFound()
{
+ $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Could not find type "NonExistentType"');
$tester = $this->createCommandTester();
$tester->execute(['class' => 'NonExistentType'], ['decorated' => false, 'interactive' => false]);
}
@@ -108,11 +106,9 @@ public function testDebugAmbiguousFormTypeInteractive()
, $output);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testDebugInvalidFormType()
{
+ $this->expectException('InvalidArgumentException');
$this->createCommandTester()->execute(['class' => 'test']);
}
diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
index 7657056b7ada1..516bd52d68717 100644
--- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php
+++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
@@ -26,6 +27,8 @@
class CompoundFormTest extends AbstractFormTest
{
+ use ForwardCompatTestTrait;
+
public function testValidIfAllChildrenAreValid()
{
$this->form->add($this->getBuilder('firstName')->getForm());
@@ -269,11 +272,9 @@ public function testAddUsingNameButNoTypeAndOptions()
$this->assertSame(['foo' => $child], $this->form->all());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
- */
public function testAddThrowsExceptionIfAlreadySubmitted()
{
+ $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
$this->form->submit([]);
$this->form->add($this->getBuilder('foo')->getForm());
}
@@ -288,11 +289,9 @@ public function testRemove()
$this->assertCount(0, $this->form);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
- */
public function testRemoveThrowsExceptionIfAlreadySubmitted()
{
+ $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
$this->form->add($this->getBuilder('foo')->setCompound(false)->getForm());
$this->form->submit(['foo' => 'bar']);
$this->form->remove('foo');
diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php
index 1e756ac5cfe22..4dba3e1737ce4 100644
--- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php
+++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -27,6 +28,8 @@
*/
class FormPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testDoNothingIfFormExtensionNotLoaded()
{
$container = $this->createContainerBuilder();
@@ -156,12 +159,10 @@ public function addTaggedTypeExtensionsDataProvider()
];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage extended-type attribute, none was configured for the "my.type_extension" service
- */
public function testAddTaggedFormTypeExtensionWithoutExtendedTypeAttribute()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('extended-type attribute, none was configured for the "my.type_extension" service');
$container = $this->createContainerBuilder();
$container->setDefinition('form.extension', $this->createExtensionDefinition());
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 09b81fc5e1bb4..e1e7ad0eeeab1 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
@@ -71,11 +71,9 @@ public function testTransformEmpty()
$this->assertSame($output, $this->transformer->transform(null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformRequiresArray()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->transformer->transform('12345');
}
@@ -126,11 +124,9 @@ public function testReverseTransformCompletelyNull()
$this->assertNull($this->transformer->reverseTransform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyNull()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$input = [
'first' => [
'a' => '1',
@@ -143,11 +139,9 @@ public function testReverseTransformPartiallyNull()
$this->transformer->reverseTransform($input);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformRequiresArray()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$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 283dd4a81d1bc..d3dc7e3a26471 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
@@ -12,24 +12,23 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class BaseDateTimeTransformerTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- * @expectedExceptionMessage this_timezone_does_not_exist
- */
+ use ForwardCompatTestTrait;
+
public function testConstructFailsIfInputTimezoneIsInvalid()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('this_timezone_does_not_exist');
$this->getMockBuilder('Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer')->setConstructorArgs(['this_timezone_does_not_exist'])->getMock();
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- * @expectedExceptionMessage that_timezone_does_not_exist
- */
public function testConstructFailsIfOutputTimezoneIsInvalid()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('that_timezone_does_not_exist');
$this->getMockBuilder('Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer')->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 5c1582eb04ad6..02cc314e837d3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
@@ -48,19 +48,15 @@ public function testTransformAcceptsNull()
$this->assertNull($this->transformer->transform(null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformFailsIfString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->transformer->transform('1');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformFailsIfInteger()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->transformer->reverseTransform(1);
}
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 37d383490f966..ee007b40d1a89 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
@@ -91,10 +91,10 @@ public function reverseTransformExpectsStringOrNullProvider()
/**
* @dataProvider reverseTransformExpectsStringOrNullProvider
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
*/
public function testReverseTransformExpectsStringOrNull($value)
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$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 e741a3e11f0cf..6f008ba187143 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
@@ -56,11 +56,9 @@ public function testTransformNull()
$this->assertSame([], $this->transformer->transform(null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformExpectsArray()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->transformer->transform('foobar');
}
@@ -84,11 +82,9 @@ public function testReverseTransformNull()
$this->assertSame([], $this->transformerWithNull->reverseTransform(null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformExpectsArray()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->transformer->reverseTransform('foobar');
}
}
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 2669d3d4af427..5460203fc6c4b 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
class DateTimeToArrayTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testTransform()
{
$transformer = new DateTimeToArrayTransformer('UTC', 'UTC');
@@ -137,11 +140,9 @@ public function testTransformDateTimeImmutable()
$this->assertSame($output, $transformer->transform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformRequiresDateTime()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform('12345');
}
@@ -211,11 +212,9 @@ public function testReverseTransformCompletelyEmptySubsetOfFields()
$this->assertNull($transformer->reverseTransform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyEmptyYear()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'month' => '2',
@@ -226,11 +225,9 @@ public function testReverseTransformPartiallyEmptyYear()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyEmptyMonth()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -241,11 +238,9 @@ public function testReverseTransformPartiallyEmptyMonth()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyEmptyDay()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -256,11 +251,9 @@ public function testReverseTransformPartiallyEmptyDay()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyEmptyHour()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -271,11 +264,9 @@ public function testReverseTransformPartiallyEmptyHour()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyEmptyMinute()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -286,11 +277,9 @@ public function testReverseTransformPartiallyEmptyMinute()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyEmptySecond()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -346,20 +335,16 @@ public function testReverseTransformToDifferentTimezone()
$this->assertEquals($output, $transformer->reverseTransform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformRequiresArray()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform('12345');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNegativeYear()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '-1',
@@ -371,11 +356,9 @@ public function testReverseTransformWithNegativeYear()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNegativeMonth()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -387,11 +370,9 @@ public function testReverseTransformWithNegativeMonth()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNegativeDay()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -403,11 +384,9 @@ public function testReverseTransformWithNegativeDay()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNegativeHour()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -419,11 +398,9 @@ public function testReverseTransformWithNegativeHour()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNegativeMinute()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -435,11 +412,9 @@ public function testReverseTransformWithNegativeMinute()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNegativeSecond()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -451,11 +426,9 @@ public function testReverseTransformWithNegativeSecond()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithInvalidMonth()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -467,11 +440,9 @@ public function testReverseTransformWithInvalidMonth()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithInvalidDay()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -483,11 +454,9 @@ public function testReverseTransformWithInvalidDay()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithStringDay()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -499,11 +468,9 @@ public function testReverseTransformWithStringDay()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithStringMonth()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -515,11 +482,9 @@ public function testReverseTransformWithStringMonth()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithStringYear()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => 'bazinga',
@@ -531,11 +496,9 @@ public function testReverseTransformWithStringYear()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithEmptyStringHour()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -547,11 +510,9 @@ public function testReverseTransformWithEmptyStringHour()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithEmptyStringMinute()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToArrayTransformer();
$transformer->reverseTransform([
'year' => '2010',
@@ -563,11 +524,9 @@ public function testReverseTransformWithEmptyStringMinute()
]);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithEmptyStringSecond()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$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 6388bf2a8d5ea..facbe9510e900 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
@@ -12,11 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToHtml5LocalDateTimeTransformer;
use Symfony\Component\Form\Tests\Extension\Core\DataTransformer\Traits\DateTimeEqualsTrait;
class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
use DateTimeEqualsTrait;
public function transformProvider()
@@ -72,11 +74,9 @@ public function testTransformDateTimeImmutable($fromTz, $toTz, $from, $to)
$this->assertSame($to, $transformer->transform(null !== $from ? new \DateTimeImmutable($from) : null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformRequiresValidDateTime()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToHtml5LocalDateTimeTransformer();
$transformer->transform('2010-01-01');
}
@@ -95,30 +95,24 @@ public function testReverseTransform($toTz, $fromTz, $to, $from)
}
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformRequiresString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToHtml5LocalDateTimeTransformer();
$transformer->reverseTransform(12345);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNonExistingDate()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToHtml5LocalDateTimeTransformer('UTC', 'UTC');
$transformer->reverseTransform('2010-04-31T04:05');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformExpectsValidDateString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$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 c074fe88d1701..a13182ddeb43f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
@@ -175,11 +175,9 @@ public function testTransformDateTimeImmutableTimezones()
$this->assertEquals($dateTime->format('d.m.Y, H:i'), $transformer->transform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformRequiresValidDateTime()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->transform('2010-01-01');
}
@@ -285,73 +283,57 @@ public function testReverseTransformEmpty()
$this->assertNull($transformer->reverseTransform(''));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformRequiresString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform(12345);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWrapsIntlErrors()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer();
$transformer->reverseTransform('12345');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testValidateDateFormatOption()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
new DateTimeToLocalizedStringTransformer(null, null, 'foobar');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testValidateTimeFormatOption()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
new DateTimeToLocalizedStringTransformer(null, null, null, 'foobar');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNonExistingDate()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::SHORT);
$this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformOutOfTimestampRange()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
$transformer->reverseTransform('1789-07-14');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformFiveDigitYears()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd');
$transformer->reverseTransform('20107-03-21');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformFiveDigitYearsWithTimestamp()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd HH:mm:ss');
$transformer->reverseTransform('20107-03-21 12:34:56');
}
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 ec251d8f35c10..3a2d9ab8bbcaf 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
@@ -87,11 +87,9 @@ public function testTransformDateTimeImmutable($fromTz, $toTz, $from, $to)
$this->assertSame($to, $transformer->transform(null !== $from ? new \DateTimeImmutable($from) : null));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformRequiresValidDateTime()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToRfc3339Transformer();
$transformer->transform('2010-01-01');
}
@@ -110,20 +108,16 @@ public function testReverseTransform($toTz, $fromTz, $to, $from)
}
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformRequiresString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToRfc3339Transformer();
$transformer->reverseTransform(12345);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformWithNonExistingDate()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
$transformer->reverseTransform('2010-04-31T04:05Z');
@@ -131,10 +125,10 @@ public function testReverseTransformWithNonExistingDate()
/**
* @dataProvider invalidDateStringProvider
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
*/
public function testReverseTransformExpectsValidDateString($date)
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
$transformer->reverseTransform($date);
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 6aefe3cab53fb..6bc0cd9a54f74 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeZoneToStringTransformer;
class DateTimeZoneToStringTransformerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSingle()
{
$transformer = new DateTimeZoneToStringTransformer();
@@ -38,19 +41,15 @@ public function testMultiple()
$this->assertEquals([new \DateTimeZone('Europe/Amsterdam')], $transformer->reverseTransform(['Europe/Amsterdam']));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testInvalidTimezone()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
(new DateTimeZoneToStringTransformer())->transform(1);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testUnknownTimezone()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
(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 c7b60d1e57e83..33e5609510982 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
@@ -190,21 +190,17 @@ public function testReverseTransformWithRounding($input, $output, $roundingMode)
$this->assertEquals($output, $transformer->reverseTransform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformExpectsString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform(1);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformExpectsValidNumber()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('foo');
@@ -212,10 +208,10 @@ public function testReverseTransformExpectsValidNumber()
/**
* @dataProvider floatNumberProvider
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
*/
public function testReverseTransformExpectsInteger($number, $locale)
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -233,41 +229,33 @@ public function floatNumberProvider()
];
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsNaN()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('NaN');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsNaN2()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('nan');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsInfinity()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('∞');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsNegativeInfinity()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new IntegerToLocalizedStringTransformer();
$transformer->reverseTransform('-∞');
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 fd3f570d4c740..c4e8c7a3d6ab5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -400,11 +400,9 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
$this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
@@ -415,11 +413,9 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
$transformer->reverseTransform('1.234.5');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
@@ -459,11 +455,9 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -471,11 +465,9 @@ public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
$transformer->reverseTransform('1,234,5');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -491,44 +483,37 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGro
$this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testTransformExpectsNumeric()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->transform('foo');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformExpectsString()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform(1);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformExpectsValidNumber()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('foo');
}
/**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
* @dataProvider nanRepresentationProvider
- *
* @see https://github.com/symfony/symfony/issues/3161
*/
public function testReverseTransformDisallowsNaN($nan)
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform($nan);
@@ -543,63 +528,51 @@ public function nanRepresentationProvider()
];
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsInfinity()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('∞');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsInfinity2()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('∞,123');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsNegativeInfinity()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('-∞');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsLeadingExtraCharacters()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('foo123');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo3"
- */
public function testReverseTransformDisallowsCenteredExtraCharacters()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo3"');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('12foo3');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo8"
- */
public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo8"');
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
@@ -610,12 +583,10 @@ public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
$transformer->reverseTransform("12\xc2\xa0345,67foo8");
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo8"
- */
public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo8"');
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
@@ -626,23 +597,19 @@ public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
$transformer->reverseTransform("12\xc2\xa0345,67foo8 \xc2\xa0\t");
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo"
- */
public function testReverseTransformDisallowsTrailingExtraCharacters()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo"');
$transformer = new NumberToLocalizedStringTransformer();
$transformer->reverseTransform('123foo');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo"
- */
public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $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/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
index e2dfc481b3514..06ef6cc736341 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
@@ -145,11 +145,9 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
$this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
@@ -160,11 +158,9 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
$transformer->reverseTransform('1.234.5');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
@@ -204,11 +200,9 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
$transformer = new PercentToLocalizedStringTransformer(1, 'integer');
@@ -216,11 +210,9 @@ public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
$transformer->reverseTransform('1,234,5');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
IntlTestHelper::requireFullIntl($this, '4.8.1.1');
$transformer = new PercentToLocalizedStringTransformer(1, 'integer');
@@ -246,34 +238,30 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGro
$this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDisallowsLeadingExtraCharacters()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$transformer = new PercentToLocalizedStringTransformer();
$transformer->reverseTransform('foo123');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo3"
- */
public function testReverseTransformDisallowsCenteredExtraCharacters()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo3"');
$transformer = new PercentToLocalizedStringTransformer();
$transformer->reverseTransform('12foo3');
}
/**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo8"
* @requires extension mbstring
*/
public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo8"');
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
@@ -284,24 +272,22 @@ public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
$transformer->reverseTransform("12\xc2\xa0345,67foo8");
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo"
- */
public function testReverseTransformDisallowsTrailingExtraCharacters()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('The number contains unrecognized characters: "foo"');
$transformer = new PercentToLocalizedStringTransformer();
$transformer->reverseTransform('123foo');
}
/**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage The number contains unrecognized characters: "foo"
* @requires extension mbstring
*/
public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $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/ValueToDuplicatesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
index 179ace5a6cf60..c02eb3573e692 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
@@ -108,11 +108,9 @@ public function testReverseTransformZeroString()
$this->assertSame('0', $this->transformer->reverseTransform($input));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformPartiallyNull()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$input = [
'a' => 'Foo',
'b' => 'Foo',
@@ -122,11 +120,9 @@ public function testReverseTransformPartiallyNull()
$this->transformer->reverseTransform($input);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformDifferences()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$input = [
'a' => 'Foo',
'b' => 'Bar',
@@ -136,11 +132,9 @@ public function testReverseTransformDifferences()
$this->transformer->reverseTransform($input);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- */
public function testReverseTransformRequiresArray()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$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 daf5d60d37882..67545d6f2910f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
@@ -185,10 +185,10 @@ public function testDoNothingIfNotAllowDelete($allowAdd)
/**
* @dataProvider getBooleanMatrix2
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
*/
public function testRequireArrayOrTraversable($allowAdd, $allowDelete)
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$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 a1775efe9f8fa..4c3ff17b4c989 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
@@ -69,11 +69,9 @@ public function testPreSetDataResizesForm()
$this->assertTrue($this->form->has('2'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testPreSetDataRequiresArrayOrTraversable()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$data = 'no array or traversable';
$event = new FormEvent($this->form, $data);
$listener = new ResizeFormListener('text', [], false, false);
@@ -204,11 +202,9 @@ public function testOnSubmitNormDataDoesNothingIfNotAllowDelete()
$this->assertEquals($data, $event->getData());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testOnSubmitNormDataRequiresArrayOrTraversable()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$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 ffadf8c844dc9..01e08d09ff11c 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
@@ -11,18 +11,20 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* @author Stepan Anchugov
*/
class BirthdayTypeTest extends DateTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testSetInvalidYearsOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$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 350602306f64a..98df91d7e873d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
@@ -11,11 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
/**
* @author Bernhard Schussek
*/
class ButtonTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
public function testCreateButtonInstances()
@@ -24,14 +28,14 @@ public function testCreateButtonInstances()
}
/**
- * @expectedException \Symfony\Component\Form\Exception\BadMethodCallException
- * @expectedExceptionMessage Buttons do not support empty data.
*
* @param string $emptyData
* @param null $expectedData
*/
public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expectedData = null)
{
+ $this->expectException('Symfony\Component\Form\Exception\BadMethodCallException');
+ $this->expectExceptionMessage('Buttons do not support empty data.');
parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData);
}
}
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 544f4442f19ec..5b47bc4212ba3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -83,21 +83,17 @@ private function doTearDown()
$this->objectChoices = null;
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testChoicesOptionExpectsArrayOrTraversable()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'choices' => new \stdClass(),
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testChoiceLoaderOptionExpectsChoiceLoaderInterface()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'choice_loader' => new \stdClass(),
]);
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 6e9059d2cdb3f..a1c1c356509f9 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -38,21 +38,17 @@ private function doTearDown()
\Locale::setDefault($this->defaultLocale);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testInvalidWidgetOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'widget' => 'fake_widget',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testInvalidInputOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'input' => 'fake_input',
]);
@@ -344,11 +340,10 @@ public function provideDateFormats()
/**
* This test is to check that the strings '0', '1', '2', '3' are not accepted
* as valid IntlDateFormatter constants for FULL, LONG, MEDIUM or SHORT respectively.
- *
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testThrowExceptionIfFormatIsNoPattern()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'format' => '0',
'widget' => 'single_text',
@@ -356,75 +351,61 @@ public function testThrowExceptionIfFormatIsNoPattern()
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The "format" option should contain the letters "y", "M" and "d". Its current value is "yy".
- */
public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $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],
'format' => 'yy',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The "format" option should contain the letters "y", "M" or "d". Its current value is "wrong".
- */
public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTextWidget()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $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',
'format' => 'wrong',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfFormatIsNoConstant()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'format' => 105,
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfFormatIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'format' => [],
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfYearsIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'years' => 'bad value',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfMonthsIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'months' => 'bad value',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfDaysIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'days' => 'bad value',
]);
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 960d94ebb49f2..73af2eb6b8473 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\Tests\Fixtures\Author;
@@ -19,6 +20,8 @@
class FormTest_AuthorWithoutRefSetter
{
+ use ForwardCompatTestTrait;
+
protected $reference;
protected $referenceCopy;
@@ -160,11 +163,9 @@ public function testDataClassMayBeInterface()
]));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- */
public function testDataClassMustBeValidClassOrInterface()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$this->factory->createBuilder(static::TESTED_TYPE, null, [
'data_class' => 'foobar',
]);
@@ -329,11 +330,9 @@ public function testSubmitWithEmptyDataUsesEmptyDataOption()
$this->assertEquals('Bernhard', $author->firstName);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testAttributesException()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, ['attr' => '']);
}
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 de99a9b9f16ec..3d49ae83f8cc2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
@@ -81,33 +81,27 @@ public function testSetRequired()
$this->assertFalse($form['second']->isRequired());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testSetInvalidOptions()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'type' => TextTypeTest::TESTED_TYPE,
'options' => 'bad value',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testSetInvalidFirstOptions()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'type' => TextTypeTest::TESTED_TYPE,
'first_options' => 'bad value',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testSetInvalidSecondOptions()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$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/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
index b445c8c5bfecd..f1cd2d7f436e8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormError;
class TimeTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TimeType';
public function testSubmitDateTime()
@@ -683,42 +686,34 @@ public function testSecondErrorsBubbleUp($widget)
$this->assertSame([$error], iterator_to_array($form->getErrors()));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidConfigurationException
- */
public function testInitializeWithSecondsAndWithoutMinutes()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidConfigurationException');
$this->factory->create(static::TESTED_TYPE, null, [
'with_minutes' => false,
'with_seconds' => true,
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfHoursIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'hours' => 'bad value',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfMinutesIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'minutes' => 'bad value',
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfSecondsIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'seconds' => 'bad value',
]);
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 a5608557dd1dc..4ea231dc3aa0a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
@@ -11,8 +11,12 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class UrlTypeTest extends TextTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\UrlType';
public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
@@ -73,11 +77,9 @@ public function testSubmitAddsNoDefaultProtocolIfSetToNull()
$this->assertSame('www.domain.com', $form->getViewData());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testThrowExceptionIfDefaultProtocolIsInvalid()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [
'default_protocol' => [],
]);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
index 375fbfc7021a1..1d1b10959b2ca 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension;
@@ -20,6 +21,8 @@
class DependencyInjectionExtensionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetTypeExtensions()
{
$typeExtension1 = new DummyExtension('test');
@@ -40,11 +43,9 @@ public function testGetTypeExtensions()
$this->assertSame([$typeExtension3], $extension->getTypeExtensions('other'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- */
public function testThrowExceptionForInvalidExtendedType()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$extensions = [
'test' => new \ArrayIterator([new DummyExtension('unmatched')]),
];
@@ -79,11 +80,11 @@ public function testLegacyGetTypeExtensions()
/**
* @group legacy
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
* @expectedDeprecation Passing four arguments to the Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension::__construct() method is deprecated since Symfony 3.3 and will be disallowed in Symfony 4.0. The new constructor only accepts three arguments.
*/
public function testLegacyThrowExceptionForInvalidExtendedType()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$formTypeExtension = new DummyExtension('unmatched');
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
index 0e5389568e5ce..4fba518b9533f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\HttpFoundation;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
use Symfony\Component\Form\Tests\AbstractRequestHandlerTest;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@@ -21,19 +22,17 @@
*/
class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest
{
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
+ use ForwardCompatTestTrait;
+
public function testRequestShouldNotBeNull()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$this->requestHandler->handleRequest($this->createForm('name', 'GET'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testRequestShouldBeInstanceOfRequest()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$this->requestHandler->handleRequest($this->createForm('name', 'GET'), new \stdClass());
}
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 7a6602d27e930..889cc6bd8e7be 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath;
/**
@@ -19,6 +20,8 @@
*/
class ViolationPathTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function providePaths()
{
return [
@@ -140,21 +143,17 @@ public function testGetElement()
$this->assertEquals('street', $path->getElement(1));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetElementDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->getElement(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetElementDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->getElement(-1);
@@ -168,21 +167,17 @@ public function testIsProperty()
$this->assertTrue($path->isProperty(2));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsPropertyDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->isProperty(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsPropertyDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->isProperty(-1);
@@ -196,21 +191,17 @@ public function testIsIndex()
$this->assertFalse($path->isIndex(2));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsIndexDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->isIndex(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsIndexDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->isIndex(-1);
@@ -225,21 +216,17 @@ public function testMapsForm()
$this->assertFalse($path->mapsForm(2));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testMapsFormDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$path = new ViolationPath('children[address].data[street].name');
$path->mapsForm(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testMapsFormDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$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 55405f0f1470e..db6c056f4a222 100644
--- a/src/Symfony/Component/Form/Tests/FormConfigTest.php
+++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php
@@ -139,11 +139,9 @@ public function testSetMethodAllowsPatch()
self::assertSame('PATCH', $formConfigBuilder->getMethod());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- */
public function testSetMethodDoesNotAllowOtherValues()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$this->getConfigBuilder()->setMethod('foo');
}
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
index 965485cf2c7e5..9250ee4cf2aa2 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -149,21 +149,17 @@ public function testCreateNamedBuilderDoesNotOverrideExistingDataOption()
$this->assertSame($this->builder, $this->factory->createNamedBuilder('name', 'type', 'DATA', $options));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- * @expectedExceptionMessage Expected argument of type "string", "stdClass" given
- */
public function testCreateNamedBuilderThrowsUnderstandableException()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectExceptionMessage('Expected argument of type "string", "stdClass" given');
$this->factory->createNamedBuilder('name', new \stdClass());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- * @expectedExceptionMessage Expected argument of type "string", "stdClass" given
- */
public function testCreateThrowsUnderstandableException()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
+ $this->expectExceptionMessage('Expected argument of type "string", "stdClass" given');
$this->factory->create(new \stdClass());
}
diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
index 8d72db3391075..21096b746d2f2 100644
--- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -105,19 +105,15 @@ public function testLoadUnregisteredType()
$this->assertSame($resolvedType, $this->registry->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- */
public function testFailIfUnregisteredTypeNoClass()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$this->registry->getType('Symfony\Blubb');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- */
public function testFailIfUnregisteredTypeNoFormType()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$this->registry->getType('stdClass');
}
@@ -163,12 +159,10 @@ public function testGetTypeConnectsParent()
$this->assertSame($resolvedType, $this->registry->getType(\get_class($type)));
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\LogicException
- * @expectedExceptionMessage Circular reference detected for form type "Symfony\Component\Form\Tests\Fixtures\FormWithSameParentType" (Symfony\Component\Form\Tests\Fixtures\FormWithSameParentType > Symfony\Component\Form\Tests\Fixtures\FormWithSameParentType).
- */
public function testFormCannotHaveItselfAsAParent()
{
+ $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $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();
$this->extension2->addType($type);
@@ -176,12 +170,10 @@ public function testFormCannotHaveItselfAsAParent()
$this->registry->getType(FormWithSameParentType::class);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\LogicException
- * @expectedExceptionMessage 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).
- */
public function testRecursiveFormDependencies()
{
+ $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $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();
$baz = new RecursiveFormTypeBaz();
@@ -193,11 +185,9 @@ public function testRecursiveFormDependencies()
$this->registry->getType(RecursiveFormTypeFoo::class);
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
- */
public function testGetTypeThrowsExceptionIfTypeNotFound()
{
+ $this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
$this->registry->getType('bar');
}
diff --git a/src/Symfony/Component/Form/Tests/Guess/GuessTest.php b/src/Symfony/Component/Form/Tests/Guess/GuessTest.php
index eea423bb9dc00..304eba3fa693c 100644
--- a/src/Symfony/Component/Form/Tests/Guess/GuessTest.php
+++ b/src/Symfony/Component/Form/Tests/Guess/GuessTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Guess;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Guess\Guess;
class TestGuess extends Guess
@@ -20,6 +21,8 @@ class TestGuess extends Guess
class GuessTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetBestGuessReturnsGuessWithHighestConfidence()
{
$guess1 = new TestGuess(Guess::MEDIUM_CONFIDENCE);
@@ -29,11 +32,9 @@ public function testGetBestGuessReturnsGuessWithHighestConfidence()
$this->assertSame($guess3, Guess::getBestGuess([$guess1, $guess2, $guess3]));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testGuessExpectsValidConfidence()
{
+ $this->expectException('\InvalidArgumentException');
new TestGuess(5);
}
}
diff --git a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
index ab66904617849..12230a803dac6 100644
--- a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
@@ -51,11 +51,9 @@ private function doTearDown()
$_SERVER = self::$serverBackup;
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
- */
public function testRequestShouldBeNull()
{
+ $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$this->requestHandler->handleRequest($this->createForm('name', 'GET'), 'request');
}
diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
index d0bc82e759659..b8879ba50871e 100644
--- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Form\Tests\Resources;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class TranslationFilesTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
index f88902dc8ced6..d8877ec4b633c 100644
--- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php
+++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Form;
@@ -54,6 +55,8 @@ public function getIterator()
class SimpleFormTest extends AbstractFormTest
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideFormNames
*/
@@ -94,12 +97,10 @@ public function testDataIsInitializedToConfiguredValue()
$this->assertSame('bar', $form->getViewData());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
- * @expectedExceptionMessage Unable to transform data for property path "name": No mapping for value "arg"
- */
public function testDataTransformationFailure()
{
+ $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
+ $this->expectExceptionMessage('Unable to transform data for property path "name": No mapping for value "arg"');
$model = new FixedDataTransformer([
'default' => 'foo',
]);
@@ -160,11 +161,9 @@ public function testFalseIsConvertedToNull()
$this->assertNull($form->getData());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
- */
public function testSubmitThrowsExceptionIfAlreadySubmitted()
{
+ $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
$this->form->submit([]);
$this->form->submit([]);
}
@@ -363,11 +362,9 @@ public function testHasNoErrors()
$this->assertCount(0, $this->form->getErrors());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
- */
public function testSetParentThrowsExceptionIfAlreadySubmitted()
{
+ $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
$this->form->submit([]);
$this->form->setParent($this->getBuilder('parent')->getForm());
}
@@ -385,11 +382,9 @@ public function testNotSubmitted()
$this->assertFalse($this->form->isSubmitted());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
- */
public function testSetDataThrowsExceptionIfAlreadySubmitted()
{
+ $this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
$this->form->submit([]);
$this->form->setData(null);
}
@@ -788,12 +783,10 @@ public function testSetNullParentWorksWithEmptyName()
$this->assertNull($form->getParent());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\LogicException
- * @expectedExceptionMessage A form with an empty name cannot have a parent form.
- */
public function testFormCannotHaveEmptyNameNotInRootLevel()
{
+ $this->expectException('Symfony\Component\Form\Exception\LogicException');
+ $this->expectExceptionMessage('A form with an empty name cannot have a parent form.');
$this->getBuilder()
->setCompound(true)
->setDataMapper($this->getDataMapper())
@@ -900,11 +893,9 @@ public function testViewDataMayBeArrayAccessIfDataClassIsNull()
$this->assertSame($arrayAccess, $form->getViewData());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\LogicException
- */
public function testViewDataMustBeObjectIfDataClassIsSet()
{
+ $this->expectException('Symfony\Component\Form\Exception\LogicException');
$config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
$config->addViewTransformer(new FixedDataTransformer([
'' => '',
@@ -915,12 +906,10 @@ public function testViewDataMustBeObjectIfDataClassIsSet()
$form->setData('foo');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- * @expectedExceptionMessage A cycle was detected. Listeners to the PRE_SET_DATA event must not call setData(). You should call setData() on the FormEvent object instead.
- */
public function testSetDataCannotInvokeItself()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $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);
$config->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
@@ -989,11 +978,9 @@ public function testFormInheritsParentData()
$this->assertSame('view[foo]', $parent->get('child')->getViewData());
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- */
public function testInheritDataDisallowsSetData()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1001,11 +988,9 @@ public function testInheritDataDisallowsSetData()
$form->setData('foo');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- */
public function testGetDataRequiresParentToBeSetIfInheritData()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1013,11 +998,9 @@ public function testGetDataRequiresParentToBeSetIfInheritData()
$form->getData();
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- */
public function testGetNormDataRequiresParentToBeSetIfInheritData()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1025,11 +1008,9 @@ public function testGetNormDataRequiresParentToBeSetIfInheritData()
$form->getNormData();
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- */
public function testGetViewDataRequiresParentToBeSetIfInheritData()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$form = $this->getBuilder()
->setInheritData(true)
->getForm();
@@ -1077,11 +1058,9 @@ public function testInitializeSetsDefaultData()
$form->initialize();
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- */
public function testInitializeFailsIfParent()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
$parent = $this->getBuilder()->setRequired(false)->getForm();
$child = $this->getBuilder()->setRequired(true)->getForm();
@@ -1090,12 +1069,10 @@ public function testInitializeFailsIfParent()
$child->initialize();
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- * @expectedExceptionMessage 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.
- */
public function testCannotCallGetDataInPreSetDataListenerIfDataHasNotAlreadyBeenSet()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $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) {
$event->getForm()->getData();
@@ -1105,12 +1082,10 @@ public function testCannotCallGetDataInPreSetDataListenerIfDataHasNotAlreadyBeen
$form->setData('foo');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- * @expectedExceptionMessage A cycle was detected. Listeners to the PRE_SET_DATA event must not call getNormData() if the form data has not already been set.
- */
public function testCannotCallGetNormDataInPreSetDataListener()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $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) {
$event->getForm()->getNormData();
@@ -1120,12 +1095,10 @@ public function testCannotCallGetNormDataInPreSetDataListener()
$form->setData('foo');
}
- /**
- * @expectedException \Symfony\Component\Form\Exception\RuntimeException
- * @expectedExceptionMessage A cycle was detected. Listeners to the PRE_SET_DATA event must not call getViewData() if the form data has not already been set.
- */
public function testCannotCallGetViewDataInPreSetDataListener()
{
+ $this->expectException('Symfony\Component\Form\Exception\RuntimeException');
+ $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) {
$event->getForm()->getViewData();
diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
index 01e76d87eb7ed..649cb05adaeee 100644
--- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
+++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Util;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Util\OrderedHashMap;
/**
@@ -19,6 +20,8 @@
*/
class OrderedHashMapTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGet()
{
$map = new OrderedHashMap();
@@ -27,11 +30,9 @@ public function testGet()
$this->assertSame(1, $map['first']);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetNonExistingFails()
{
+ $this->expectException('OutOfBoundsException');
$map = new OrderedHashMap();
$map['first'];
diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
index 74d3e81622c70..9e27c7313507f 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
@@ -49,11 +49,9 @@ public function testConstructWithNonAsciiFilename()
$this->assertSame('fööö.html', $response->getFile()->getFilename());
}
- /**
- * @expectedException \LogicException
- */
public function testSetContent()
{
+ $this->expectException('LogicException');
$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 aaf2edb385807..2d69d9ace16c3 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Cookie;
/**
@@ -24,6 +25,8 @@
*/
class CookieTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function invalidNames()
{
return [
@@ -41,18 +44,16 @@ public function invalidNames()
/**
* @dataProvider invalidNames
- * @expectedException \InvalidArgumentException
*/
public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidCharacters($name)
{
+ $this->expectException('InvalidArgumentException');
new Cookie($name);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInvalidExpiration()
{
+ $this->expectException('InvalidArgumentException');
new Cookie('MyCookie', 'foo', 'bar');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php b/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
index 2afdade67d9ce..e750f39e680f3 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
@@ -12,17 +12,18 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\HttpFoundation\ExpressionRequestMatcher;
use Symfony\Component\HttpFoundation\Request;
class ExpressionRequestMatcherTest extends TestCase
{
- /**
- * @expectedException \LogicException
- */
+ use ForwardCompatTestTrait;
+
public function testWhenNoExpressionIsSet()
{
+ $this->expectException('LogicException');
$expressionRequestMatcher = new ExpressionRequestMatcher();
$expressionRequestMatcher->matches(new Request());
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
index 3a203b4dac494..9b48da7a22d20 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
@@ -145,11 +145,9 @@ public function testGetClientOriginalExtension()
$this->assertEquals('gif', $file->getClientOriginalExtension());
}
- /**
- * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileException
- */
public function testMoveLocalFileIsNotAllowed()
{
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileException');
$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 3ef868eafe273..289c12bd3ef56 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
@@ -26,11 +26,9 @@ class FileBagTest extends TestCase
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \InvalidArgumentException
- */
public function testFileMustBeAnArrayOrUploadedFile()
{
+ $this->expectException('InvalidArgumentException');
new FileBag(['file' => 'foo']);
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
index 6c4915f2e43b9..3eff56840969b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\HeaderBag;
class HeaderBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$bag = new HeaderBag(['foo' => 'bar']);
@@ -48,11 +51,9 @@ public function testGetDate()
$this->assertInstanceOf('DateTime', $headerDate);
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetDateException()
{
+ $this->expectException('RuntimeException');
$bag = new HeaderBag(['foo' => 'Tue']);
$headerDate = $bag->getDate('foo');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
index c7f76b5de2926..338da1d25cad9 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\IpUtils;
class IpUtilsTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getIpv4Data
*/
@@ -73,11 +76,11 @@ public function getIpv6Data()
}
/**
- * @expectedException \RuntimeException
* @requires extension sockets
*/
public function testAnIpv6WithOptionDisabledIpv6()
{
+ $this->expectException('RuntimeException');
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/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
index d196205309753..2e2645dab6ded 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
@@ -219,29 +219,23 @@ public function testItAcceptsJsonAsString()
$this->assertSame('{"foo":"bar"}', $response->getContent());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testSetCallbackInvalidIdentifier()
{
+ $this->expectException('InvalidArgumentException');
$response = new JsonResponse('foo');
$response->setCallback('+invalid');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testSetContent()
{
+ $this->expectException('InvalidArgumentException');
JsonResponse::create("\xB1\x31");
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage This error is expected
- */
public function testSetContentJsonSerializeError()
{
+ $this->expectException('Exception');
+ $this->expectExceptionMessage('This error is expected');
if (!interface_exists('JsonSerializable', false)) {
$this->markTestSkipped('JsonSerializable is required.');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
index 5f6a8ac0883f4..1e4b7a6ca629d 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\RedirectResponse;
class RedirectResponseTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGenerateMetaRedirect()
{
$response = new RedirectResponse('foo.bar');
@@ -26,19 +29,15 @@ public function testGenerateMetaRedirect()
));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRedirectResponseConstructorNullUrl()
{
+ $this->expectException('InvalidArgumentException');
$response = new RedirectResponse(null);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRedirectResponseConstructorWrongStatusCode()
{
+ $this->expectException('InvalidArgumentException');
$response = new RedirectResponse('foo.bar', 404);
}
@@ -65,11 +64,9 @@ public function testSetTargetUrl()
$this->assertEquals('baz.beep', $response->getTargetUrl());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testSetTargetUrlNull()
{
+ $this->expectException('InvalidArgumentException');
$response = new RedirectResponse('foo.bar');
$response->setTargetUrl(null);
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index e0e719d38c50e..dad3f0bf2d897 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -889,11 +889,9 @@ public function testGetPort()
$this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.');
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetHostWithFakeHttpHostValue()
{
+ $this->expectException('RuntimeException');
$request = new Request();
$request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.host.com?query=string']);
$request->getHost();
@@ -1058,11 +1056,11 @@ public function getClientIpsProvider()
}
/**
- * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
* @dataProvider getClientIpsWithConflictingHeadersProvider
*/
public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXForwardedFor)
{
+ $this->expectException('Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException');
$request = new Request();
$server = [
@@ -1182,11 +1180,11 @@ public function testContentAsResource()
}
/**
- * @expectedException \LogicException
* @dataProvider getContentCantBeCalledTwiceWithResourcesProvider
*/
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
{
+ $this->expectException('LogicException');
if (\PHP_VERSION_ID >= 50600) {
$this->markTestSkipped('PHP >= 5.6 allows to open php://input several times.');
}
@@ -1971,20 +1969,20 @@ public function testTrustedProxiesForwarded()
/**
* @group legacy
- * @expectedException \InvalidArgumentException
*/
public function testSetTrustedProxiesInvalidHeaderName()
{
+ $this->expectException('InvalidArgumentException');
Request::create('http://example.com/');
Request::setTrustedHeaderName('bogus name', 'X_MY_FOR');
}
/**
* @group legacy
- * @expectedException \InvalidArgumentException
*/
public function testGetTrustedProxiesInvalidHeaderName()
{
+ $this->expectException('InvalidArgumentException');
Request::create('http://example.com/');
Request::getTrustedHeaderName('bogus name');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
index 93aacf24d799f..17be3cb604e3e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
@@ -20,6 +21,8 @@
*/
class ResponseHeaderBagTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testAllPreserveCase()
{
$headers = [
@@ -240,21 +243,17 @@ public function testSetCookieHeader()
$this->assertEquals([], $bag->getCookies());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testGetCookiesWithInvalidArgument()
{
+ $this->expectException('InvalidArgumentException');
$bag = new ResponseHeaderBag();
$bag->getCookies('invalid_argument');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testMakeDispositionInvalidDisposition()
{
+ $this->expectException('InvalidArgumentException');
$headers = new ResponseHeaderBag();
$headers->makeDisposition('invalid', 'foo.html');
@@ -298,10 +297,10 @@ public function provideMakeDisposition()
/**
* @dataProvider provideMakeDispositionFail
- * @expectedException \InvalidArgumentException
*/
public function testMakeDispositionFail($disposition, $filename)
{
+ $this->expectException('InvalidArgumentException');
$headers = new ResponseHeaderBag();
$headers->makeDisposition($disposition, $filename);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
index 40200ee31d0de..7515a7a9e4dea 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -19,6 +20,8 @@
*/
class ResponseTest extends ResponseTestCase
{
+ use ForwardCompatTestTrait;
+
public function testCreate()
{
$response = Response::create('foo', 301, ['Foo' => 'bar']);
@@ -846,11 +849,11 @@ public function testSetContent($content)
}
/**
- * @expectedException \UnexpectedValueException
* @dataProvider invalidContentProvider
*/
public function testSetContentInvalid($content)
{
+ $this->expectException('UnexpectedValueException');
$response = new Response();
$response->setContent($content);
}
@@ -928,11 +931,11 @@ protected function provideResponse()
}
/**
- * @see http://github.com/zendframework/zend-diactoros for the canonical source repository
+ * @see http://github.com/zendframework/zend-diactoros for the canonical source repository
*
- * @author Fábio Pacheco
+ * @author Fábio Pacheco
* @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
- * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
+ * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/
public function ianaCodesReasonPhrasesProvider()
{
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 a762de01c130e..8fd72a91f5b51 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -65,19 +65,15 @@ private function doSetUp()
$this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testConstructorShouldThrowExceptionForInvalidMongo()
{
+ $this->expectException('InvalidArgumentException');
new MongoDbSessionHandler(new \stdClass(), $this->options);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testConstructorShouldThrowExceptionForMissingOptions()
{
+ $this->expectException('InvalidArgumentException');
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 dc827d8ab03c2..303ad302645a1 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
@@ -25,6 +26,8 @@
*/
class NativeFileSessionHandlerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstruct()
{
$storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler(sys_get_temp_dir()));
@@ -59,11 +62,9 @@ public function savePathDataProvider()
];
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testConstructException()
{
+ $this->expectException('InvalidArgumentException');
$handler = 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 e9439c3da49fb..0571306ab6dc3 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -51,22 +51,18 @@ protected function getMemorySqlitePdo()
return $pdo;
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testWrongPdoErrMode()
{
+ $this->expectException('InvalidArgumentException');
$pdo = $this->getMemorySqlitePdo();
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
$storage = new PdoSessionHandler($pdo);
}
- /**
- * @expectedException \RuntimeException
- */
public function testInexistentTable()
{
+ $this->expectException('RuntimeException');
$storage = new PdoSessionHandler($this->getMemorySqlitePdo(), ['db_table' => 'inexistent_table']);
$storage->open('', 'sid');
$storage->read('id');
@@ -74,11 +70,9 @@ public function testInexistentTable()
$storage->close();
}
- /**
- * @expectedException \RuntimeException
- */
public function testCreateTableTwice()
{
+ $this->expectException('RuntimeException');
$storage = new PdoSessionHandler($this->getMemorySqlitePdo());
$storage->createTable();
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
index c60a78910bc58..1285dbf1ad779 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
@@ -124,11 +124,9 @@ public function testClearWithNoBagsStartsSession()
$this->assertTrue($storage->isStarted());
}
- /**
- * @expectedException \RuntimeException
- */
public function testUnstartedSave()
{
+ $this->expectException('RuntimeException');
$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 36b4e605b2c9c..9a5ef1ca85803 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
@@ -110,11 +110,9 @@ public function testMultipleInstances()
$this->assertEquals('bar', $storage2->getBag('attributes')->get('foo'), 'values persist between instances');
}
- /**
- * @expectedException \RuntimeException
- */
public function testSaveWithoutStart()
{
+ $this->expectException('RuntimeException');
$storage1 = $this->getStorage();
$storage1->save();
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 18540264dbe6a..886a5f9c9de37 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -75,20 +75,16 @@ public function testBag()
$this->assertSame($bag, $storage->getBag($bag->getName()));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRegisterBagException()
{
+ $this->expectException('InvalidArgumentException');
$storage = $this->getStorage();
$storage->getBag('non_existing');
}
- /**
- * @expectedException \LogicException
- */
public function testRegisterBagForAStartedSessionThrowsException()
{
+ $this->expectException('LogicException');
$storage = $this->getStorage();
$storage->start();
$storage->registerBag(new AttributeBag());
@@ -204,11 +200,9 @@ public function testSessionOptions()
$this->assertSame('200', ini_get('session.cache_expire'));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testSetSaveHandlerException()
{
+ $this->expectException('InvalidArgumentException');
$storage = $this->getStorage();
$storage->setSaveHandler(new \stdClass());
}
@@ -231,11 +225,9 @@ public function testSetSaveHandler()
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
}
- /**
- * @expectedException \RuntimeException
- */
public function testStarted()
{
+ $this->expectException('RuntimeException');
$storage = $this->getStorage();
$this->assertFalse($storage->getSaveHandler()->isActive());
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 499a54a8ed7bf..dcd30036457f8 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
@@ -83,10 +83,10 @@ public function testName()
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
- * @expectedException \LogicException
*/
public function testNameException()
{
+ $this->expectException('LogicException');
session_start();
$this->proxy->setName('foo');
}
@@ -106,10 +106,10 @@ public function testId()
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
- * @expectedException \LogicException
*/
public function testIdException()
{
+ $this->expectException('LogicException');
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 63b3c8afb3a19..d6459e10d6f94 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -28,7 +28,7 @@ class SessionHandlerProxyTest extends TestCase
use ForwardCompatTestTrait;
/**
- * @var \PHPUnit_Framework_MockObject_Matcher
+ * @var \PHPUnit\Framework\MockObject\Matcher
*/
private $mock;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
index 62dfc9bc94a7b..96ab63d496bce 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
class StreamedResponseTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$response = new StreamedResponse(function () { echo 'foo'; }, 404, ['Content-Type' => 'text/plain']);
@@ -81,20 +84,16 @@ public function testSendContent()
$this->assertEquals(1, $called);
}
- /**
- * @expectedException \LogicException
- */
public function testSendContentWithNonCallable()
{
+ $this->expectException('LogicException');
$response = new StreamedResponse(null);
$response->sendContent();
}
- /**
- * @expectedException \LogicException
- */
public function testSetContent()
{
+ $this->expectException('LogicException');
$response = new StreamedResponse(function () { echo 'foo'; });
$response->setContent('foo');
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
index 3408d7acd6c0d..73e95473742f6 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Bundle;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
@@ -21,6 +22,8 @@
class BundleTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetContainerExtension()
{
$bundle = new ExtensionPresentBundle();
@@ -49,12 +52,10 @@ public function testRegisterCommands()
$this->assertNull($bundle2->registerCommands($app));
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface
- */
public function testGetContainerExtensionWithInvalidClass()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface');
$bundle = new ExtensionNotValidBundle();
$bundle->getContainerExtension();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
index 297ede6a36028..1f68e2c7f3ff0 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
@@ -13,10 +13,13 @@
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemPoolInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
class Psr6CacheClearerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testClearPoolsInjectedInConstructor()
{
$pool = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock();
@@ -37,12 +40,10 @@ public function testClearPool()
(new Psr6CacheClearer(['pool' => $pool]))->clearPool('pool');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Cache pool not found: unknown
- */
public function testClearPoolThrowsExceptionOnUnreferencedPool()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Cache pool not found: unknown');
(new Psr6CacheClearer())->clearPool('unknown');
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
index ea2c1788c47c8..8b11d90dfa7f5 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
@@ -39,11 +39,9 @@ public function testWriteCacheFileCreatesTheFile()
$this->assertFileExists(self::$cacheFile);
}
- /**
- * @expectedException \RuntimeException
- */
public function testWriteNonWritableCacheFileThrowsARuntimeException()
{
+ $this->expectException('RuntimeException');
$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/ArgumentResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
index 8fefbd7716928..be3670f5f4971 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
@@ -170,10 +170,10 @@ public function testGetVariadicArguments()
/**
* @requires PHP 5.6
- * @expectedException \InvalidArgumentException
*/
public function testGetVariadicArgumentsWithoutArrayInRequest()
{
+ $this->expectException('InvalidArgumentException');
$request = Request::create('/');
$request->attributes->set('foo', 'foo');
$request->attributes->set('bar', 'foo');
@@ -184,10 +184,10 @@ public function testGetVariadicArgumentsWithoutArrayInRequest()
/**
* @requires PHP 5.6
- * @expectedException \InvalidArgumentException
*/
public function testGetArgumentWithoutArray()
{
+ $this->expectException('InvalidArgumentException');
$factory = new ArgumentMetadataFactory();
$valueResolver = $this->getMockBuilder(ArgumentValueResolverInterface::class)->getMock();
$resolver = new ArgumentResolver($factory, [$valueResolver]);
@@ -202,11 +202,9 @@ public function testGetArgumentWithoutArray()
$resolver->getArguments($request, $controller);
}
- /**
- * @expectedException \RuntimeException
- */
public function testIfExceptionIsThrownWhenMissingAnArgument()
{
+ $this->expectException('RuntimeException');
$request = Request::create('/');
$controller = [$this, 'controllerWithFoo'];
@@ -269,11 +267,9 @@ public function testGetSessionArgumentsWithInterface()
$this->assertEquals([$session], self::$resolver->getArguments($request, $controller));
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetSessionMissMatchWithInterface()
{
+ $this->expectException('RuntimeException');
$session = $this->getMockBuilder(SessionInterface::class)->getMock();
$request = Request::create('/');
$request->setSession($session);
@@ -282,11 +278,9 @@ public function testGetSessionMissMatchWithInterface()
self::$resolver->getArguments($request, $controller);
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetSessionMissMatchWithImplementation()
{
+ $this->expectException('RuntimeException');
$session = new Session(new MockArraySessionStorage());
$request = Request::create('/');
$request->setSession($session);
@@ -295,11 +289,9 @@ public function testGetSessionMissMatchWithImplementation()
self::$resolver->getArguments($request, $controller);
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetSessionMissMatchOnNull()
{
+ $this->expectException('RuntimeException');
$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 ea26738e7c2ff..f10c806534b74 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
@@ -115,12 +115,10 @@ public function testNonInstantiableController()
$this->assertSame([NonInstantiableController::class, 'action'], $controller);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Controller "Symfony\Component\HttpKernel\Tests\Controller\ImpossibleConstructController" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?
- */
public function testNonConstructController()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Controller "Symfony\Component\HttpKernel\Tests\Controller\ImpossibleConstructController" 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->at(0))
->method('has')
@@ -182,12 +180,10 @@ public function testNonInstantiableControllerWithCorrespondingService()
$this->assertSame([$service, 'action'], $controller);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage 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"?
- */
public function testExceptionWhenUsingRemovedControllerService()
{
+ $this->expectException('LogicException');
+ $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->at(0))
->method('has')
@@ -208,12 +204,10 @@ public function testExceptionWhenUsingRemovedControllerService()
$resolver->getController($request);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Controller "app.my_controller" cannot be called without a method name. Did you forget an "__invoke" method?
- */
public function testExceptionWhenUsingControllerWithoutAnInvokeMethod()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Controller "app.my_controller" cannot be called without a method name. Did you forget an "__invoke" method?');
$container = $this->getMockBuilder(Container::class)->getMock();
$container->expects($this->once())
->method('has')
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
index 8912f151eb45f..6e48bf09abc8a 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
@@ -93,11 +93,9 @@ public function testGetControllerWithClassAndInvokeMethod()
$this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', $controller);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testGetControllerOnObjectWithoutInvokeMethod()
{
+ $this->expectException('InvalidArgumentException');
$resolver = $this->createControllerResolver();
$request = Request::create('/');
@@ -233,11 +231,11 @@ public function testCreateControllerCanReturnAnyCallable()
}
/**
- * @expectedException \RuntimeException
* @group legacy
*/
public function testIfExceptionIsThrownWhenMissingAnArgument()
{
+ $this->expectException('RuntimeException');
$resolver = new ControllerResolver();
$request = Request::create('/');
diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
index 05351445e00aa..fb6894bbf4f6e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\HttpKernel\Tests\ControllerMetadata;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
class ArgumentMetadataTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testWithBcLayerWithDefault()
{
$argument = new ArgumentMetadata('foo', 'string', false, true, 'default value');
@@ -32,11 +35,9 @@ public function testDefaultValueAvailable()
$this->assertSame('default value', $argument->getDefaultValue());
}
- /**
- * @expectedException \LogicException
- */
public function testDefaultValueUnavailable()
{
+ $this->expectException('LogicException');
$argument = new ArgumentMetadata('foo', 'string', false, false, null, false);
$this->assertFalse($argument->isNullable());
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
index 087c66659633c..9b49bd2d995ea 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -22,14 +23,15 @@
class FragmentRendererPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* Tests that content rendering not implementing FragmentRendererInterface
* triggers an exception.
- *
- * @expectedException \InvalidArgumentException
*/
public function testContentRendererWithoutInterface()
{
+ $this->expectException('InvalidArgumentException');
$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/RegisterControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
index 6d0da5fcf868c..b70d259e6e4ad 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@@ -25,12 +26,12 @@
class RegisterControllerArgumentLocatorsPassTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Class "Symfony\Component\HttpKernel\Tests\DependencyInjection\NotFound" used for service "foo" cannot be found.
- */
+ use ForwardCompatTestTrait;
+
public function testInvalidClass()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Class "Symfony\Component\HttpKernel\Tests\DependencyInjection\NotFound" used for service "foo" cannot be found.');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -42,12 +43,10 @@ public function testInvalidClass()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Missing "action" attribute on tag "controller.service_arguments" {"argument":"bar"} for service "foo".
- */
public function testNoAction()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Missing "action" attribute on tag "controller.service_arguments" {"argument":"bar"} for service "foo".');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -59,12 +58,10 @@ public function testNoAction()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Missing "argument" attribute on tag "controller.service_arguments" {"action":"fooAction"} for service "foo".
- */
public function testNoArgument()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Missing "argument" attribute on tag "controller.service_arguments" {"action":"fooAction"} for service "foo".');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -76,12 +73,10 @@ public function testNoArgument()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Missing "id" attribute on tag "controller.service_arguments" {"action":"fooAction","argument":"bar"} for service "foo".
- */
public function testNoService()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Missing "id" attribute on tag "controller.service_arguments" {"action":"fooAction","argument":"bar"} for service "foo".');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -93,12 +88,10 @@ public function testNoService()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid "action" attribute on tag "controller.service_arguments" for service "foo": no public "barAction()" method found on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController".
- */
public function testInvalidMethod()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid "action" attribute on tag "controller.service_arguments" for service "foo": no public "barAction()" method found on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController".');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -110,12 +103,10 @@ public function testInvalidMethod()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Invalid "controller.service_arguments" tag for service "foo": method "fooAction()" has no "baz" argument on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController".
- */
public function testInvalidArgument()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Invalid "controller.service_arguments" tag for service "foo": method "fooAction()" has no "baz" argument on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController".');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -207,12 +198,10 @@ public function testSkipSetContainer()
$this->assertSame(['foo:fooAction'], array_keys($locator));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClass". Did you forget to add a use statement?
- */
public function testExceptionOnNonExistentTypeHint()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClass". Did you forget to add a use statement?');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
@@ -223,12 +212,10 @@ public function testExceptionOnNonExistentTypeHint()
$pass->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- * @expectedExceptionMessage Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassDifferentNamespaceController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Acme\NonExistentClass".
- */
public function testExceptionOnNonExistentTypeHintDifferentNamespace()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassDifferentNamespaceController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Acme\NonExistentClass".');
$container = new ContainerBuilder();
$container->register('argument_resolver.service')->addArgument([]);
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
index 9b23ad003d758..5d4ce0b8c26d2 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -14,6 +15,8 @@
class ResettableServicePassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCompilerPass()
{
$container = new ContainerBuilder();
@@ -48,12 +51,10 @@ public function testCompilerPass()
);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage Tag kernel.reset requires the "method" attribute to be set.
- */
public function testMissingMethod()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('Tag kernel.reset requires the "method" attribute to be set.');
$container = new ContainerBuilder();
$container->register(ResettableService::class)
->addTag('kernel.reset');
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
index 6408b1b21c7e0..ee4a6a32f6e4c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\FragmentListener;
@@ -20,6 +21,8 @@
class FragmentListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testOnlyTriggeredOnFragmentRoute()
{
$request = Request::create('http://example.com/foo?_path=foo%3Dbar%26_controller%3Dfoo');
@@ -50,11 +53,9 @@ public function testOnlyTriggeredIfControllerWasNotDefinedYet()
$this->assertEquals($expected, $request->attributes->all());
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
- */
public function testAccessDeniedWithNonSafeMethods()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
$request = Request::create('http://example.com/_fragment', 'POST');
$listener = new FragmentListener(new UriSigner('foo'));
@@ -63,11 +64,9 @@ public function testAccessDeniedWithNonSafeMethods()
$listener->onKernelRequest($event);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
- */
public function testAccessDeniedWithWrongSignature()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
$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/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
index 94d7757f614f1..f1012f986d755 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
@@ -87,11 +87,9 @@ private function createGetResponseEventForUri($uri)
return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInvalidMatcher()
{
+ $this->expectException('InvalidArgumentException');
new RouterListener(new \stdClass(), $this->requestStack);
}
@@ -212,11 +210,9 @@ public function testNoRoutingConfigurationResponse()
$this->assertContains('Welcome', $response->getContent());
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- */
public function testRequestWithBadHost()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
$request = Request::create('http://bad host %22/');
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
index 709c601713855..b508a260b51f7 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
@@ -29,11 +29,9 @@ private function doTearDown()
Request::setTrustedProxies([], -1);
}
- /**
- * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
- */
public function testListenerThrowsWhenMasterRequestHasInconsistentClientIps()
{
+ $this->expectException('Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException');
$dispatcher = new EventDispatcher();
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
index 52d8551965a0d..e7fd92f562744 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;
@@ -20,6 +21,8 @@
class EsiFragmentRendererTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testRenderFallbackToInlineStrategyIfEsiNotSupported()
{
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true));
@@ -77,11 +80,9 @@ public function testRenderControllerReference()
);
}
- /**
- * @expectedException \LogicException
- */
public function testRenderControllerReferenceWithoutSignerThrowsException()
{
+ $this->expectException('LogicException');
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy());
$request = Request::create('/');
@@ -91,11 +92,9 @@ public function testRenderControllerReferenceWithoutSignerThrowsException()
$strategy->render(new ControllerReference('main_controller'), $request);
}
- /**
- * @expectedException \LogicException
- */
public function testRenderAltControllerReferenceWithoutSignerThrowsException()
{
+ $this->expectException('LogicException');
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy());
$request = Request::create('/');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
index b66041bcd23e7..ff76ad51008e8 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
@@ -39,31 +39,25 @@ private function doSetUp()
;
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRenderWhenRendererDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
$handler = new FragmentHandler($this->requestStack);
$handler->render('/', 'foo');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRenderWithUnknownRenderer()
{
+ $this->expectException('InvalidArgumentException');
$handler = $this->getHandler($this->returnValue(new Response('foo')));
$handler->render('/', 'bar');
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Error when rendering "http://localhost/" (Status code is 404).
- */
public function testDeliverWithUnsuccessfulResponse()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Error when rendering "http://localhost/" (Status code is 404).');
$handler = $this->getHandler($this->returnValue(new Response('foo', 404)));
$handler->render('/', 'foo');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
index 6125d95ff4ca8..8b5cafd66f2cb 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
@@ -19,11 +20,11 @@
class HIncludeFragmentRendererTest extends TestCase
{
- /**
- * @expectedException \LogicException
- */
+ use ForwardCompatTestTrait;
+
public function testRenderExceptionWhenControllerAndNoSigner()
{
+ $this->expectException('LogicException');
$strategy = new HIncludeFragmentRenderer();
$strategy->render(new ControllerReference('main_controller', [], []), Request::create('/'));
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
index b2a2dcaef6305..ac32c981ca6f9 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -25,6 +26,8 @@
class InlineFragmentRendererTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testRender()
{
$strategy = new InlineFragmentRenderer($this->getKernel($this->returnValue(new Response('foo'))));
@@ -111,11 +114,9 @@ public function testRenderWithTrustedHeaderDisabled()
Request::setTrustedProxies([], -1);
}
- /**
- * @expectedException \RuntimeException
- */
public function testRenderExceptionNoIgnoreErrors()
{
+ $this->expectException('RuntimeException');
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$dispatcher->expects($this->never())->method('dispatch');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
index c03e8c4a92334..dc4e59da83b6e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
class RoutableFragmentRendererTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getGenerateFragmentUriData
*/
@@ -56,11 +59,11 @@ public function testGenerateFragmentUriWithARequest()
}
/**
- * @expectedException \LogicException
- * @dataProvider getGenerateFragmentUriDataWithNonScalar
+ * @dataProvider getGenerateFragmentUriDataWithNonScalar
*/
public function testGenerateFragmentUriWithNonScalar($controller)
{
+ $this->expectException('LogicException');
$this->callGenerateFragmentUriMethod($controller, Request::create('/'));
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
index b2181725edfd6..fbf69610fbb48 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer;
@@ -20,6 +21,8 @@
class SsiFragmentRendererTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testRenderFallbackToInlineStrategyIfSsiNotSupported()
{
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy(true));
@@ -56,11 +59,9 @@ public function testRenderControllerReference()
);
}
- /**
- * @expectedException \LogicException
- */
public function testRenderControllerReferenceWithoutSignerThrowsException()
{
+ $this->expectException('LogicException');
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy());
$request = Request::create('/');
@@ -70,11 +71,9 @@ public function testRenderControllerReferenceWithoutSignerThrowsException()
$strategy->render(new ControllerReference('main_controller'), $request);
}
- /**
- * @expectedException \LogicException
- */
public function testRenderAltControllerReferenceWithoutSignerThrowsException()
{
+ $this->expectException('LogicException');
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy());
$request = Request::create('/');
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
index 1fc8da8e24530..0cc85a0d743b4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Esi;
class EsiTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHasSurrogateEsiCapability()
{
$esi = new Esi();
@@ -153,11 +156,9 @@ public function testProcessEscapesPhpTags()
$this->assertEquals('php cript language=php>', $response->getContent());
}
- /**
- * @expectedException \RuntimeException
- */
public function testProcessWhenNoSrcInAnEsi()
{
+ $this->expectException('RuntimeException');
$esi = new Esi();
$request = Request::create('/');
@@ -193,11 +194,9 @@ public function testHandle()
$this->assertEquals('foo', $esi->handle($cache, '/', '/alt', true));
}
- /**
- * @expectedException \RuntimeException
- */
public function testHandleWhenResponseIsNot200()
{
+ $this->expectException('RuntimeException');
$esi = new Esi();
$response = new Response('foo');
$response->setStatusCode(404);
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
index 79ed48cd00f7d..612dfc429e8f7 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Ssi;
class SsiTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHasSurrogateSsiCapability()
{
$ssi = new Ssi();
@@ -120,11 +123,9 @@ public function testProcessEscapesPhpTags()
$this->assertEquals('php cript language=php>', $response->getContent());
}
- /**
- * @expectedException \RuntimeException
- */
public function testProcessWhenNoSrcInAnSsi()
{
+ $this->expectException('RuntimeException');
$ssi = new Ssi();
$request = Request::create('/');
@@ -160,11 +161,9 @@ public function testHandle()
$this->assertEquals('foo', $ssi->handle($cache, '/', '/alt', true));
}
- /**
- * @expectedException \RuntimeException
- */
public function testHandleWhenResponseIsNot200()
{
+ $this->expectException('RuntimeException');
$ssi = new Ssi();
$response = new Response('foo');
$response->setStatusCode(404);
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
index 01e32898e2971..242dd8158dd8c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -30,21 +31,19 @@
class HttpKernelTest extends TestCase
{
- /**
- * @expectedException \RuntimeException
- */
+ use ForwardCompatTestTrait;
+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
{
+ $this->expectException('RuntimeException');
$kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); });
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
}
- /**
- * @expectedException \RuntimeException
- */
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered()
{
+ $this->expectException('RuntimeException');
$kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); });
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false);
@@ -177,11 +176,9 @@ public function testHandleWhenAListenerReturnsAResponse()
$this->assertEquals('hello', $kernel->handle(new Request())->getContent());
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
- */
public function testHandleWhenNoControllerIsFound()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\NotFoundHttpException');
$dispatcher = new EventDispatcher();
$kernel = $this->getHttpKernel($dispatcher, false);
@@ -229,11 +226,9 @@ public function testHandleWhenTheControllerIsAStaticArray()
$this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request()));
}
- /**
- * @expectedException \LogicException
- */
public function testHandleWhenTheControllerDoesNotReturnAResponse()
{
+ $this->expectException('LogicException');
$dispatcher = new EventDispatcher();
$kernel = $this->getHttpKernel($dispatcher, function () { return 'foo'; });
@@ -331,11 +326,9 @@ public function testVerifyRequestStackPushPopDuringHandle()
$kernel->handle($request, HttpKernelInterface::MASTER_REQUEST);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- */
public function testInconsistentClientIpsOnMasterRequests()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
$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 2682905eedc3b..50c0c091b690d 100644
--- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
@@ -391,35 +391,27 @@ public function testSerialize()
$this->assertEquals($expected, $kernel->serialize());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLocateResourceThrowsExceptionWhenNameIsNotValid()
{
+ $this->expectException('InvalidArgumentException');
$this->getKernel()->locateResource('Foo');
}
- /**
- * @expectedException \RuntimeException
- */
public function testLocateResourceThrowsExceptionWhenNameIsUnsafe()
{
+ $this->expectException('RuntimeException');
$this->getKernel()->locateResource('@FooBundle/../bar');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLocateResourceThrowsExceptionWhenBundleDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
$this->getKernel()->locateResource('@FooBundle/config/routing.xml');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist()
{
+ $this->expectException('InvalidArgumentException');
$kernel = $this->getKernel(['getBundle']);
$kernel
->expects($this->once())
@@ -675,11 +667,11 @@ public function testInitializeBundlesSupportInheritanceCascade()
/**
* @group legacy
- * @expectedException \LogicException
- * @expectedExceptionMessage Bundle "ChildCBundle" extends bundle "FooBar", which is not registered.
*/
public function testInitializeBundlesThrowsExceptionWhenAParentDoesNotExists()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Bundle "ChildCBundle" extends bundle "FooBar", which is not registered.');
$child = $this->getBundle(null, 'FooBar', 'ChildCBundle');
$kernel = $this->getKernel([], [$child]);
$kernel->boot();
@@ -711,11 +703,11 @@ public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder()
/**
* @group legacy
- * @expectedException \LogicException
- * @expectedExceptionMessage Bundle "ParentCBundle" is directly extended by two bundles "ChildC2Bundle" and "ChildC1Bundle".
*/
public function testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtendedByTwoBundles()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Bundle "ParentCBundle" is directly extended by two bundles "ChildC2Bundle" and "ChildC1Bundle".');
$parent = $this->getBundle(null, null, 'ParentCBundle');
$child1 = $this->getBundle(null, 'ParentCBundle', 'ChildC1Bundle');
$child2 = $this->getBundle(null, 'ParentCBundle', 'ChildC2Bundle');
@@ -726,11 +718,11 @@ public function testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtende
/**
* @group legacy
- * @expectedException \LogicException
- * @expectedExceptionMessage Trying to register two bundles with the same name "DuplicateName"
*/
public function testInitializeBundleThrowsExceptionWhenRegisteringTwoBundlesWithTheSameName()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Trying to register two bundles with the same name "DuplicateName"');
$fooBundle = $this->getBundle(null, null, 'FooBundle', 'DuplicateName');
$barBundle = $this->getBundle(null, null, 'BarBundle', 'DuplicateName');
@@ -740,11 +732,11 @@ public function testInitializeBundleThrowsExceptionWhenRegisteringTwoBundlesWith
/**
* @group legacy
- * @expectedException \LogicException
- * @expectedExceptionMessage Bundle "CircularRefBundle" can not extend itself.
*/
public function testInitializeBundleThrowsExceptionWhenABundleExtendsItself()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('Bundle "CircularRefBundle" can not extend itself.');
$circularRef = $this->getBundle(null, 'CircularRefBundle', 'CircularRefBundle');
$kernel = $this->getKernel([], [$circularRef]);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
index 26e9a99abdbe6..1c8c064c3de4f 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
@@ -110,27 +110,21 @@ public function testLogLevelDisabled()
$this->assertSame([], $this->getLogs());
}
- /**
- * @expectedException \Psr\Log\InvalidArgumentException
- */
public function testThrowsOnInvalidLevel()
{
+ $this->expectException('Psr\Log\InvalidArgumentException');
$this->logger->log('invalid level', 'Foo');
}
- /**
- * @expectedException \Psr\Log\InvalidArgumentException
- */
public function testThrowsOnInvalidMinLevel()
{
+ $this->expectException('Psr\Log\InvalidArgumentException');
new Logger('invalid');
}
- /**
- * @expectedException \Psr\Log\InvalidArgumentException
- */
public function testInvalidOutput()
{
+ $this->expectException('Psr\Log\InvalidArgumentException');
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 840d97532f09c..b0efe8ed32223 100644
--- a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
+++ b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
@@ -11,33 +11,30 @@
namespace Symfony\Component\Intl\Tests\Collator;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Collator\Collator;
use Symfony\Component\Intl\Globals\IntlGlobals;
class CollatorTest extends AbstractCollatorTest
{
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
+ use ForwardCompatTestTrait;
+
public function testConstructorWithUnsupportedLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
new Collator('pt_BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testCompare()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$collator = $this->getCollator('en');
$collator->compare('a', 'b');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetAttribute()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$collator = $this->getCollator('en');
$collator->getAttribute(Collator::NUMERIC_COLLATION);
}
@@ -66,38 +63,30 @@ public function testConstructWithoutLocale()
$this->assertInstanceOf('\Symfony\Component\Intl\Collator\Collator', $collator);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetSortKey()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$collator = $this->getCollator('en');
$collator->getSortKey('Hello');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetStrength()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$collator = $this->getCollator('en');
$collator->getStrength();
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetAttribute()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$collator = $this->getCollator('en');
$collator->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetStrength()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$collator = $this->getCollator('en');
$collator->setStrength(Collator::PRIMARY);
}
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 02f9830de4a47..f20da714b5dae 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
@@ -105,11 +105,9 @@ public function testReadExistingEntry()
$this->assertSame('Bar', $this->reader->readEntry(self::RES_DIR, 'root', ['Entries', 'Foo']));
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
- */
public function testReadNonExistingEntry()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->readerImpl->expects($this->once())
->method('read')
->with(self::RES_DIR, 'root')
@@ -133,11 +131,9 @@ public function testFallbackIfEntryDoesNotExist()
$this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam']));
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
- */
public function testDontFallbackIfEntryDoesNotExistAndFallbackDisabled()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->readerImpl->expects($this->once())
->method('read')
->with(self::RES_DIR, 'en_GB')
@@ -161,11 +157,9 @@ public function testFallbackIfLocaleDoesNotExist()
$this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam']));
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
- */
public function testDontFallbackIfLocaleDoesNotExistAndFallbackDisabled()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->readerImpl->expects($this->once())
->method('read')
->with(self::RES_DIR, 'en_GB')
@@ -293,11 +287,9 @@ public function testMergeExistingEntryWithNonExistingFallbackEntry($childData, $
$this->assertSame($childData, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true));
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
- */
public function testFailIfEntryFoundNeitherInParentNorChild()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->readerImpl->expects($this->at(0))
->method('read')
->with(self::RES_DIR, 'en_GB')
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 bf149d39d3810..08f2334d637d7 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
@@ -84,27 +84,21 @@ public function testReadDoesNotFollowFallbackAlias()
$this->assertArrayNotHasKey('ExistsNot', $data);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
- */
public function testReadFailsIfNonExistingLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
$this->reader->read(__DIR__.'/Fixtures/res', 'foo');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
- */
public function testReadFailsIfNonExistingFallbackLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
$this->reader->read(__DIR__.'/Fixtures/res', 'ro_AT');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
- */
public function testReadFailsIfNonExistingDirectory()
{
+ $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
$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 cf9dac64b5bfb..73697f0565f54 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -41,43 +41,33 @@ public function testReadReturnsArray()
$this->assertArrayNotHasKey('ExistsNot', $data);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
- */
public function testReadFailsIfNonExistingLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
$this->reader->read(__DIR__.'/Fixtures/json', 'foo');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
- */
public function testReadFailsIfNonExistingDirectory()
{
+ $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
$this->reader->read(__DIR__.'/foo', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
- */
public function testReadFailsIfNotAFile()
{
+ $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
- */
public function testReadFailsIfInvalidJson()
{
+ $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
$this->reader->read(__DIR__.'/Fixtures/json', 'en_Invalid');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
- */
public function testReaderDoesNotBreakOutOfGivenPath()
{
+ $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
$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 d4879b94793e2..300f860aa15a1 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -41,35 +41,27 @@ public function testReadReturnsArray()
$this->assertArrayNotHasKey('ExistsNot', $data);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
- */
public function testReadFailsIfNonExistingLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
$this->reader->read(__DIR__.'/Fixtures/php', 'foo');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
- */
public function testReadFailsIfNonExistingDirectory()
{
+ $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
$this->reader->read(__DIR__.'/foo', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
- */
public function testReadFailsIfNotAFile()
{
+ $this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
- */
public function testReaderDoesNotBreakOutOfGivenPath()
{
+ $this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
$this->reader->read(__DIR__.'/Fixtures/php', '../invalid_directory/en');
}
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
index 99000f5eff58d..a3ee95c8ff1bc 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
@@ -746,10 +746,10 @@ function ($value) { return [$value]; },
/**
* @dataProvider provideCurrenciesWithoutNumericEquivalent
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
*/
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->dataProvider->getNumericCode($currency);
}
@@ -791,10 +791,10 @@ function ($value) { return [$value]; },
/**
* @dataProvider provideInvalidNumericCodes
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
*/
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->dataProvider->forNumericCode($currency);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
index 0eda13fe4bd6a..2bbab217ab813 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
@@ -938,10 +938,10 @@ function ($value) { return [$value]; },
/**
* @dataProvider provideLanguagesWithoutAlpha3Equivalent
- * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
*/
public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($currency)
{
+ $this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
$this->dataProvider->getAlpha3Code($currency);
}
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
index 425c0bba04f70..b990a94362545 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
@@ -55,11 +55,9 @@ public function testWritePastBuffer()
$this->assertSame('bam', $this->buffer[2]);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException
- */
public function testReadNonExistingFails()
{
+ $this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
$this->buffer['foo'];
}
@@ -75,11 +73,9 @@ public function testUnsetNonExistingSucceeds()
$this->assertArrayNotHasKey('foo', $this->buffer);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException
- */
public function testReadOverwrittenFails()
{
+ $this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
$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 29f8918be8b7f..26816dcdb8e6e 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
@@ -11,11 +11,14 @@
namespace Symfony\Component\Intl\Tests\DateFormatter;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
use Symfony\Component\Intl\Globals\IntlGlobals;
class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$formatter = new IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, 'y-M-d');
@@ -34,11 +37,9 @@ public function testConstructorWithoutCalendar()
$this->assertEquals('y-M-d', $formatter->getPattern());
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
public function testConstructorWithUnsupportedLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
new IntlDateFormatter('pt_BR', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
}
@@ -73,21 +74,17 @@ public function testFormatWithUnsupportedTimestampArgument()
}
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
- */
public function testFormatWithUnimplementedChars()
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
$pattern = 'Y';
$formatter = new IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, $pattern);
$formatter->format(0);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
- */
public function testFormatWithNonIntegerTimestamp()
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
$formatter = $this->getDefaultDateFormatter();
$formatter->format([]);
}
@@ -110,56 +107,44 @@ public function testIsLenient()
$this->assertFalse($formatter->isLenient());
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testLocaltime()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getDefaultDateFormatter();
$formatter->localtime('Wednesday, December 31, 1969 4:00:00 PM PT');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException
- */
public function testParseWithNotNullPositionValue()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException');
$position = 0;
$formatter = $this->getDefaultDateFormatter('y');
$this->assertSame(0, $formatter->parse('1970', $position));
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetCalendar()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getDefaultDateFormatter();
$formatter->setCalendar(IntlDateFormatter::GREGORIAN);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
public function testSetLenient()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
$formatter = $this->getDefaultDateFormatter();
$formatter->setLenient(true);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
- */
public function testFormatWithGmtTimeZoneAndMinutesOffset()
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
parent::testFormatWithGmtTimeZoneAndMinutesOffset();
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
- */
public function testFormatWithNonStandardTimezone()
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
parent::testFormatWithNonStandardTimezone();
}
diff --git a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
index d087094da1d5c..b3b50a14c5388 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
@@ -11,21 +11,21 @@
namespace Symfony\Component\Intl\Tests\Locale;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class LocaleTest extends AbstractLocaleTest
{
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
+ use ForwardCompatTestTrait;
+
public function testAcceptFromHttp()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('acceptFromHttp', 'pt-br,en-us;q=0.7,en;q=0.5');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testComposeLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$subtags = [
'language' => 'pt',
'script' => 'Latn',
@@ -34,99 +34,75 @@ public function testComposeLocale()
$this->call('composeLocale', $subtags);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testFilterMatches()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('filterMatches', 'pt-BR', 'pt-BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetAllVariants()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getAllVariants', 'pt_BR_Latn');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetDisplayLanguage()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayLanguage', 'pt-Latn-BR', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetDisplayName()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayName', 'pt-Latn-BR', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetDisplayRegion()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayRegion', 'pt-Latn-BR', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetDisplayScript()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayScript', 'pt-Latn-BR', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetDisplayVariant()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayVariant', 'pt-Latn-BR', 'en');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetKeywords()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getKeywords', 'pt-BR@currency=BRL');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetPrimaryLanguage()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getPrimaryLanguage', 'pt-Latn-BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetRegion()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getRegion', 'pt-Latn-BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetScript()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getScript', 'pt-Latn-BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testLookup()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$langtag = [
'pt-Latn-BR',
'pt-BR',
@@ -134,19 +110,15 @@ public function testLookup()
$this->call('lookup', $langtag, 'pt-BR-x-priv1');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testParseLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('parseLocale', 'pt-Latn-BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetDefault()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('setDefault', 'pt_BR');
}
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
index 8e20c81f13f7a..8457364f38d15 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
@@ -23,44 +23,34 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
public function testConstructorWithUnsupportedLocale()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
new NumberFormatter('pt_BR');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
public function testConstructorWithUnsupportedStyle()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
new NumberFormatter('en', NumberFormatter::PATTERN_DECIMAL);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException
- */
public function testConstructorWithPatternDifferentThanNull()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException');
new NumberFormatter('en', NumberFormatter::DECIMAL, '');
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
public function testSetAttributeWithUnsupportedAttribute()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setAttribute(NumberFormatter::LENIENT_PARSE, null);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
- */
public function testSetAttributeInvalidRoundingMode()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setAttribute(NumberFormatter::ROUNDING_MODE, null);
}
@@ -81,73 +71,69 @@ public function testCreate()
);
}
- /**
- * @expectedException \RuntimeException
- */
public function testFormatWithCurrencyStyle()
{
+ $this->expectException('RuntimeException');
parent::testFormatWithCurrencyStyle();
}
/**
* @dataProvider formatTypeInt32Provider
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
*/
public function testFormatTypeInt32($formatter, $value, $expected, $message = '')
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
parent::testFormatTypeInt32($formatter, $value, $expected, $message);
}
/**
* @dataProvider formatTypeInt32WithCurrencyStyleProvider
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
*/
public function testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message = '')
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
parent::testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message);
}
/**
* @dataProvider formatTypeInt64Provider
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
*/
public function testFormatTypeInt64($formatter, $value, $expected)
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
parent::testFormatTypeInt64($formatter, $value, $expected);
}
/**
* @dataProvider formatTypeInt64WithCurrencyStyleProvider
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
*/
public function testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected)
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
parent::testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected);
}
/**
* @dataProvider formatTypeDoubleProvider
- * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
*/
public function testFormatTypeDouble($formatter, $value, $expected)
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
parent::testFormatTypeDouble($formatter, $value, $expected);
}
/**
* @dataProvider formatTypeDoubleWithCurrencyStyleProvider
- * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException
*/
public function testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected)
{
+ $this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
parent::testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testGetPattern()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->getPattern();
}
@@ -158,38 +144,30 @@ public function testGetErrorCode()
$this->assertEquals(IntlGlobals::U_ZERO_ERROR, $formatter->getErrorCode());
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testParseCurrency()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parseCurrency(null, $currency);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetPattern()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setPattern(null);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetSymbol()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setSymbol(null, null);
}
- /**
- * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
- */
public function testSetTextAttribute()
{
+ $this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->setTextAttribute(null, null);
}
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
index 0617762ed6f08..8c9b1575114e2 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
@@ -11,18 +11,19 @@
namespace Symfony\Component\Ldap\Tests\Adapter\ExtLdap;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\ExtLdap\Connection;
use Symfony\Component\Ldap\Adapter\ExtLdap\EntryManager;
use Symfony\Component\Ldap\Entry;
class EntryManagerTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Ldap\Exception\NotBoundException
- * @expectedExceptionMessage Query execution is not possible without binding the connection first.
- */
+ use ForwardCompatTestTrait;
+
public function testGetResources()
{
+ $this->expectException('Symfony\Component\Ldap\Exception\NotBoundException');
+ $this->expectExceptionMessage('Query execution is not possible without binding the connection first.');
$connection = $this->getMockBuilder(Connection::class)->getMock();
$connection
->expects($this->once())
diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php
index f461311db0ede..6b060bd088c3a 100644
--- a/src/Symfony/Component/Lock/Tests/LockTest.php
+++ b/src/Symfony/Component/Lock/Tests/LockTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Lock;
@@ -23,6 +24,8 @@
*/
class LockTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testAcquireNoBlocking()
{
$key = new Key(uniqid(__METHOD__, true));
@@ -170,11 +173,9 @@ public function testNoAutoReleaseWhenNotConfigured()
unset($lock);
}
- /**
- * @expectedException \Symfony\Component\Lock\Exception\LockReleasingException
- */
public function testReleaseThrowsExceptionIfNotWellDeleted()
{
+ $this->expectException('Symfony\Component\Lock\Exception\LockReleasingException');
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);
@@ -193,11 +194,9 @@ public function testReleaseThrowsExceptionIfNotWellDeleted()
$lock->release();
}
- /**
- * @expectedException \Symfony\Component\Lock\Exception\LockReleasingException
- */
public function testReleaseThrowsAndLog()
{
+ $this->expectException('Symfony\Component\Lock\Exception\LockReleasingException');
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::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 688620b677d46..a9f6c3c3df514 100644
--- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
@@ -69,11 +69,9 @@ private function doSetUp()
$this->store = new CombinedStore([$this->store1, $this->store2], $this->strategy);
}
- /**
- * @expectedException \Symfony\Component\Lock\Exception\LockConflictedException
- */
public function testSaveThrowsExceptionOnFailure()
{
+ $this->expectException('Symfony\Component\Lock\Exception\LockConflictedException');
$key = new Key(uniqid(__METHOD__, true));
$this->store1
@@ -166,11 +164,9 @@ public function testSaveAbortWhenStrategyCantBeMet()
}
}
- /**
- * @expectedException \Symfony\Component\Lock\Exception\LockConflictedException
- */
public function testputOffExpirationThrowsExceptionOnFailure()
{
+ $this->expectException('Symfony\Component\Lock\Exception\LockConflictedException');
$key = new Key(uniqid(__METHOD__, true));
$ttl = random_int(1, 10);
diff --git a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
index bc96ff66f5dfb..32ce98f08c71f 100644
--- a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
+++ b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Exception\LockExpiredException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\StoreInterface;
@@ -20,6 +21,8 @@
*/
trait ExpiringStoreTestTrait
{
+ use ForwardCompatTestTrait;
+
/**
* Amount of microseconds used as a delay to test expiration. Should be
* small enough not to slow the test suite too much, and high enough not to
@@ -57,11 +60,10 @@ public function testExpiration()
/**
* Tests the store thrown exception when TTL expires.
- *
- * @expectedException \Symfony\Component\Lock\Exception\LockExpiredException
*/
public function testAbortAfterExpiration()
{
+ $this->expectException('\Symfony\Component\Lock\Exception\LockExpiredException');
$key = new Key(uniqid(__METHOD__, true));
/** @var StoreInterface $store */
diff --git a/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php
index ef3650c3124b5..42f88390db891 100644
--- a/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Store\FlockStore;
@@ -19,6 +20,7 @@
*/
class FlockStoreTest extends AbstractStoreTest
{
+ use ForwardCompatTestTrait;
use BlockingStoreTestTrait;
/**
@@ -29,12 +31,10 @@ protected function getStore()
return new FlockStore();
}
- /**
- * @expectedException \Symfony\Component\Lock\Exception\InvalidArgumentException
- * @expectedExceptionMessage The directory "/a/b/c/d/e" is not writable.
- */
public function testConstructWhenRepositoryDoesNotExist()
{
+ $this->expectException('Symfony\Component\Lock\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The directory "/a/b/c/d/e" is not writable.');
if (!getenv('USER') || 'root' === getenv('USER')) {
$this->markTestSkipped('This test will fail if run under superuser');
}
@@ -42,12 +42,10 @@ public function testConstructWhenRepositoryDoesNotExist()
new FlockStore('/a/b/c/d/e');
}
- /**
- * @expectedException \Symfony\Component\Lock\Exception\InvalidArgumentException
- * @expectedExceptionMessage The directory "/" is not writable.
- */
public function testConstructWhenRepositoryIsNotWriteable()
{
+ $this->expectException('Symfony\Component\Lock\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The directory "/" is not writable.');
if (!getenv('USER') || 'root' === getenv('USER')) {
$this->markTestSkipped('This test will fail if run under superuser');
}
diff --git a/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php b/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
index 8dd7997ddf780..208fdba04d028 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\OptionsResolver\Tests\Debug;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OptionsResolverIntrospectorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetDefault()
{
$resolver = new OptionsResolver();
@@ -36,12 +39,10 @@ public function testGetDefaultNull()
$this->assertNull($debug->getDefault($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
- * @expectedExceptionMessage No default value was set for the "foo" option.
- */
public function testGetDefaultThrowsOnNoConfiguredValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectExceptionMessage('No default value was set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -49,12 +50,10 @@ public function testGetDefaultThrowsOnNoConfiguredValue()
$this->assertSame('bar', $debug->getDefault($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The option "foo" does not exist.
- */
public function testGetDefaultThrowsOnNotDefinedOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver);
@@ -71,12 +70,10 @@ public function testGetLazyClosures()
$this->assertSame($closures, $debug->getLazyClosures($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
- * @expectedExceptionMessage No lazy closures were set for the "foo" option.
- */
public function testGetLazyClosuresThrowsOnNoConfiguredValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectExceptionMessage('No lazy closures were set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -84,12 +81,10 @@ public function testGetLazyClosuresThrowsOnNoConfiguredValue()
$this->assertSame('bar', $debug->getLazyClosures($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The option "foo" does not exist.
- */
public function testGetLazyClosuresThrowsOnNotDefinedOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver);
@@ -106,12 +101,10 @@ public function testGetAllowedTypes()
$this->assertSame($allowedTypes, $debug->getAllowedTypes($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
- * @expectedExceptionMessage No allowed types were set for the "foo" option.
- */
public function testGetAllowedTypesThrowsOnNoConfiguredValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectExceptionMessage('No allowed types were set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -119,12 +112,10 @@ public function testGetAllowedTypesThrowsOnNoConfiguredValue()
$this->assertSame('bar', $debug->getAllowedTypes($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The option "foo" does not exist.
- */
public function testGetAllowedTypesThrowsOnNotDefinedOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver);
@@ -141,12 +132,10 @@ public function testGetAllowedValues()
$this->assertSame($allowedValues, $debug->getAllowedValues($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
- * @expectedExceptionMessage No allowed values were set for the "foo" option.
- */
public function testGetAllowedValuesThrowsOnNoConfiguredValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectExceptionMessage('No allowed values were set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -154,12 +143,10 @@ public function testGetAllowedValuesThrowsOnNoConfiguredValue()
$this->assertSame('bar', $debug->getAllowedValues($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The option "foo" does not exist.
- */
public function testGetAllowedValuesThrowsOnNotDefinedOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver);
@@ -176,12 +163,10 @@ public function testGetNormalizer()
$this->assertSame($normalizer, $debug->getNormalizer($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
- * @expectedExceptionMessage No normalizer was set for the "foo" option.
- */
public function testGetNormalizerThrowsOnNoConfiguredValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException');
+ $this->expectExceptionMessage('No normalizer was set for the "foo" option.');
$resolver = new OptionsResolver();
$resolver->setDefined($option = 'foo');
@@ -189,12 +174,10 @@ public function testGetNormalizerThrowsOnNoConfiguredValue()
$this->assertSame('bar', $debug->getNormalizer($option));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The option "foo" does not exist.
- */
public function testGetNormalizerThrowsOnNotDefinedOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The option "foo" does not exist.');
$resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver);
diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
index 2f69cc14deec5..c32a8b31e5a49 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
@@ -32,35 +32,29 @@ private function doSetUp()
$this->resolver = new OptionsResolver();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The option "foo" does not exist. Defined options are: "a", "z".
- */
public function testResolveFailsIfNonExistingOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The option "foo" does not exist. Defined options are: "a", "z".');
$this->resolver->setDefault('z', '1');
$this->resolver->setDefault('a', '2');
$this->resolver->resolve(['foo' => 'bar']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- * @expectedExceptionMessage The options "baz", "foo", "ping" do not exist. Defined options are: "a", "z".
- */
public function testResolveFailsIfMultipleNonExistingOptions()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
+ $this->expectExceptionMessage('The options "baz", "foo", "ping" do not exist. Defined options are: "a", "z".');
$this->resolver->setDefault('z', '1');
$this->resolver->setDefault('a', '2');
$this->resolver->resolve(['ping' => 'pong', 'foo' => 'bar', 'baz' => 'bam']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testResolveFailsFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->resolve([]);
});
@@ -84,11 +78,9 @@ public function testSetDefault()
], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetDefaultFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('lazy', function (Options $options) {
$options->setDefault('default', 42);
});
@@ -228,11 +220,9 @@ public function testSetRequiredReturnsThis()
$this->assertSame($this->resolver, $this->resolver->setRequired('foo'));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetRequiredFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->setRequired('bar');
});
@@ -240,11 +230,9 @@ public function testFailIfSetRequiredFromLazyOption()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\MissingOptionsException
- */
public function testResolveFailsIfRequiredOptionMissing()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\MissingOptionsException');
$this->resolver->setRequired('foo');
$this->resolver->resolve();
@@ -356,11 +344,9 @@ public function testGetMissingOptions()
$this->assertSame(['bar'], $this->resolver->getMissingOptions());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetDefinedFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->setDefined('bar');
});
@@ -453,11 +439,9 @@ public function testClearedOptionsAreNotDefined()
$this->assertFalse($this->resolver->isDefined('foo'));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- */
public function testSetAllowedTypesFailsIfUnknownOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
$this->resolver->setAllowedTypes('foo', 'string');
}
@@ -470,11 +454,9 @@ public function testResolveTypedArray()
$this->assertSame(['foo' => ['bar', 'baz']], $options);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetAllowedTypesFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->setAllowedTypes('bar', 'string');
});
@@ -484,36 +466,30 @@ public function testFailIfSetAllowedTypesFromLazyOption()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime[]".
- */
public function testResolveFailsIfInvalidTypedArray()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime[]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[]');
$this->resolver->resolve(['foo' => [new \DateTime()]]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value "bar" is expected to be of type "int[]", but is of type "string".
- */
public function testResolveFailsWithNonArray()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value "bar" is expected to be of type "int[]", but is of type "string".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[]');
$this->resolver->resolve(['foo' => 'bar']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass[]".
- */
public function testResolveFailsIfTypedArrayContainsInvalidTypes()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass[]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[]');
$values = range(1, 5);
@@ -525,12 +501,10 @@ public function testResolveFailsIfTypedArrayContainsInvalidTypes()
$this->resolver->resolve(['foo' => $values]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double[][]".
- */
public function testResolveFailsWithCorrectLevelsButWrongScalar()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');
@@ -577,12 +551,10 @@ public function testResolveSucceedsIfValidType()
$this->assertNotEmpty($this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value 42 is expected to be of type "string" or "bool", but is of type "integer".
- */
public function testResolveFailsIfInvalidTypeMultiple()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value 42 is expected to be of type "string" or "bool", but is of type "integer".');
$this->resolver->setDefault('foo', 42);
$this->resolver->setAllowedTypes('foo', ['string', 'bool']);
@@ -620,30 +592,24 @@ public function testResolveSucceedsIfTypedArray()
$this->assertEquals($data, $result);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfNotInstanceOfClass()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 'bar');
$this->resolver->setAllowedTypes('foo', '\stdClass');
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- */
public function testAddAllowedTypesFailsIfUnknownOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
$this->resolver->addAllowedTypes('foo', 'string');
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfAddAllowedTypesFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->addAllowedTypes('bar', 'string');
});
@@ -653,11 +619,9 @@ public function testFailIfAddAllowedTypesFromLazyOption()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfInvalidAddedType()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->addAllowedTypes('foo', 'string');
@@ -672,11 +636,9 @@ public function testResolveSucceedsIfValidAddedType()
$this->assertNotEmpty($this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfInvalidAddedTypeMultiple()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->addAllowedTypes('foo', ['string', 'bool']);
@@ -713,19 +675,15 @@ public function testAddAllowedTypesDoesNotOverwrite2()
$this->assertNotEmpty($this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- */
public function testSetAllowedValuesFailsIfUnknownOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
$this->resolver->setAllowedValues('foo', 'bar');
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetAllowedValuesFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->setAllowedValues('bar', 'baz');
});
@@ -735,35 +693,29 @@ public function testFailIfSetAllowedValuesFromLazyOption()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value 42 is invalid. Accepted values are: "bar".
- */
public function testResolveFailsIfInvalidValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value 42 is invalid. Accepted values are: "bar".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedValues('foo', 'bar');
$this->resolver->resolve(['foo' => 42]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value null is invalid. Accepted values are: "bar".
- */
public function testResolveFailsIfInvalidValueIsNull()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value null is invalid. Accepted values are: "bar".');
$this->resolver->setDefault('foo', null);
$this->resolver->setAllowedValues('foo', 'bar');
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfInvalidValueStrict()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->setAllowedValues('foo', '42');
@@ -786,12 +738,10 @@ public function testResolveSucceedsIfValidValueIsNull()
$this->assertEquals(['foo' => null], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value 42 is invalid. Accepted values are: "bar", false, null.
- */
public function testResolveFailsIfInvalidValueMultiple()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value 42 is invalid. Accepted values are: "bar", false, null.');
$this->resolver->setDefault('foo', 42);
$this->resolver->setAllowedValues('foo', ['bar', false, null]);
@@ -837,11 +787,9 @@ public function testResolveSucceedsIfClosureReturnsTrue()
$this->assertSame('bar', $passedValue);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfAllClosuresReturnFalse()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->setAllowedValues('foo', [
function () { return false; },
@@ -864,19 +812,15 @@ function () { return false; },
$this->assertEquals(['foo' => 'bar'], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- */
public function testAddAllowedValuesFailsIfUnknownOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
$this->resolver->addAllowedValues('foo', 'bar');
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfAddAllowedValuesFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->addAllowedValues('bar', 'baz');
});
@@ -886,11 +830,9 @@ public function testFailIfAddAllowedValuesFromLazyOption()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfInvalidAddedValue()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->addAllowedValues('foo', 'bar');
@@ -913,11 +855,9 @@ public function testResolveSucceedsIfValidAddedValueIsNull()
$this->assertEquals(['foo' => null], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfInvalidAddedValueMultiple()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->addAllowedValues('foo', ['bar', 'baz']);
@@ -950,11 +890,9 @@ public function testAddAllowedValuesDoesNotOverwrite2()
$this->assertEquals(['foo' => 'baz'], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testResolveFailsIfAllAddedClosuresReturnFalse()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 42);
$this->resolver->setAllowedValues('foo', function () { return false; });
$this->resolver->addAllowedValues('foo', function () { return false; });
@@ -996,19 +934,15 @@ public function testSetNormalizerClosure()
$this->assertEquals(['foo' => 'normalized'], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
- */
public function testSetNormalizerFailsIfUnknownOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
$this->resolver->setNormalizer('foo', function () {});
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetNormalizerFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->setNormalizer('foo', function () {});
});
@@ -1042,11 +976,9 @@ public function testNormalizerReceivesPassedOption()
$this->assertEquals(['foo' => 'normalized[baz]'], $resolved);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testValidateTypeBeforeNormalization()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 'bar');
$this->resolver->setAllowedTypes('foo', 'int');
@@ -1058,11 +990,9 @@ public function testValidateTypeBeforeNormalization()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- */
public function testValidateValueBeforeNormalization()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->resolver->setDefault('foo', 'bar');
$this->resolver->setAllowedValues('foo', 'baz');
@@ -1112,11 +1042,9 @@ public function testNormalizerCanAccessLazyOptions()
], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
- */
public function testFailIfCyclicDependencyBetweenNormalizers()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException');
$this->resolver->setDefault('norm1', 'bar');
$this->resolver->setDefault('norm2', 'baz');
@@ -1131,11 +1059,9 @@ public function testFailIfCyclicDependencyBetweenNormalizers()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
- */
public function testFailIfCyclicDependencyBetweenNormalizerAndLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException');
$this->resolver->setDefault('lazy', function (Options $options) {
$options['norm'];
});
@@ -1253,11 +1179,9 @@ public function testSetDefaults()
], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfSetDefaultsFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->setDefaults(['two' => '2']);
});
@@ -1334,11 +1258,9 @@ public function testRemoveAllowedValues()
$this->assertSame(['foo' => 'bar'], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfRemoveFromLazyOption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->remove('bar');
});
@@ -1410,11 +1332,9 @@ public function testClearAllowedValues()
$this->assertSame(['foo' => 'bar'], $this->resolver->resolve());
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testFailIfClearFromLazyption()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', function (Options $options) {
$options->clear();
});
@@ -1469,50 +1389,40 @@ public function testArrayAccess()
$this->resolver->resolve(['default2' => 42, 'required' => 'value']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testArrayAccessGetFailsOutsideResolve()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('default', 0);
$this->resolver['default'];
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testArrayAccessExistsFailsOutsideResolve()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('default', 0);
isset($this->resolver['default']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testArrayAccessSetNotSupported()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver['default'] = 0;
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
- */
public function testArrayAccessUnsetNotSupported()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('default', 0);
unset($this->resolver['default']);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
- * @expectedExceptionMessage The option "undefined" does not exist. Defined options are: "foo", "lazy".
- */
public function testFailIfGetNonExisting()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoSuchOptionException');
+ $this->expectExceptionMessage('The option "undefined" does not exist. Defined options are: "foo", "lazy".');
$this->resolver->setDefault('foo', 'bar');
$this->resolver->setDefault('lazy', function (Options $options) {
@@ -1522,12 +1432,10 @@ public function testFailIfGetNonExisting()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
- * @expectedExceptionMessage The optional option "defined" has no value set. You should make sure it is set with "isset" before reading it.
- */
public function testFailIfGetDefinedButUnset()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\NoSuchOptionException');
+ $this->expectExceptionMessage('The optional option "defined" has no value set. You should make sure it is set with "isset" before reading it.');
$this->resolver->setDefined('defined');
$this->resolver->setDefault('lazy', function (Options $options) {
@@ -1537,11 +1445,9 @@ public function testFailIfGetDefinedButUnset()
$this->resolver->resolve();
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
- */
public function testFailIfCyclicDependency()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException');
$this->resolver->setDefault('lazy1', function (Options $options) {
$options['lazy2'];
});
@@ -1571,11 +1477,10 @@ public function testCount()
* In resolve() we count the options that are actually set (which may be
* only a subset of the defined options). Outside of resolve(), it's not
* clear what is counted.
- *
- * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
*/
public function testCountFailsOutsideResolve()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException');
$this->resolver->setDefault('foo', 0);
$this->resolver->setRequired('bar');
$this->resolver->setDefined('bar');
@@ -1630,12 +1535,10 @@ public function testNested2Arrays()
));
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer[][][][]".
- */
public function testNestedArraysException()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer[][][][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
@@ -1650,12 +1553,10 @@ public function testNestedArraysException()
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".
- */
public function testNestedArrayException1()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');
$this->resolver->resolve([
@@ -1665,12 +1566,10 @@ public function testNestedArrayException1()
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".
- */
public function testNestedArrayException2()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');
$this->resolver->resolve([
@@ -1680,12 +1579,10 @@ public function testNestedArrayException2()
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string[][]".
- */
public function testNestedArrayException3()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'string[][][]');
$this->resolver->resolve([
@@ -1695,12 +1592,10 @@ public function testNestedArrayException3()
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer[][][]".
- */
public function testNestedArrayException4()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer[][][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'string[][][]');
$this->resolver->resolve([
@@ -1711,12 +1606,10 @@ public function testNestedArrayException4()
]);
}
- /**
- * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
- * @expectedExceptionMessage The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array[]".
- */
public function testNestedArrayException5()
{
+ $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array[]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'string[]');
$this->resolver->resolve([
diff --git a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
index 349b197a415b6..2a2379694b091 100644
--- a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\ProcessBuilder;
/**
@@ -19,6 +20,8 @@
*/
class ProcessBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testInheritEnvironmentVars()
{
$proc = ProcessBuilder::create()
@@ -52,11 +55,9 @@ public function testAddEnvironmentVariables()
$this->assertSame($env, $proc->getEnv());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
- */
public function testNegativeTimeoutFromSetter()
{
+ $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
$pb = new ProcessBuilder();
$pb->setTimeout(-1);
}
@@ -149,11 +150,9 @@ public function testShouldEscapeArgumentsAndPrefix()
}
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- */
public function testShouldThrowALogicExceptionIfNoPrefixAndNoArgument()
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
ProcessBuilder::create()->getProcess();
}
@@ -201,12 +200,10 @@ public function testShouldReturnProcessWithEnabledOutput()
$this->assertFalse($process->isOutputDisabled());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
- * @expectedExceptionMessage Symfony\Component\Process\ProcessBuilder::setInput only accepts strings, Traversable objects or stream resources.
- */
public function testInvalidInput()
{
+ $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Symfony\Component\Process\ProcessBuilder::setInput only accepts strings, Traversable objects or stream resources.');
$builder = ProcessBuilder::create();
$builder->setInput([]);
}
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index a8d21b354caac..4145924df4a32 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -82,19 +82,15 @@ public function testThatProcessDoesNotThrowWarningDuringRun()
$this->assertEquals(E_USER_NOTICE, $actualError['type']);
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
- */
public function testNegativeTimeoutFromConstructor()
{
+ $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
$this->getProcess('', null, null, null, -1);
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
- */
public function testNegativeTimeoutFromSetter()
{
+ $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
$p = $this->getProcess('');
$p->setTimeout(-1);
}
@@ -247,12 +243,10 @@ public function testLiveStreamAsInput()
$this->assertSame('hello', $p->getOutput());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- * @expectedExceptionMessage Input can not be set while the process is running.
- */
public function testSetInputWhileRunningThrowsAnException()
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage('Input can not be set while the process is running.');
$process = $this->getProcessForCode('sleep(30);');
$process->start();
try {
@@ -268,11 +262,11 @@ public function testSetInputWhileRunningThrowsAnException()
/**
* @dataProvider provideInvalidInputValues
- * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
- * @expectedExceptionMessage Symfony\Component\Process\Process::setInput only accepts strings, Traversable objects or stream resources.
*/
public function testInvalidInput($value)
{
+ $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Symfony\Component\Process\Process::setInput only accepts strings, Traversable objects or stream resources.');
$process = $this->getProcess('foo');
$process->setInput($value);
}
@@ -479,12 +473,10 @@ public function testTTYCommandExitCode()
$this->assertTrue($process->isSuccessful());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\RuntimeException
- * @expectedExceptionMessage TTY mode is not supported on Windows platform.
- */
public function testTTYInWindowsEnvironment()
{
+ $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectExceptionMessage('TTY mode is not supported on Windows platform.');
if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test is for Windows platform only');
}
@@ -534,11 +526,9 @@ public function testSuccessfulMustRunHasCorrectExitCode()
$this->assertEquals(0, $process->getExitCode());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\ProcessFailedException
- */
public function testMustRunThrowsException()
{
+ $this->expectException('Symfony\Component\Process\Exception\ProcessFailedException');
$this->skipIfNotEnhancedSigchild();
$process = $this->getProcess('exit 1');
@@ -707,12 +697,10 @@ public function testProcessIsSignaledIfStopped()
$this->assertEquals(15, $process->getTermSignal()); // SIGTERM
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\RuntimeException
- * @expectedExceptionMessage The process has been signaled
- */
public function testProcessThrowsExceptionWhenExternallySignaled()
{
+ $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectExceptionMessage('The process has been signaled');
if (!\function_exists('posix_kill')) {
$this->markTestSkipped('Function posix_kill is required.');
}
@@ -743,12 +731,10 @@ public function testRestart()
$this->assertNotEquals($process1->getOutput(), $process2->getOutput());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
- * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
- */
public function testRunProcessWithTimeout()
{
+ $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(30);');
$process->setTimeout(0.1);
$start = microtime(true);
@@ -763,12 +749,10 @@ public function testRunProcessWithTimeout()
throw $e;
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
- * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
- */
public function testIterateOverProcessWithTimeout()
{
+ $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(30);');
$process->setTimeout(0.1);
$start = microtime(true);
@@ -797,12 +781,10 @@ public function testCheckTimeoutOnTerminatedProcess()
$this->assertNull($process->checkTimeout());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
- * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
- */
public function testCheckTimeoutOnStartedProcess()
{
+ $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(33);');
$process->setTimeout(0.1);
@@ -862,12 +844,10 @@ public function testIdleTimeoutNotExceededWhenOutputIsSent()
}
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
- * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
- */
public function testStartAfterATimeout()
{
+ $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
+ $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
$process = $this->getProcessForCode('sleep(35);');
$process->setTimeout(0.1);
@@ -943,12 +923,10 @@ public function testExitCodeIsAvailableAfterSignal()
$this->assertEquals(137, $process->getExitCode());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- * @expectedExceptionMessage Can not send signal on a non running process.
- */
public function testSignalProcessNotRunning()
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage('Can not send signal on a non running process.');
$process = $this->getProcess('foo');
$process->signal(1); // SIGHUP
}
@@ -979,11 +957,11 @@ public function provideMethodsThatNeedARunningProcess()
/**
* @dataProvider provideMethodsThatNeedATerminatedProcess
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- * @expectedExceptionMessage Process must be terminated before calling
*/
public function testMethodsThatNeedATerminatedProcess($method)
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage('Process must be terminated before calling');
$process = $this->getProcessForCode('sleep(37);');
$process->start();
try {
@@ -1009,10 +987,10 @@ public function provideMethodsThatNeedATerminatedProcess()
/**
* @dataProvider provideWrongSignal
- * @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
public function testWrongSignal($signal)
{
+ $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('POSIX signals do not work on Windows');
}
@@ -1047,23 +1025,19 @@ public function testDisableOutputDisablesTheOutput()
$this->assertFalse($p->isOutputDisabled());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\RuntimeException
- * @expectedExceptionMessage Disabling output while the process is running is not possible.
- */
public function testDisableOutputWhileRunningThrowsException()
{
+ $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectExceptionMessage('Disabling output while the process is running is not possible.');
$p = $this->getProcessForCode('sleep(39);');
$p->start();
$p->disableOutput();
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\RuntimeException
- * @expectedExceptionMessage Enabling output while the process is running is not possible.
- */
public function testEnableOutputWhileRunningThrowsException()
{
+ $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
+ $this->expectExceptionMessage('Enabling output while the process is running is not possible.');
$p = $this->getProcessForCode('sleep(40);');
$p->disableOutput();
$p->start();
@@ -1080,23 +1054,19 @@ public function testEnableOrDisableOutputAfterRunDoesNotThrowException()
$this->assertTrue($p->isOutputDisabled());
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- * @expectedExceptionMessage Output can not be disabled while an idle timeout is set.
- */
public function testDisableOutputWhileIdleTimeoutIsSet()
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage('Output can not be disabled while an idle timeout is set.');
$process = $this->getProcess('foo');
$process->setIdleTimeout(1);
$process->disableOutput();
}
- /**
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- * @expectedExceptionMessage timeout can not be set while the output is disabled.
- */
public function testSetIdleTimeoutWhileOutputIsDisabled()
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage('timeout can not be set while the output is disabled.');
$process = $this->getProcess('foo');
$process->disableOutput();
$process->setIdleTimeout(1);
@@ -1111,11 +1081,11 @@ public function testSetNullIdleTimeoutWhileOutputIsDisabled()
/**
* @dataProvider provideOutputFetchingMethods
- * @expectedException \Symfony\Component\Process\Exception\LogicException
- * @expectedExceptionMessage Output has been disabled.
*/
public function testGetOutputWhileDisabled($fetchMethod)
{
+ $this->expectException('Symfony\Component\Process\Exception\LogicException');
+ $this->expectExceptionMessage('Output has been disabled.');
$p = $this->getProcessForCode('sleep(41);');
$p->disableOutput();
$p->start();
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
index 5749cfae6fc0d..071f70d360bfd 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
@@ -48,11 +48,9 @@ public function testGetValue($collection, $path, $value)
$this->assertSame($value, $this->propertyAccessor->getValue($collection, $path));
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
- */
public function testGetValueFailsIfNoSuchIndex()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchIndexException');
$this->propertyAccessor = PropertyAccess::createPropertyAccessorBuilder()
->enableExceptionOnInvalidIndex()
->getPropertyAccessor();
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
index f23239193e1ea..9c3d79a77a100 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
@@ -11,8 +11,12 @@
namespace Symfony\Component\PropertyAccess\Tests;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
+
class PropertyAccessorCollectionTest_Car
{
+ use ForwardCompatTestTrait;
+
private $axes;
public function __construct($axes = null)
@@ -146,12 +150,10 @@ public function testSetValueCallsAdderAndRemoverForNestedCollections()
$this->propertyAccessor->setValue($car, 'structure.axes', $axesAfter);
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
- * @expectedExceptionMessageRegExp /Could not determine access type for property "axes" in class "Mock_PropertyAccessorCollectionTest_CarNoAdderAndRemover_[^"]*"./
- */
public function testSetValueFailsIfNoAdderNorRemoverFound()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
+ $this->expectExceptionMessageRegExp('/Could not determine access type for property "axes" in class "Mock_PropertyAccessorCollectionTest_CarNoAdderAndRemover_[^"]*"./');
$car = $this->getMockBuilder(__CLASS__.'_CarNoAdderAndRemover')->getMock();
$axesBefore = $this->getContainer([1 => 'second', 3 => 'fourth']);
$axesAfter = $this->getContainer([0 => 'first', 1 => 'second', 2 => 'third']);
@@ -187,12 +189,10 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
- * expectedExceptionMessageRegExp /The property "axes" in class "Mock_PropertyAccessorCollectionTest_Car[^"]*" can be defined with the methods "addAxis()", "removeAxis()" but the new value must be an array or an instance of \Traversable, "string" given./
- */
public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
+expectedExceptionMessageRegExp /The property "axes" in class "Mock_PropertyAccessorCollectionTest_Car[^"]*" can be defined with the methods "addAxis()", "removeAxis()" but the new value must be an array or an instance of \Traversable, "string" given./');
$car = new PropertyAccessorCollectionTest_Car();
$this->propertyAccessor->setValue($car, 'axes', 'Not an array or Traversable');
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
index b92e62c629975..15e810b1b2d73 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
@@ -96,10 +96,10 @@ public function testGetValue($objectOrArray, $path, $value)
/**
* @dataProvider getPathsWithMissingProperty
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
*/
public function testGetValueThrowsExceptionIfPropertyNotFound($objectOrArray, $path)
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
$this->propertyAccessor->getValue($objectOrArray, $path);
}
@@ -113,19 +113,17 @@ public function testGetValueThrowsNoExceptionIfIndexNotFound($objectOrArray, $pa
/**
* @dataProvider getPathsWithMissingIndex
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
*/
public function testGetValueThrowsExceptionIfIndexNotFoundAndIndexExceptionsEnabled($objectOrArray, $path)
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchIndexException');
$this->propertyAccessor = new PropertyAccessor(false, true);
$this->propertyAccessor->getValue($objectOrArray, $path);
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
- */
public function testGetValueThrowsExceptionIfNotArrayAccess()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchIndexException');
$this->propertyAccessor->getValue(new \stdClass(), '[index]');
}
@@ -172,11 +170,9 @@ public function testGetValueNotModifyObjectException()
$this->assertSame(['Bernhard'], $object->firstName);
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
- */
public function testGetValueDoesNotReadMagicCallByDefault()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
$this->propertyAccessor->getValue(new TestClassMagicCall('Bernhard'), 'magicCallProperty');
}
@@ -197,11 +193,11 @@ public function testGetValueReadsMagicCallThatReturnsConstant()
/**
* @dataProvider getPathsWithUnexpectedType
- * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
- * @expectedExceptionMessage PropertyAccessor requires a graph of objects or arrays to operate on
*/
public function testGetValueThrowsExceptionIfNotObjectOrArray($objectOrArray, $path)
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException');
+ $this->expectExceptionMessage('PropertyAccessor requires a graph of objects or arrays to operate on');
$this->propertyAccessor->getValue($objectOrArray, $path);
}
@@ -217,10 +213,10 @@ public function testSetValue($objectOrArray, $path)
/**
* @dataProvider getPathsWithMissingProperty
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
*/
public function testSetValueThrowsExceptionIfPropertyNotFound($objectOrArray, $path)
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
$this->propertyAccessor->setValue($objectOrArray, $path, 'Updated');
}
@@ -245,11 +241,9 @@ public function testSetValueThrowsNoExceptionIfIndexNotFoundAndIndexExceptionsEn
$this->assertSame('Updated', $this->propertyAccessor->getValue($objectOrArray, $path));
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
- */
public function testSetValueThrowsExceptionIfNotArrayAccess()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchIndexException');
$object = new \stdClass();
$this->propertyAccessor->setValue($object, '[index]', 'Updated');
@@ -264,21 +258,17 @@ public function testSetValueUpdatesMagicSet()
$this->assertEquals('Updated', $author->__get('magicProperty'));
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
- */
public function testSetValueThrowsExceptionIfThereAreMissingParameters()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
$object = new TestClass('Bernhard');
$this->propertyAccessor->setValue($object, 'publicAccessorWithMoreRequiredParameters', 'Updated');
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
- */
public function testSetValueDoesNotUpdateMagicCallByDefault()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
$author = new TestClassMagicCall('Bernhard');
$this->propertyAccessor->setValue($author, 'magicCallProperty', 'Updated');
@@ -297,11 +287,11 @@ public function testSetValueUpdatesMagicCallIfEnabled()
/**
* @dataProvider getPathsWithUnexpectedType
- * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
- * @expectedExceptionMessage PropertyAccessor requires a graph of objects or arrays to operate on
*/
public function testSetValueThrowsExceptionIfNotObjectOrArray($objectOrArray, $path)
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException');
+ $this->expectExceptionMessage('PropertyAccessor requires a graph of objects or arrays to operate on');
$this->propertyAccessor->setValue($objectOrArray, $path, 'value');
}
@@ -533,23 +523,19 @@ public function testIsWritableForReferenceChainIssue($object, $path, $value)
$this->assertEquals($value, $this->propertyAccessor->isWritable($object, $path));
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException
- * @expectedExceptionMessage Expected argument of type "DateTime", "string" given
- */
public function testThrowTypeError()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Expected argument of type "DateTime", "string" given');
$object = new TypeHinted();
$this->propertyAccessor->setValue($object, 'date', 'This is a string, \DateTime expected.');
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException
- * @expectedExceptionMessage Expected argument of type "DateTime", "NULL" given
- */
public function testThrowTypeErrorWithNullArgument()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Expected argument of type "DateTime", "NULL" given');
$object = new TypeHinted();
$this->propertyAccessor->setValue($object, 'date', null);
@@ -598,12 +584,10 @@ public function testAttributeWithSpecialChars()
$this->assertSame('2', $propertyAccessor->getValue($obj, 'a%2Fb'));
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException
- * @expectedExceptionMessage Expected argument of type "Countable", "string" given
- */
public function testThrowTypeErrorWithInterface()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Expected argument of type "Countable", "string" given');
$object = new TypeHinted();
$this->propertyAccessor->setValue($object, 'countable', 'This is a string, \Countable expected.');
@@ -671,10 +655,10 @@ public function setFoo($foo)
/**
* @requires PHP 7.0
- * @expectedException \TypeError
*/
public function testThrowTypeErrorInsideSetterCall()
{
+ $this->expectException('TypeError');
$object = new TestClassTypeErrorInsideCall();
$this->propertyAccessor->setValue($object, 'property', 'foo');
@@ -682,11 +666,10 @@ public function testThrowTypeErrorInsideSetterCall()
/**
* @requires PHP 7
- *
- * @expectedException \TypeError
*/
public function testDoNotDiscardReturnTypeError()
{
+ $this->expectException('TypeError');
$object = new ReturnTyped();
$this->propertyAccessor->setValue($object, 'foos', [new \DateTime()]);
@@ -694,11 +677,10 @@ public function testDoNotDiscardReturnTypeError()
/**
* @requires PHP 7
- *
- * @expectedException \TypeError
*/
public function testDoNotDiscardReturnTypeErrorWhenWriterMethodIsMisconfigured()
{
+ $this->expectException('TypeError');
$object = new ReturnTyped();
$this->propertyAccessor->setValue($object, 'name', 'foo');
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
index fcc400b8c527f..e4ff364439543 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
@@ -119,19 +119,15 @@ public function testReplaceByIndexWithoutName()
$this->assertEquals($path, $this->builder->getPropertyPath());
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testReplaceByIndexDoesNotAllowInvalidOffsets()
{
+ $this->expectException('OutOfBoundsException');
$this->builder->replaceByIndex(6, 'new1');
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testReplaceByIndexDoesNotAllowNegativeOffsets()
{
+ $this->expectException('OutOfBoundsException');
$this->builder->replaceByIndex(-1, 'new1');
}
@@ -153,19 +149,15 @@ public function testReplaceByPropertyWithoutName()
$this->assertEquals($path, $this->builder->getPropertyPath());
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testReplaceByPropertyDoesNotAllowInvalidOffsets()
{
+ $this->expectException('OutOfBoundsException');
$this->builder->replaceByProperty(6, 'new1');
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testReplaceByPropertyDoesNotAllowNegativeOffsets()
{
+ $this->expectException('OutOfBoundsException');
$this->builder->replaceByProperty(-1, 'new1');
}
@@ -198,10 +190,10 @@ public function testReplaceNegative()
/**
* @dataProvider provideInvalidOffsets
- * @expectedException \OutOfBoundsException
*/
public function testReplaceDoesNotAllowInvalidOffsets($offset)
{
+ $this->expectException('OutOfBoundsException');
$this->builder->replace($offset, 1, new PropertyPath('new1[new2].new3'));
}
@@ -273,19 +265,15 @@ public function testRemove()
$this->assertEquals($path, $this->builder->getPropertyPath());
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testRemoveDoesNotAllowInvalidOffsets()
{
+ $this->expectException('OutOfBoundsException');
$this->builder->remove(6);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testRemoveDoesNotAllowNegativeOffsets()
{
+ $this->expectException('OutOfBoundsException');
$this->builder->remove(-1);
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
index c58ebf510c8ca..dbe63a258faf6 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyAccess\PropertyPath;
class PropertyPathTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testToString()
{
$path = new PropertyPath('reference.traversable[index].property');
@@ -23,19 +26,15 @@ public function testToString()
$this->assertEquals('reference.traversable[index].property', $path->__toString());
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException
- */
public function testDotIsRequiredBeforeProperty()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
new PropertyPath('[index]property');
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException
- */
public function testDotCannotBePresentAtTheBeginning()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
new PropertyPath('.property');
}
@@ -54,34 +53,28 @@ public function providePathsContainingUnexpectedCharacters()
/**
* @dataProvider providePathsContainingUnexpectedCharacters
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException
*/
public function testUnexpectedCharacters($path)
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
new PropertyPath($path);
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException
- */
public function testPathCannotBeEmpty()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException');
new PropertyPath('');
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException
- */
public function testPathCannotBeNull()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
new PropertyPath(null);
}
- /**
- * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException
- */
public function testPathCannotBeFalse()
{
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
new PropertyPath(false);
}
@@ -128,21 +121,17 @@ public function testGetElement()
$this->assertEquals('child', $propertyPath->getElement(2));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetElementDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->getElement(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testGetElementDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->getElement(-1);
@@ -156,21 +145,17 @@ public function testIsProperty()
$this->assertFalse($propertyPath->isProperty(2));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsPropertyDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isProperty(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsPropertyDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isProperty(-1);
@@ -184,21 +169,17 @@ public function testIsIndex()
$this->assertTrue($propertyPath->isIndex(2));
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsIndexDoesNotAcceptInvalidIndices()
{
+ $this->expectException('OutOfBoundsException');
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isIndex(3);
}
- /**
- * @expectedException \OutOfBoundsException
- */
public function testIsIndexDoesNotAcceptNegativeIndices()
{
+ $this->expectException('OutOfBoundsException');
$propertyPath = new PropertyPath('grandpa.parent[child]');
$propertyPath->isIndex(-1);
diff --git a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
index cd1cab9167371..ced72314504cf 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\PropertyInfo\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Type;
/**
@@ -19,6 +20,8 @@
*/
class TypeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstruct()
{
$type = new Type('object', true, 'ArrayObject', true, new Type('int'), new Type('string'));
@@ -43,12 +46,10 @@ public function testIterable()
$this->assertSame('iterable', $type->getBuiltinType());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage "foo" is not a valid PHP type.
- */
public function testInvalidType()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('"foo" is not a valid PHP type.');
new Type('foo');
}
}
diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
index 2cbfd73907841..35b4ed6a66edf 100644
--- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
@@ -12,15 +12,16 @@
namespace Symfony\Component\Routing\Tests\Annotation;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Annotation\Route;
class RouteTest extends TestCase
{
- /**
- * @expectedException \BadMethodCallException
- */
+ use ForwardCompatTestTrait;
+
public function testInvalidRouteParameter()
{
+ $this->expectException('BadMethodCallException');
$route = new Route(['foo' => 'bar']);
}
diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
index 13aba1325222f..5adafe2f2c664 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
@@ -118,11 +118,9 @@ public function testDumpWithTooManyRoutes()
$this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testDumpWithoutRoutes()
{
+ $this->expectException('InvalidArgumentException');
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(['class' => 'WithoutRoutesUrlGenerator']));
include $this->testTmpFilepath;
@@ -131,11 +129,9 @@ public function testDumpWithoutRoutes()
$projectUrlGenerator->generate('Test', []);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
- */
public function testGenerateNonExistingRoute()
{
+ $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
$this->routeCollection->add('Test', new Route('/test'));
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(['class' => 'NonExistingRoutesUrlGenerator']));
diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
index 309b5333708a7..802fbba39ec2f 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
@@ -79,11 +79,9 @@ public function testRelativeUrlWithNullParameter()
$this->assertEquals('/app.php/testing', $url);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testRelativeUrlWithNullParameterButNotOptional()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$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.
@@ -165,38 +163,30 @@ public function testGlobalParameterHasHigherPriorityThanDefault()
$this->assertSame('/app.php/de', $url);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
- */
public function testGenerateWithoutRoutes()
{
+ $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
$routes = $this->getRoutes('foo', new Route('/testing/{foo}'));
$this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
- */
public function testGenerateForRouteWithoutMandatoryParameter()
{
+ $this->expectException('Symfony\Component\Routing\Exception\MissingMandatoryParametersException');
$routes = $this->getRoutes('test', new Route('/testing/{foo}'));
$this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testGenerateForRouteWithInvalidOptionalParameter()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+']));
$this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testGenerateForRouteWithInvalidParameter()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => '1|2']));
$this->getGenerator($routes)->generate('test', ['foo' => '0'], UrlGeneratorInterface::ABSOLUTE_URL);
}
@@ -228,29 +218,23 @@ public function testGenerateForRouteWithInvalidParameterButDisabledRequirementsC
$this->assertSame('/app.php/testing/bar', $generator->generate('test', ['foo' => 'bar']));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testGenerateForRouteWithInvalidMandatoryParameter()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => 'd+']));
$this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testGenerateForRouteWithInvalidUtf8Parameter()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => '\pL+'], ['utf8' => true]));
$this->getGenerator($routes)->generate('test', ['foo' => 'abc123'], UrlGeneratorInterface::ABSOLUTE_URL);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testRequiredParamAndEmptyPassed()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/{slug}', [], ['slug' => '.+']));
$this->getGenerator($routes)->generate('test', ['slug' => '']);
}
@@ -400,20 +384,16 @@ public function testDefaultRequirementOfVariable()
$this->assertSame('/app.php/index.mobile.html', $generator->generate('test', ['page' => 'index', '_format' => 'mobile.html']));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testDefaultRequirementOfVariableDisallowsSlash()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/{page}.{_format}'));
$this->getGenerator($routes)->generate('test', ['page' => 'index', '_format' => 'sl/ash']);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testDefaultRequirementOfVariableDisallowsNextSeparator()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/{page}.{_format}'));
$this->getGenerator($routes)->generate('test', ['page' => 'do.t', '_format' => 'html']);
}
@@ -439,29 +419,23 @@ public function testWithHostSameAsContextAndAbsolute()
$this->assertEquals('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, ['host' => 'fr.example.com'])->generate('test', ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::ABSOLUTE_URL));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testUrlWithInvalidParameterInHost()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/', [], ['foo' => 'bar'], [], '{foo}.example.com'));
$this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$routes = $this->getRoutes('test', new Route('/', ['foo' => 'bar'], ['foo' => 'bar'], [], '{foo}.example.com'));
$this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH);
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
- */
public function testUrlWithInvalidParameterEqualsDefaultValueInHost()
{
+ $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
$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/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
index d84de3ac5a4fe..424d380054173 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -29,19 +29,15 @@ private function doSetUp()
$this->loader = $this->getClassLoader($this->reader);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLoadMissingClass()
{
+ $this->expectException('InvalidArgumentException');
$this->loader->load('MissingClass');
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLoadAbstractClass()
{
+ $this->expectException('InvalidArgumentException');
$this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\AbstractClass');
}
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
index 109d47096e6d3..ae43d9ba956ff 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
@@ -48,12 +48,10 @@ public function testLoadTraitWithClassConstant()
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooTrait.php');
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Did you forgot to add the "expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Did you forgot to add the "loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/NoStartTagClass.php');
}
diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
index 774e1a1fe5752..9a00095661d75 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Loader\ObjectRouteLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class ObjectRouteLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoadCallsServiceAndReturnsCollection()
{
$loader = new ObjectRouteLoaderForTest();
@@ -41,11 +44,11 @@ public function testLoadCallsServiceAndReturnsCollection()
}
/**
- * @expectedException \InvalidArgumentException
* @dataProvider getBadResourceStrings
*/
public function testExceptionWithoutSyntax($resourceString)
{
+ $this->expectException('InvalidArgumentException');
$loader = new ObjectRouteLoaderForTest();
$loader->load($resourceString);
}
@@ -59,31 +62,25 @@ public function getBadResourceStrings()
];
}
- /**
- * @expectedException \LogicException
- */
public function testExceptionOnNoObjectReturned()
{
+ $this->expectException('LogicException');
$loader = new ObjectRouteLoaderForTest();
$loader->loaderMap = ['my_service' => 'NOT_AN_OBJECT'];
$loader->load('my_service:method');
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testExceptionOnBadMethod()
{
+ $this->expectException('BadMethodCallException');
$loader = new ObjectRouteLoaderForTest();
$loader->loaderMap = ['my_service' => new \stdClass()];
$loader->load('my_service:method');
}
- /**
- * @expectedException \LogicException
- */
public function testExceptionOnMethodNotReturningCollection()
{
+ $this->expectException('LogicException');
$service = $this->getMockBuilder('stdClass')
->setMethods(['loadRoutes'])
->getMock();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
index 9a061b295afbe..b54d02053adcc 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Loader\XmlFileLoader;
use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader;
class XmlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$loader = new XmlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
@@ -104,21 +107,21 @@ public function testUtf8Route()
}
/**
- * @expectedException \InvalidArgumentException
* @dataProvider getPathsToInvalidFiles
*/
public function testLoadThrowsExceptionWithInvalidFile($filePath)
{
+ $this->expectException('InvalidArgumentException');
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load($filePath);
}
/**
- * @expectedException \InvalidArgumentException
* @dataProvider getPathsToInvalidFiles
*/
public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation($filePath)
{
+ $this->expectException('InvalidArgumentException');
$loader = new CustomXmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load($filePath);
}
@@ -128,12 +131,10 @@ public function getPathsToInvalidFiles()
return [['nonvalidnode.xml'], ['nonvalidroute.xml'], ['nonvalid.xml'], ['missing_id.xml'], ['missing_path.xml']];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Document types are not allowed.
- */
public function testDocTypeIsNotAllowed()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Document types are not allowed.');
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load('withdoctype.xml');
}
@@ -338,12 +339,10 @@ public function testLoadRouteWithControllerSetInDefaults()
$this->assertSame('AppBundle:Blog:list', $route->getDefault('_controller'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for "app_blog"/
- */
public function testOverrideControllerInDefaults()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/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');
}
@@ -372,12 +371,10 @@ public function provideFilesImportingRoutesWithControllers()
yield ['import__controller.xml'];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for the "import" tag/
- */
public function testImportWithOverriddenController()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/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 4944e5b636510..7ca43a7582e94 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\YamlFileLoader;
class YamlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$loader = new YamlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
@@ -41,11 +44,11 @@ public function testLoadDoesNothingIfEmpty()
}
/**
- * @expectedException \InvalidArgumentException
* @dataProvider getPathsToInvalidFiles
*/
public function testLoadThrowsExceptionWithInvalidFile($filePath)
{
+ $this->expectException('InvalidArgumentException');
$loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$loader->load($filePath);
}
@@ -139,12 +142,10 @@ public function testLoadRouteWithControllerSetInDefaults()
$this->assertSame('AppBundle:Blog:list', $route->getDefault('_controller'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "app_blog"/
- */
public function testOverrideControllerInDefaults()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/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');
}
@@ -173,12 +174,10 @@ public function provideFilesImportingRoutesWithControllers()
yield ['import__controller.yml'];
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "_static"/
- */
public function testImportWithOverriddenController()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessageRegExp('/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/DumpedUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php
index 34946f3f2b26c..10e9915480a8d 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php
@@ -11,27 +11,26 @@
namespace Symfony\Component\Routing\Tests\Matcher;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
class DumpedUrlMatcherTest extends UrlMatcherTest
{
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.
- */
+ use ForwardCompatTestTrait;
+
public function testSchemeRequirement()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.');
parent::testSchemeRequirement();
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.
- */
public function testSchemeAndMethodMismatch()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.');
parent::testSchemeRequirement();
}
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index c5b79c09ff6d0..e7d4da255783e 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -49,11 +49,9 @@ private function doTearDown()
@unlink($this->dumpPath);
}
- /**
- * @expectedException \LogicException
- */
public function testDumpWhenSchemeIsUsedWithoutAProperDumper()
{
+ $this->expectException('LogicException');
$collection = new RouteCollection();
$collection->add('secure', new Route(
'/secure',
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index b14fe98d4d4d5..73662412c99bb 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Routing\Tests\Matcher;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class RedirectableUrlMatcherTest extends UrlMatcherTest
{
+ use ForwardCompatTestTrait;
+
public function testMissingTrailingSlash()
{
$coll = new RouteCollection();
@@ -27,11 +30,9 @@ public function testMissingTrailingSlash()
$matcher->match('/foo');
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testRedirectWhenNoSlashForNonSafeMethod()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/'));
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
index 9429b1171a9de..0b921d0dabeb8 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -180,11 +180,9 @@ public function testMatchSpecialRouteName()
$this->assertEquals(['_route' => '$péß^a|'], $matcher->match('/bar'));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testTrailingEncodedNewlineIsNotOverlooked()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo'));
@@ -319,11 +317,9 @@ public function testDefaultRequirementOfVariable()
$this->assertEquals(['page' => 'index', '_format' => 'mobile.html', '_route' => 'test'], $matcher->match('/index.mobile.html'));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testDefaultRequirementOfVariableDisallowsSlash()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}'));
$matcher = $this->getUrlMatcher($coll);
@@ -331,11 +327,9 @@ public function testDefaultRequirementOfVariableDisallowsSlash()
$matcher->match('/index.sl/ash');
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testDefaultRequirementOfVariableDisallowsNextSeparator()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}', [], ['_format' => 'html|xml']));
$matcher = $this->getUrlMatcher($coll);
@@ -343,22 +337,18 @@ public function testDefaultRequirementOfVariableDisallowsNextSeparator()
$matcher->match('/do.t.html');
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testSchemeRequirement()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
$matcher = $this->getUrlMatcher($coll);
$matcher->match('/foo');
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testCondition()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$route = new Route('/foo');
$route->setCondition('context.getMethod() == "POST"');
@@ -425,11 +415,9 @@ public function testWithHostOnRouteCollection()
$this->assertEquals(['foo' => 'bar', '_route' => 'bar', 'locale' => 'en'], $matcher->match('/bar/bar'));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testWithOutHostHostDoesNotMatch()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{foo}', [], [], [], '{locale}.example.com'));
@@ -437,11 +425,9 @@ public function testWithOutHostHostDoesNotMatch()
$matcher->match('/foo/bar');
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testPathIsCaseSensitive()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('foo', new Route('/locale', [], ['locale' => 'EN|FR|DE']));
@@ -458,11 +444,9 @@ public function testHostIsCaseInsensitive()
$this->assertEquals(['_route' => 'foo', 'locale' => 'en'], $matcher->match('/'));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\NoConfigurationException
- */
public function testNoConfiguration()
{
+ $this->expectException('Symfony\Component\Routing\Exception\NoConfigurationException');
$coll = new RouteCollection();
$matcher = $this->getUrlMatcher($coll);
@@ -493,11 +477,9 @@ public function testNestedCollections()
$this->assertEquals(['_route' => 'buz'], $matcher->match('/prefix/buz'));
}
- /**
- * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
- */
public function testSchemeAndMethodMismatch()
{
+ $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$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 11d9453e09093..3ce024751cb5a 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\YamlFileLoader;
@@ -21,6 +22,8 @@
class RouteCollectionBuilderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testImport()
{
$resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
@@ -75,11 +78,9 @@ public function testImportAddResources()
$this->assertCount(1, $routeCollection->getResources());
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testImportWithoutLoaderThrowsException()
{
+ $this->expectException('BadMethodCallException');
$collectionBuilder = new RouteCollectionBuilder();
$collectionBuilder->import('routing.yml');
}
diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
index d9783147b8de7..789dd438123cd 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCompiler;
class RouteCompilerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideCompileData
*/
@@ -243,41 +246,33 @@ public function provideCompileImplicitUtf8Data()
];
}
- /**
- * @expectedException \LogicException
- */
public function testRouteWithSameVariableTwice()
{
+ $this->expectException('LogicException');
$route = new Route('/{name}/{name}');
$compiled = $route->compile();
}
- /**
- * @expectedException \LogicException
- */
public function testRouteCharsetMismatch()
{
+ $this->expectException('LogicException');
$route = new Route("/\xE9/{bar}", [], ['bar' => '.'], ['utf8' => true]);
$compiled = $route->compile();
}
- /**
- * @expectedException \LogicException
- */
public function testRequirementCharsetMismatch()
{
+ $this->expectException('LogicException');
$route = new Route('/foo/{bar}', [], ['bar' => "\xE9"], ['utf8' => true]);
$compiled = $route->compile();
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRouteWithFragmentAsPathParameter()
{
+ $this->expectException('InvalidArgumentException');
$route = new Route('/{_fragment}');
$compiled = $route->compile();
@@ -285,10 +280,10 @@ public function testRouteWithFragmentAsPathParameter()
/**
* @dataProvider getVariableNamesStartingWithADigit
- * @expectedException \DomainException
*/
public function testRouteWithVariableNameStartingWithADigit($name)
{
+ $this->expectException('DomainException');
$route = new Route('/{'.$name.'}');
$route->compile();
}
@@ -373,11 +368,9 @@ public function provideCompileWithHostData()
];
}
- /**
- * @expectedException \DomainException
- */
public function testRouteWithTooLongVariableName()
{
+ $this->expectException('DomainException');
$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 179f4880d0d88..73fc832fc86f1 100644
--- a/src/Symfony/Component/Routing/Tests/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Route;
class RouteTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$route = new Route('/{foo}', ['foo' => 'bar'], ['foo' => '\d+'], ['foo' => 'bar'], '{locale}.example.com');
@@ -124,10 +127,10 @@ public function testRequirement()
/**
* @dataProvider getInvalidRequirements
- * @expectedException \InvalidArgumentException
*/
public function testSetInvalidRequirement($req)
{
+ $this->expectException('InvalidArgumentException');
$route = new Route('/{foo}');
$route->setRequirement('foo', $req);
}
diff --git a/src/Symfony/Component/Routing/Tests/RouterTest.php b/src/Symfony/Component/Routing/Tests/RouterTest.php
index 7f42fd5ef5c40..118cbabff3df9 100644
--- a/src/Symfony/Component/Routing/Tests/RouterTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouterTest.php
@@ -44,12 +44,10 @@ public function testSetOptionsWithSupportedOptions()
$this->assertSame('ResourceType', $this->router->getOption('resource_type'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The Router does not support the following options: "option_foo", "option_bar"
- */
public function testSetOptionsWithUnsupportedOptions()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The Router does not support the following options: "option_foo", "option_bar"');
$this->router->setOptions([
'cache_dir' => './cache',
'option_foo' => true,
@@ -65,21 +63,17 @@ public function testSetOptionWithSupportedOption()
$this->assertSame('./cache', $this->router->getOption('cache_dir'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The Router does not support the "option_foo" option
- */
public function testSetOptionWithUnsupportedOption()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The Router does not support the "option_foo" option');
$this->router->setOption('option_foo', true);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The Router does not support the "option_foo" option
- */
public function testGetOptionWithUnsupportedOption()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The Router does not support the "option_foo" option');
$this->router->getOption('option_foo', true);
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
index 379da4bb61329..f155f1c4f38ac 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authentication;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
@@ -24,19 +25,17 @@
class AuthenticationProviderManagerTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- */
+ use ForwardCompatTestTrait;
+
public function testAuthenticateWithoutProviders()
{
+ $this->expectException('InvalidArgumentException');
new AuthenticationProviderManager([]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testAuthenticateWithProvidersWithIncorrectInterface()
{
+ $this->expectException('InvalidArgumentException');
(new AuthenticationProviderManager([
new \stdClass(),
]))->authenticate($this->getMockBuilder(TokenInterface::class)->getMock());
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 a888d2bf81b9d..613d28382d952 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider;
class AnonymousAuthenticationProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$provider = $this->getProvider('foo');
@@ -24,22 +27,18 @@ public function testSupports()
$this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
- * @expectedExceptionMessage The token is not supported by this authentication provider.
- */
public function testAuthenticateWhenTokenIsNotSupported()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $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());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testAuthenticateWhenSecretIsNotValid()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$provider = $this->getProvider('foo');
$provider->authenticate($this->getSupportedToken('bar'));
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
index 53ff170554222..576efb96eac33 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
@@ -12,17 +12,18 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
class DaoAuthenticationProviderTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationServiceException
- */
+ use ForwardCompatTestTrait;
+
public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationServiceException');
$provider = $this->getProvider('fabien');
$method = new \ReflectionMethod($provider, 'retrieveUser');
$method->setAccessible(true);
@@ -30,11 +31,9 @@ public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
$method->invoke($provider, 'fabien', $this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
public function testRetrieveUserWhenUsernameIsNotFound()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$userProvider = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface')->getMock();
$userProvider->expects($this->once())
->method('loadUserByUsername')
@@ -48,11 +47,9 @@ public function testRetrieveUserWhenUsernameIsNotFound()
$method->invoke($provider, 'fabien', $this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationServiceException
- */
public function testRetrieveUserWhenAnExceptionOccurs()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationServiceException');
$userProvider = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface')->getMock();
$userProvider->expects($this->once())
->method('loadUserByUsername')
@@ -105,11 +102,9 @@ public function testRetrieveUser()
$this->assertSame($user, $method->invoke($provider, 'fabien', $this->getSupportedToken()));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testCheckAuthenticationWhenCredentialsAreEmpty()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$encoder = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface')->getMock();
$encoder
->expects($this->never())
@@ -161,11 +156,9 @@ public function testCheckAuthenticationWhenCredentialsAre0()
);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testCheckAuthenticationWhenCredentialsAreNotValid()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$encoder = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface')->getMock();
$encoder->expects($this->once())
->method('isPasswordValid')
@@ -185,11 +178,9 @@ public function testCheckAuthenticationWhenCredentialsAreNotValid()
$method->invoke($provider, $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(), $token);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChanged()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$user = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock();
$user->expects($this->once())
->method('getPassword')
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 bad3072f4a9af..743b737d44ed6 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -28,12 +29,12 @@
*/
class LdapBindAuthenticationProviderTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- * @expectedExceptionMessage The presented password must not be empty.
- */
+ use ForwardCompatTestTrait;
+
public function testEmptyPasswordShouldThrowAnException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectExceptionMessage('The presented password must not be empty.');
$userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
$userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
@@ -45,12 +46,10 @@ public function testEmptyPasswordShouldThrowAnException()
$reflection->invoke($provider, new User('foo', null), new UsernamePasswordToken('foo', '', 'key'));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- * @expectedExceptionMessage The presented password must not be empty.
- */
public function testNullPasswordShouldThrowAnException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $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();
@@ -62,12 +61,10 @@ public function testNullPasswordShouldThrowAnException()
$reflection->invoke($provider, new User('foo', null), new UsernamePasswordToken('foo', null, 'key'));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- * @expectedExceptionMessage The presented password is invalid.
- */
public function testBindFailureShouldThrowAnException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectExceptionMessage('The presented password is invalid.');
$userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
$ldap
@@ -139,12 +136,10 @@ public function testQueryForDn()
$reflection->invoke($provider, new User('foo', null), new UsernamePasswordToken('foo', 'bar', 'key'));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- * @expectedExceptionMessage The presented username is invalid.
- */
public function testEmptyQueryResultShouldThrowAnException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectExceptionMessage('The presented username is invalid.');
$userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
$collection = $this->getMockBuilder(CollectionInterface::class)->getMock();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
index 57bce20f5b20c..7d37f93c7f315 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
use Symfony\Component\Security\Core\Exception\LockedException;
class PreAuthenticatedAuthenticationProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$provider = $this->getProvider();
@@ -36,22 +39,18 @@ public function testSupports()
$this->assertFalse($provider->supports($token));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
- * @expectedExceptionMessage The token is not supported by this authentication provider.
- */
public function testAuthenticateWhenTokenIsNotSupported()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectExceptionMessage('The token is not supported by this authentication provider.');
$provider = $this->getProvider();
$provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testAuthenticateWhenNoUserIsSet()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$provider = $this->getProvider();
$provider->authenticate($this->getSupportedToken(''));
}
@@ -75,11 +74,9 @@ public function testAuthenticate()
$this->assertSame($user, $token->getUser());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\LockedException
- */
public function testAuthenticateWhenUserCheckerThrowsException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\LockedException');
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
index 6ac7438a064a2..77fba2281116e 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
use Symfony\Component\Security\Core\Exception\DisabledException;
use Symfony\Component\Security\Core\Role\Role;
class RememberMeAuthenticationProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$provider = $this->getProvider();
@@ -26,34 +29,28 @@ public function testSupports()
$this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
- * @expectedExceptionMessage The token is not supported by this authentication provider.
- */
public function testAuthenticateWhenTokenIsNotSupported()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectExceptionMessage('The token is not supported by this authentication provider.');
$provider = $this->getProvider();
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
$provider->authenticate($token);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testAuthenticateWhenSecretsDoNotMatch()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$provider = $this->getProvider(null, 'secret1');
$token = $this->getSupportedToken(null, 'secret2');
$provider->authenticate($token);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
- */
public function testAuthenticateWhenPreChecksFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\DisabledException');
$userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
$userChecker->expects($this->once())
->method('checkPreAuth')
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
index 07c1618f214dd..d0d5d26976885 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider;
use Symfony\Component\Security\Core\Exception\DisabledException;
use Symfony\Component\Security\Core\Exception\LockedException;
@@ -19,11 +20,11 @@
class SimpleAuthenticationProviderTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
- */
+ use ForwardCompatTestTrait;
+
public function testAuthenticateWhenPreChecksFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\DisabledException');
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
@@ -46,11 +47,9 @@ public function testAuthenticateWhenPreChecksFails()
$provider->authenticate($token);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\LockedException
- */
public function testAuthenticateWhenPostChecksFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\LockedException');
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
index e959d18c53409..5a00096dece74 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
@@ -21,6 +22,8 @@
class UserAuthenticationProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSupports()
{
$provider = $this->getProvider();
@@ -29,22 +32,18 @@ public function testSupports()
$this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
- * @expectedExceptionMessage The token is not supported by this authentication provider.
- */
public function testAuthenticateWhenTokenIsNotSupported()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectExceptionMessage('The token is not supported by this authentication provider.');
$provider = $this->getProvider();
$provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
public function testAuthenticateWhenUsernameIsNotFound()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$provider = $this->getProvider(false, false);
$provider->expects($this->once())
->method('retrieveUser')
@@ -54,11 +53,9 @@ public function testAuthenticateWhenUsernameIsNotFound()
$provider->authenticate($this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testAuthenticateWhenUsernameIsNotFoundAndHideIsTrue()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$provider = $this->getProvider(false, true);
$provider->expects($this->once())
->method('retrieveUser')
@@ -68,11 +65,9 @@ public function testAuthenticateWhenUsernameIsNotFoundAndHideIsTrue()
$provider->authenticate($this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationServiceException
- */
public function testAuthenticateWhenProviderDoesNotReturnAnUserInterface()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationServiceException');
$provider = $this->getProvider(false, true);
$provider->expects($this->once())
->method('retrieveUser')
@@ -82,11 +77,9 @@ public function testAuthenticateWhenProviderDoesNotReturnAnUserInterface()
$provider->authenticate($this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\CredentialsExpiredException
- */
public function testAuthenticateWhenPreChecksFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\CredentialsExpiredException');
$userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
$userChecker->expects($this->once())
->method('checkPreAuth')
@@ -102,11 +95,9 @@ public function testAuthenticateWhenPreChecksFails()
$provider->authenticate($this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AccountExpiredException
- */
public function testAuthenticateWhenPostChecksFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AccountExpiredException');
$userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
$userChecker->expects($this->once())
->method('checkPostAuth')
@@ -122,12 +113,10 @@ public function testAuthenticateWhenPostChecksFails()
$provider->authenticate($this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- * @expectedExceptionMessage Bad credentials
- */
public function testAuthenticateWhenPostCheckAuthenticationFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectExceptionMessage('Bad credentials');
$provider = $this->getProvider();
$provider->expects($this->once())
->method('retrieveUser')
@@ -141,12 +130,10 @@ public function testAuthenticateWhenPostCheckAuthenticationFails()
$provider->authenticate($this->getSupportedToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- * @expectedExceptionMessage Foo
- */
public function testAuthenticateWhenPostCheckAuthenticationFailsWithHideFalse()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
+ $this->expectExceptionMessage('Foo');
$provider = $this->getProvider(false, false);
$provider->expects($this->once())
->method('retrieveUser')
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 1413b6d402a46..62ace03633126 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\RememberMe;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider;
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
class InMemoryTokenProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCreateNewToken()
{
$provider = new InMemoryTokenProvider();
@@ -27,11 +30,9 @@ public function testCreateNewToken()
$this->assertSame($provider->loadTokenBySeries('foo'), $token);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\TokenNotFoundException
- */
public function testLoadTokenBySeriesThrowsNotFoundException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\TokenNotFoundException');
$provider = new InMemoryTokenProvider();
$provider->loadTokenBySeries('foo');
}
@@ -49,11 +50,9 @@ public function testUpdateToken()
$this->assertSame($token->getLastUsed(), $lastUsed);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\TokenNotFoundException
- */
public function testDeleteToken()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\TokenNotFoundException');
$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 e1329e37430b6..58035c519faa7 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Token;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Role\Role;
class RememberMeTokenTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$user = $this->getUser();
@@ -29,11 +32,9 @@ public function testConstructor()
$this->assertTrue($token->isAuthenticated());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testConstructorSecretCannotBeNull()
{
+ $this->expectException('InvalidArgumentException');
new RememberMeToken(
$this->getUser(),
null,
@@ -41,11 +42,9 @@ public function testConstructorSecretCannotBeNull()
);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testConstructorSecretCannotBeEmptyString()
{
+ $this->expectException('InvalidArgumentException');
new RememberMeToken(
$this->getUser(),
'',
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 87dceea3d8422..0b02858000364 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Token;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Role\Role;
class UsernamePasswordTokenTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$token = new UsernamePasswordToken('foo', 'bar', 'key');
@@ -28,11 +31,9 @@ public function testConstructor()
$this->assertEquals('key', $token->getProviderKey());
}
- /**
- * @expectedException \LogicException
- */
public function testSetAuthenticatedToTrue()
{
+ $this->expectException('LogicException');
$token = new UsernamePasswordToken('foo', 'bar', 'key');
$token->setAuthenticated(true);
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
index 28aff4af31f09..f6566fa0e9b49 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
@@ -23,11 +23,9 @@ class AccessDecisionManagerTest extends TestCase
{
use ForwardCompatTestTrait;
- /**
- * @expectedException \InvalidArgumentException
- */
public function testSetUnsupportedStrategy()
{
+ $this->expectException('InvalidArgumentException');
new AccessDecisionManager([$this->getVoter(VoterInterface::ACCESS_GRANTED)], 'fooBar');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
index a26252df29bb4..d666ce86848a4 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
@@ -69,11 +69,9 @@ public function testVoteAuthenticatesTokenIfNecessary()
$this->assertSame($newToken, $this->tokenStorage->getToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
- */
public function testVoteWithoutAuthenticationToken()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
$this->authorizationChecker->isGranted('ROLE_FOO');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
index cf21eb61dbe19..f15af4f547247 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
@@ -39,11 +39,9 @@ public function testValidation()
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testEncodePasswordLength()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$encoder = new Argon2iPasswordEncoder();
$encoder->encodePassword(str_repeat('a', 4097), 'salt');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
index 7f9dbe7f33fd8..cd8394f101821 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
/**
@@ -19,22 +20,20 @@
*/
class BCryptPasswordEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const PASSWORD = 'password';
const VALID_COST = '04';
- /**
- * @expectedException \InvalidArgumentException
- */
public function testCostBelowRange()
{
+ $this->expectException('InvalidArgumentException');
new BCryptPasswordEncoder(3);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testCostAboveRange()
{
+ $this->expectException('InvalidArgumentException');
new BCryptPasswordEncoder(32);
}
@@ -69,11 +68,9 @@ public function testValidation()
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testEncodePasswordLength()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
$encoder->encodePassword(str_repeat('a', 73), 'salt');
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php
index 2251cfdf906e0..cf517f6cee5ae 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\BasePasswordEncoder;
class PasswordEncoder extends BasePasswordEncoder
@@ -27,6 +28,8 @@ public function isPasswordValid($encoded, $raw, $salt)
class BasePasswordEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testComparePassword()
{
$this->assertTrue($this->invokeComparePasswords('password', 'password'));
@@ -46,11 +49,9 @@ public function testMergePasswordAndSalt()
$this->assertEquals('password', $this->invokeMergePasswordAndSalt('password', ''));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testMergePasswordAndSaltWithException()
{
+ $this->expectException('InvalidArgumentException');
$this->invokeMergePasswordAndSalt('password', '{foo}');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
index ae8467af57530..5fc489e426e07 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
@@ -20,6 +21,8 @@
class EncoderFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetEncoderWithMessageDigestEncoder()
{
$factory = new EncoderFactory(['Symfony\Component\Security\Core\User\UserInterface' => [
@@ -107,11 +110,9 @@ public function testGetNullNamedEncoderForEncoderAware()
$this->assertEquals($expectedEncoder->encodePassword('foo', ''), $encoder->encodePassword('foo', ''));
}
- /**
- * @expectedException \RuntimeException
- */
public function testGetInvalidNamedEncoderForEncoderAware()
{
+ $this->expectException('RuntimeException');
$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 c449194f8dda5..50cd47bf0c8e6 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
class MessageDigestPasswordEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testIsPasswordValid()
{
$encoder = new MessageDigestPasswordEncoder('sha256', false, 1);
@@ -35,20 +38,16 @@ public function testEncodePassword()
$this->assertSame(hash('sha256', hash('sha256', 'password', true).'password'), $encoder->encodePassword('password', ''));
}
- /**
- * @expectedException \LogicException
- */
public function testEncodePasswordAlgorithmDoesNotExist()
{
+ $this->expectException('LogicException');
$encoder = new MessageDigestPasswordEncoder('foobar');
$encoder->encodePassword('password', '');
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testEncodePasswordLength()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$encoder = new MessageDigestPasswordEncoder();
$encoder->encodePassword(str_repeat('a', 5000), 'salt');
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
index e65eef5bba4e4..0795c4b5d68d1 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder;
class Pbkdf2PasswordEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testIsPasswordValid()
{
$encoder = new Pbkdf2PasswordEncoder('sha256', false, 1, 40);
@@ -35,20 +38,16 @@ public function testEncodePassword()
$this->assertSame('8bc2f9167a81cdcfad1235cd9047f1136271c1f978fcfcb35e22dbeafa4634f6fd2214218ed63ebb', $encoder->encodePassword('password', ''));
}
- /**
- * @expectedException \LogicException
- */
public function testEncodePasswordAlgorithmDoesNotExist()
{
+ $this->expectException('LogicException');
$encoder = new Pbkdf2PasswordEncoder('foobar');
$encoder->encodePassword('password', '');
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testEncodePasswordLength()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$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 1196651a86317..1ef0e0c7788dd 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
class PlaintextPasswordEncoderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testIsPasswordValid()
{
$encoder = new PlaintextPasswordEncoder();
@@ -38,11 +41,9 @@ public function testEncodePassword()
$this->assertSame('foo', $encoder->encodePassword('foo', ''));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testEncodePasswordLength()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$encoder = new PlaintextPasswordEncoder();
$encoder->encodePassword(str_repeat('a', 5000), 'salt');
diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
index f4e0d9e6e8f90..9e2d0ffeb4633 100644
--- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Security\Core\Tests\Resources;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class TranslationFilesTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
diff --git a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
index 05a7fbba19d88..6852273aef8f9 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\ChainUserProvider;
class ChainUserProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoadUserByUsername()
{
$provider1 = $this->getProvider();
@@ -40,11 +43,9 @@ public function testLoadUserByUsername()
$this->assertSame($account, $provider->loadUserByUsername('foo'));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
public function testLoadUserByUsernameThrowsUsernameNotFoundException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$provider1 = $this->getProvider();
$provider1
->expects($this->once())
@@ -105,11 +106,9 @@ public function testRefreshUserAgain()
$this->assertSame($account, $provider->refreshUser($this->getAccount()));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UnsupportedUserException
- */
public function testRefreshUserThrowsUnsupportedUserException()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UnsupportedUserException');
$provider1 = $this->getProvider();
$provider1
->expects($this->once())
diff --git a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
index b1ff3b66e17e7..6b78260b09be9 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Core\User\User;
class InMemoryUserProviderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testConstructor()
{
$provider = $this->createProvider();
@@ -63,21 +66,17 @@ public function testCreateUser()
$this->assertEquals('foo', $user->getPassword());
}
- /**
- * @expectedException \LogicException
- */
public function testCreateUserAlreadyExist()
{
+ $this->expectException('LogicException');
$provider = new InMemoryUserProvider();
$provider->createUser(new User('fabien', 'foo'));
$provider->createUser(new User('fabien', 'foo'));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
public function testLoadUserByUsernameDoesNotExist()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$provider = new InMemoryUserProvider();
$provider->loadUserByUsername('fabien');
}
diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
index 39a346433e463..de31af718b3ab 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -24,11 +25,11 @@
*/
class LdapUserProviderTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
+ use ForwardCompatTestTrait;
+
public function testLoadUserByUsernameFailsIfCantConnectToLdap()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
$ldap
->expects($this->once())
@@ -40,11 +41,9 @@ public function testLoadUserByUsernameFailsIfCantConnectToLdap()
$provider->loadUserByUsername('foo');
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
public function testLoadUserByUsernameFailsIfNoLdapEntries()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$result = $this->getMockBuilder(CollectionInterface::class)->getMock();
$query = $this->getMockBuilder(QueryInterface::class)->getMock();
$query
@@ -73,11 +72,9 @@ public function testLoadUserByUsernameFailsIfNoLdapEntries()
$provider->loadUserByUsername('foo');
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
- */
public function testLoadUserByUsernameFailsIfMoreThanOneLdapEntry()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
$result = $this->getMockBuilder(CollectionInterface::class)->getMock();
$query = $this->getMockBuilder(QueryInterface::class)->getMock();
$query
@@ -106,11 +103,9 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapEntry()
$provider->loadUserByUsername('foo');
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException
- */
public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\InvalidArgumentException');
$result = $this->getMockBuilder(CollectionInterface::class)->getMock();
$query = $this->getMockBuilder(QueryInterface::class)->getMock();
$query
@@ -191,11 +186,9 @@ public function testLoadUserByUsernameShouldNotFailIfEntryHasNoUidKeyAttribute()
);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException
- */
public function testLoadUserByUsernameFailsIfEntryHasNoPasswordAttribute()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\InvalidArgumentException');
$result = $this->getMockBuilder(CollectionInterface::class)->getMock();
$query = $this->getMockBuilder(QueryInterface::class)->getMock();
$query
diff --git a/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
index 16eea31c4f0ea..cdff6e1f3e5ee 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\User\UserChecker;
class UserCheckerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCheckPostAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
@@ -33,11 +36,9 @@ public function testCheckPostAuthPass()
$this->assertNull($checker->checkPostAuth($account));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\CredentialsExpiredException
- */
public function testCheckPostAuthCredentialsExpired()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\CredentialsExpiredException');
$checker = new UserChecker();
$account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
@@ -65,11 +66,9 @@ public function testCheckPreAuthPass()
$this->assertNull($checker->checkPreAuth($account));
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\LockedException
- */
public function testCheckPreAuthAccountLocked()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\LockedException');
$checker = new UserChecker();
$account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
@@ -78,11 +77,9 @@ public function testCheckPreAuthAccountLocked()
$checker->checkPreAuth($account);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
- */
public function testCheckPreAuthDisabled()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\DisabledException');
$checker = new UserChecker();
$account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
@@ -92,11 +89,9 @@ public function testCheckPreAuthDisabled()
$checker->checkPreAuth($account);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AccountExpiredException
- */
public function testCheckPreAuthAccountExpired()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AccountExpiredException');
$checker = new UserChecker();
$account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
index 9a8d65d537caf..c7065eb6f17b7 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
@@ -12,15 +12,16 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\User\User;
class UserTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- */
+ use ForwardCompatTestTrait;
+
public function testConstructorException()
{
+ $this->expectException('InvalidArgumentException');
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 131b7f3b1fe48..c10011ac24419 100644
--- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
@@ -115,11 +115,9 @@ public function emptyPasswordData()
];
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testUserIsNotValid()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$user = $this->getMockBuilder('Foo\Bar\User')->getMock();
$this->tokenStorage = $this->createTokenStorage($user);
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
index ac4c19b895022..7574635dd45a1 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
@@ -89,11 +89,9 @@ public function testGetExistingToken()
$this->assertSame('TOKEN', $this->storage->getToken('token_id'));
}
- /**
- * @expectedException \Symfony\Component\Security\Csrf\Exception\TokenNotFoundException
- */
public function testGetNonExistingToken()
{
+ $this->expectException('Symfony\Component\Security\Csrf\Exception\TokenNotFoundException');
$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 d90278b16a796..4ad0e086405fe 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
@@ -89,19 +89,15 @@ public function testGetExistingTokenFromActiveSession()
$this->assertSame('RESULT', $this->storage->getToken('token_id'));
}
- /**
- * @expectedException \Symfony\Component\Security\Csrf\Exception\TokenNotFoundException
- */
public function testGetNonExistingTokenFromClosedSession()
{
+ $this->expectException('Symfony\Component\Security\Csrf\Exception\TokenNotFoundException');
$this->storage->getToken('token_id');
}
- /**
- * @expectedException \Symfony\Component\Security\Csrf\Exception\TokenNotFoundException
- */
public function testGetNonExistingTokenFromActiveSession()
{
+ $this->expectException('Symfony\Component\Security\Csrf\Exception\TokenNotFoundException');
$this->session->start();
$this->storage->getToken('token_id');
}
diff --git a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
index 7decb4072eb68..7344100ee02bb 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
@@ -362,11 +362,9 @@ public function testSupportsReturnFalseSkipAuth()
$listener->handle($this->event);
}
- /**
- * @expectedException \UnexpectedValueException
- */
public function testReturnNullFromGetCredentials()
{
+ $this->expectException('UnexpectedValueException');
$authenticator = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
$providerKey = 'my_firewall4';
diff --git a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
index cb3cb3d221bf1..fa77bf0a92a27 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
@@ -152,11 +152,9 @@ public function testLegacyAuthenticate()
$this->assertSame($authedToken, $actualAuthedToken);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testCheckCredentialsReturningNonTrueFailsAuthentication()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$providerKey = 'my_uncool_firewall';
$authenticator = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
@@ -185,11 +183,9 @@ public function testCheckCredentialsReturningNonTrueFailsAuthentication()
$provider->authenticate($this->preAuthenticationToken);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationExpiredException
- */
public function testGuardWithNoLongerAuthenticatedTriggersLogout()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationExpiredException');
$providerKey = 'my_firewall_abc';
// create a token and mark it as NOT authenticated anymore
@@ -220,12 +216,10 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
$this->assertFalse($supports);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
- * @expectedExceptionMessageRegExp /second_firewall_0/
- */
public function testAuthenticateFailsOnNonOriginatingToken()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectExceptionMessageRegExp('/second_firewall_0/');
$authenticatorA = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
$authenticators = [$authenticatorA];
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
index 7a3ce94fcc209..4af479a5a5dd3 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
@@ -81,12 +81,10 @@ public function testOnAuthenticationSuccessCallsSimpleAuthenticator()
$this->assertSame($this->response, $result);
}
- /**
- * @expectedException \UnexpectedValueException
- * @expectedExceptionMessage onAuthenticationSuccess method must return null to use the default success handler, or a Response object
- */
public function testOnAuthenticationSuccessThrowsAnExceptionIfNonResponseIsReturned()
{
+ $this->expectException('UnexpectedValueException');
+ $this->expectExceptionMessage('onAuthenticationSuccess method must return null to use the default success handler, or a Response object');
$this->successHandler->expects($this->never())
->method('onAuthenticationSuccess');
@@ -151,12 +149,10 @@ public function testOnAuthenticationFailureCallsSimpleAuthenticator()
$this->assertSame($this->response, $result);
}
- /**
- * @expectedException \UnexpectedValueException
- * @expectedExceptionMessage onAuthenticationFailure method must return null to use the default failure handler, or a Response object
- */
public function testOnAuthenticationFailureThrowsAnExceptionIfNonResponseIsReturned()
{
+ $this->expectException('UnexpectedValueException');
+ $this->expectExceptionMessage('onAuthenticationFailure method must return null to use the default failure handler, or a Response object');
$this->failureHandler->expects($this->never())
->method('onAuthenticationFailure');
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
index 0bb27258befe0..8ed9fe541897c 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
@@ -12,15 +12,16 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Http\Firewall\AccessListener;
class AccessListenerTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
- */
+ use ForwardCompatTestTrait;
+
public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock();
$accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock();
@@ -183,11 +184,9 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest()
$listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
- */
public function testHandleWhenTheSecurityTokenStorageHasNoToken()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage
->expects($this->any())
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
index e331542369f53..e5008d6638936 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
@@ -21,6 +22,8 @@
class BasicAuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHandleWithValidUsernameAndPasswordServerParameters()
{
$request = new Request([], [], [], [], [], [
@@ -182,12 +185,10 @@ public function testHandleWithASimilarAuthenticatedToken()
$listener->handle($event);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage $providerKey must not be empty
- */
public function testItRequiresProviderKey()
{
+ $this->expectException('InvalidArgumentException');
+ $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(),
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
index 250b26cfef6ec..9c11fc558d693 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -34,12 +35,12 @@
class ContextListenerTest extends TestCase
{
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage $contextKey must not be empty
- */
+ use ForwardCompatTestTrait;
+
public function testItRequiresContextKey()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('$contextKey must not be empty');
new ContextListener(
$this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(),
[],
@@ -47,12 +48,10 @@ public function testItRequiresContextKey()
);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage User provider "stdClass" must implement "Symfony\Component\Security\Core\User\UserProviderInterface
- */
public function testUserProvidersNeedToImplementAnInterface()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('User provider "stdClass" must implement "Symfony\Component\Security\Core\User\UserProviderInterface');
$this->handleEventWithPreviousSession(new TokenStorage(), [new \stdClass()]);
}
@@ -308,11 +307,9 @@ public function testTokenIsSetToNullIfNoUserWasLoadedByTheRegisteredUserProvider
$this->assertNull($tokenStorage->getToken());
}
- /**
- * @expectedException \RuntimeException
- */
public function testRuntimeExceptionIsThrownIfNoSupportingUserProviderWasRegistered()
{
+ $this->expectException('RuntimeException');
$this->handleEventWithPreviousSession(new TokenStorage(), [new NotSupportingUserProvider(), new NotSupportingUserProvider()]);
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
index 3796f871562c6..9dd4ebb25009d 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\Firewall\LogoutListener;
class LogoutListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testHandleUnmatchedPath()
{
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener();
@@ -122,11 +125,9 @@ public function testHandleMatchedPathWithoutSuccessHandlerAndCsrfValidation()
$listener->handle($event);
}
- /**
- * @expectedException \RuntimeException
- */
public function testSuccessHandlerReturnsNonResponse()
{
+ $this->expectException('RuntimeException');
$successHandler = $this->getSuccessHandler();
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener($successHandler);
@@ -146,11 +147,9 @@ public function testSuccessHandlerReturnsNonResponse()
$listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\LogoutException
- */
public function testCsrfValidationFails()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\LogoutException');
$tokenManager = $this->getTokenManager();
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener(null, $tokenManager);
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
index 57d297103ec80..8a1dbce9d8b38 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Firewall\RememberMeListener;
@@ -19,6 +20,8 @@
class RememberMeListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage()
{
list($listener, $tokenStorage) = $this->getListener();
@@ -103,12 +106,10 @@ public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenti
$listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
- * @expectedExceptionMessage Authentication failed.
- */
public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExceptionThrownAuthenticationManagerImplementation()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
+ $this->expectExceptionMessage('Authentication failed.');
list($listener, $tokenStorage, $service, $manager) = $this->getListener(false, false);
$tokenStorage
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
index ee5334c1e79b2..6328ddf52346c 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Firewall\RemoteUserAuthenticationListener;
class RemoteUserAuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetPreAuthenticatedData()
{
$serverVars = [
@@ -42,11 +45,9 @@ public function testGetPreAuthenticatedData()
$this->assertSame($result, ['TheUser', null]);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testGetPreAuthenticatedDataNoUser()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$request = new Request([], [], [], [], [], []);
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
index 6db9950fdf4e3..48f36de2e0167 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
@@ -50,12 +50,10 @@ private function doSetUp()
$this->event = new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $this->request, HttpKernelInterface::MASTER_REQUEST);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage $providerKey must not be empty
- */
public function testProviderKeyIsRequired()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('$providerKey must not be empty');
new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, '', $this->accessDecisionManager);
}
@@ -68,22 +66,18 @@ public function testEventIsIgnoredIfUsernameIsNotPassedWithTheRequest()
$this->assertNull($this->tokenStorage->getToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
- */
public function testExitUserThrowsAuthenticationExceptionIfNoCurrentToken()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
$this->tokenStorage->setToken(null);
$this->request->query->set('_switch_user', '_exit');
$listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);
$listener->handle($this->event);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
- */
public function testExitUserThrowsAuthenticationExceptionIfOriginalTokenCannotBeFound()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
$token = new UsernamePasswordToken('username', '', 'key', ['ROLE_FOO']);
$this->tokenStorage->setToken($token);
@@ -158,11 +152,9 @@ public function testExitUserDoesNotDispatchEventWithStringUser()
$listener->handle($this->event);
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
- */
public function testSwitchUserIsDisallowed()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
$token = new UsernamePasswordToken('username', '', 'key', ['ROLE_FOO']);
$this->tokenStorage->setToken($token);
@@ -270,11 +262,9 @@ public function testSwitchUserWithReplacedToken()
$this->assertSame($replacedToken, $this->tokenStorage->getToken());
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
- */
public function testSwitchtUserThrowsAuthenticationExceptionIfNoCurrentToken()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException');
$this->tokenStorage->setToken(null);
$this->request->query->set('_switch_user', 'username');
$listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
index 61455745289df..30feeb95b2e56 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Tests\Http\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -26,6 +27,8 @@
class UsernamePasswordFormAuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getUsernameForLength
*/
@@ -78,11 +81,11 @@ public function testHandleWhenUsernameLength($username, $ok)
/**
* @dataProvider postOnlyDataProvider
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "_username" must be a string, "array" given.
*/
public function testHandleNonStringUsernameWithArray($postOnly)
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "_username" must be a string, "array" given.');
$request = Request::create('/login_check', 'POST', ['_username' => []]);
$request->setSession($this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock());
$listener = new UsernamePasswordFormAuthenticationListener(
@@ -101,11 +104,11 @@ public function testHandleNonStringUsernameWithArray($postOnly)
/**
* @dataProvider postOnlyDataProvider
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "_username" must be a string, "integer" given.
*/
public function testHandleNonStringUsernameWithInt($postOnly)
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "_username" must be a string, "integer" given.');
$request = Request::create('/login_check', 'POST', ['_username' => 42]);
$request->setSession($this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock());
$listener = new UsernamePasswordFormAuthenticationListener(
@@ -124,11 +127,11 @@ public function testHandleNonStringUsernameWithInt($postOnly)
/**
* @dataProvider postOnlyDataProvider
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "_username" must be a string, "object" given.
*/
public function testHandleNonStringUsernameWithObject($postOnly)
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "_username" must be a string, "object" given.');
$request = Request::create('/login_check', 'POST', ['_username' => new \stdClass()]);
$request->setSession($this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock());
$listener = new UsernamePasswordFormAuthenticationListener(
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
index 7d2e55906b1d9..ad8d3cd9f7c44 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Tests\Http\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -31,6 +32,8 @@
*/
class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @var UsernamePasswordJsonAuthenticationListener
*/
@@ -104,12 +107,10 @@ public function testUsePath()
$this->assertEquals('ok', $event->getResponse()->getContent());
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage Invalid JSON
- */
public function testAttemptAuthenticationNoJson()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('Invalid JSON');
$this->createListener();
$request = new Request();
$request->setRequestFormat('json');
@@ -118,12 +119,10 @@ public function testAttemptAuthenticationNoJson()
$this->listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "username" must be provided
- */
public function testAttemptAuthenticationNoUsername()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "username" must be provided');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"usr": "dunglas", "password": "foo"}');
$event = new GetResponseEvent($this->getMockBuilder(KernelInterface::class)->getMock(), $request, KernelInterface::MASTER_REQUEST);
@@ -131,12 +130,10 @@ public function testAttemptAuthenticationNoUsername()
$this->listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "password" must be provided
- */
public function testAttemptAuthenticationNoPassword()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "password" must be provided');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": "dunglas", "pass": "foo"}');
$event = new GetResponseEvent($this->getMockBuilder(KernelInterface::class)->getMock(), $request, KernelInterface::MASTER_REQUEST);
@@ -144,12 +141,10 @@ public function testAttemptAuthenticationNoPassword()
$this->listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "username" must be a string.
- */
public function testAttemptAuthenticationUsernameNotAString()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "username" must be a string.');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": 1, "password": "foo"}');
$event = new GetResponseEvent($this->getMockBuilder(KernelInterface::class)->getMock(), $request, KernelInterface::MASTER_REQUEST);
@@ -157,12 +152,10 @@ public function testAttemptAuthenticationUsernameNotAString()
$this->listener->handle($event);
}
- /**
- * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
- * @expectedExceptionMessage The key "password" must be a string.
- */
public function testAttemptAuthenticationPasswordNotAString()
{
+ $this->expectException('Symfony\Component\HttpKernel\Exception\BadRequestHttpException');
+ $this->expectExceptionMessage('The key "password" must be a string.');
$this->createListener();
$request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": "dunglas", "password": 1}');
$event = new GetResponseEvent($this->getMockBuilder(KernelInterface::class)->getMock(), $request, KernelInterface::MASTER_REQUEST);
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
index 577ca7c38f1b3..b82b616a637f7 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Firewall\X509AuthenticationListener;
class X509AuthenticationListenerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider dataProviderGetPreAuthenticatedData
*/
@@ -83,11 +86,9 @@ public static function dataProviderGetPreAuthenticatedDataNoUser()
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com'];
}
- /**
- * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
- */
public function testGetPreAuthenticatedDataNoData()
{
+ $this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
$request = new Request([], [], [], [], [], []);
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
index a4a76747e5a58..016a22655a40e 100644
--- a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@@ -21,6 +22,8 @@
class HttpUtilsTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testCreateRedirectResponseWithPath()
{
$utils = new HttpUtils($this->getUrlGenerator());
@@ -251,11 +254,9 @@ public function testCheckRequestPathWithUrlMatcherAndResourceFoundByRequest()
$this->assertTrue($utils->checkRequestPath($request, 'foobar'));
}
- /**
- * @expectedException \RuntimeException
- */
public function testCheckRequestPathWithUrlMatcherLoadingException()
{
+ $this->expectException('RuntimeException');
$urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
$urlMatcher
->expects($this->any())
@@ -280,12 +281,10 @@ public function testCheckPathWithoutRouteParam()
$this->assertFalse($utils->checkRequestPath($this->getRequest(), 'path/index.html'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Matcher must either implement UrlMatcherInterface or RequestMatcherInterface
- */
public function testUrlMatcher()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface');
new HttpUtils($this->getUrlGenerator(), new \stdClass());
}
@@ -307,12 +306,10 @@ public function testGenerateUriPreservesFragment()
$this->assertEquals('/foo/bar#fragment', $utils->generateUri(new Request(), 'route_name'));
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage You must provide a UrlGeneratorInterface instance to be able to use routes.
- */
public function testUrlGeneratorIsRequiredToGenerateUrl()
{
+ $this->expectException('LogicException');
+ $this->expectExceptionMessage('You must provide a UrlGeneratorInterface instance to be able to use routes.');
$utils = new HttpUtils();
$utils->generateUri(new Request(), 'route_name');
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
index cdade5e870cf4..7665117e074b1 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
@@ -50,12 +50,10 @@ public function testGetLogoutPath()
$this->assertSame('/logout', $this->generator->getLogoutPath('secured_area'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage No LogoutListener found for firewall key "unregistered_key".
- */
public function testGetLogoutPathWithoutLogoutListenerRegisteredForKeyThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('No LogoutListener found for firewall key "unregistered_key".');
$this->generator->registerListener('secured_area', '/logout', null, null, null);
$this->generator->getLogoutPath('unregistered_key');
@@ -69,12 +67,10 @@ public function testGuessFromToken()
$this->assertSame('/logout', $this->generator->getLogoutPath());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Unable to generate a logout url for an anonymous token.
- */
public function testGuessFromAnonymousTokenThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Unable to generate a logout url for an anonymous token.');
$this->tokenStorage->setToken(new AnonymousToken('default', 'anon.'));
$this->generator->getLogoutPath();
@@ -105,12 +101,10 @@ public function testGuessFromTokenWithoutProviderKeyFallbacksToCurrentFirewall()
$this->assertSame('/logout', $this->generator->getLogoutPath());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Unable to find the current firewall LogoutListener, please provide the provider key manually
- */
public function testUnableToGuessThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('Unable to find the current firewall LogoutListener, please provide the provider key manually');
$this->generator->registerListener('secured_area', '/logout', null, null);
$this->generator->getLogoutPath();
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
index 3709a92bba50e..0cf4654bcc6d2 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
@@ -42,11 +42,9 @@ public function testAutoLoginReturnsNullWhenNoCookie()
$this->assertNull($service->autoLogin(new Request()));
}
- /**
- * @expectedException \RuntimeException
- */
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
{
+ $this->expectException('RuntimeException');
$service = $this->getService(null, ['name' => 'foo', 'path' => null, 'domain' => null]);
$request = new Request();
$request->cookies->set('foo', 'foo');
@@ -270,12 +268,10 @@ public function testEncodeCookieAndDecodeCookieAreInvertible()
$this->assertSame($cookieParts, $decoded);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage cookie delimiter
- */
public function testThereShouldBeNoCookieDelimiterInCookieParts()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('cookie delimiter');
$cookieParts = ['aa', 'b'.AbstractRememberMeServices::COOKIE_DELIMITER.'b', 'cc'];
$service = $this->getService();
diff --git a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
index 6c0df8cb5f2cb..4ef0b80b06970 100644
--- a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Security\Http\Tests\Session;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
class SessionAuthenticationStrategyTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testSessionIsNotChanged()
{
$request = $this->getRequest();
@@ -25,12 +28,10 @@ public function testSessionIsNotChanged()
$strategy->onAuthentication($request, $this->getToken());
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Invalid session authentication strategy "foo"
- */
public function testUnsupportedStrategy()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Invalid session authentication strategy "foo"');
$request = $this->getRequest();
$request->expects($this->never())->method('getSession');
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
index 9b54221d7630d..203eb3c92b93b 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Annotation;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Annotation\Groups;
/**
@@ -19,27 +20,23 @@
*/
class GroupsTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- */
+ use ForwardCompatTestTrait;
+
public function testEmptyGroupsParameter()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
new Groups(['value' => []]);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- */
public function testNotAnArrayGroupsParameter()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
new Groups(['value' => 12]);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- */
public function testInvalidGroupsParameter()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
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 16f10e143459b..8cca874ecd2a5 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Annotation;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/**
@@ -19,12 +20,12 @@
*/
class MaxDepthTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- * @expectedExceptionMessage Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" should be set.
- */
+ use ForwardCompatTestTrait;
+
public function testNotSetMaxDepthParameter()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" should be set.');
new MaxDepth([]);
}
@@ -40,12 +41,11 @@ public function provideInvalidValues()
/**
* @dataProvider provideInvalidValues
- *
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- * @expectedExceptionMessage Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" must be a positive integer.
*/
public function testNotAnIntMaxDepthParameter($value)
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $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/DependencyInjection/SerializerPassTest.php b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
index 5c3fedfe895a7..d5e044504f584 100644
--- a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
+++ b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
@@ -23,12 +24,12 @@
*/
class SerializerPassTest extends TestCase
{
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must tag at least one service as "serializer.normalizer" to use the "serializer" service
- */
+ use ForwardCompatTestTrait;
+
public function testThrowExceptionWhenNoNormalizers()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must tag at least one service as "serializer.normalizer" to use the "serializer" service');
$container = new ContainerBuilder();
$container->register('serializer');
@@ -36,12 +37,10 @@ public function testThrowExceptionWhenNoNormalizers()
$serializerPass->process($container);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage You must tag at least one service as "serializer.encoder" to use the "serializer" service
- */
public function testThrowExceptionWhenNoEncoders()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('You must tag at least one service as "serializer.encoder" to use the "serializer" service');
$container = new ContainerBuilder();
$container->register('serializer')
->addArgument([])
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
index ecb37f2300843..659930c41e524 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
@@ -73,11 +73,9 @@ public function testDecode()
$this->chainDecoder->decode('string_to_decode', self::FORMAT_2);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\RuntimeException
- */
public function testDecodeUnsupportedFormat()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
$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 2a0f85d04a981..bfec205a273d1 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
@@ -75,11 +75,9 @@ public function testEncode()
$this->chainEncoder->encode(['foo' => 123], self::FORMAT_2);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\RuntimeException
- */
public function testEncodeUnsupportedFormat()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
$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 2d9550d26fe36..f5d0dc5a3c963 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
@@ -61,10 +61,10 @@ public function decodeProvider()
/**
* @requires function json_last_error_msg
* @dataProvider decodeProviderException
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
*/
public function testDecodeWithException($value)
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$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 e7c6a4f39bb71..6c16e99c15b97 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
@@ -54,10 +54,10 @@ public function encodeProvider()
/**
* @requires function json_last_error_msg
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
*/
public function testEncodeWithError()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$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 0080112baad85..27e1a55b02e3c 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
@@ -68,11 +68,9 @@ public function testOptions()
$this->assertEquals($expected, $this->serializer->serialize($arr, 'json'), 'Context should not be persistent');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testEncodeNotUtf8WithoutPartialOnError()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$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 bcfbeab2d2e86..26ac844781079 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -62,12 +62,10 @@ public function testSetRootNodeName()
$this->assertEquals($expected, $this->encoder->encode($obj, 'xml'));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage Document types are not allowed.
- */
public function testDocTypeIsNotAllowed()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectExceptionMessage('Document types are not allowed.');
$this->encoder->decode('', 'foo');
}
@@ -562,19 +560,15 @@ public function testDecodeWithoutItemHash()
$this->assertEquals($expected, $this->encoder->decode($xml, 'xml'));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDecodeInvalidXml()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$this->encoder->decode('', 'xml');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testPreventsComplexExternalEntities()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$this->encoder->decode(']>&test;', 'xml');
}
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
index 067f16acf9c36..8c5d61e2617ee 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
@@ -23,6 +24,8 @@
*/
class CacheMetadataFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetMetadataFor()
{
$metadata = new ClassMetadata(Dummy::class);
@@ -55,11 +58,9 @@ public function testHasMetadataFor()
$this->assertTrue($factory->hasMetadataFor(Dummy::class));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- */
public function testInvalidClassThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
$decorated = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock();
$factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter());
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
index 8d07809386fea..00674e2423ee9 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -55,11 +55,9 @@ public function testLoadClassMetadataReturnsFalseWhenEmpty()
$this->assertFalse($loader->loadClassMetadata($this->metadata));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\MappingException
- */
public function testLoadClassMetadataReturnsThrowsInvalidMapping()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\MappingException');
$loader = new YamlFileLoader(__DIR__.'/../../Fixtures/invalid-mapping.yml');
$loader->loadClassMetadata($this->metadata);
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
index 1e3eb9b5ede36..d76ac4c165b2b 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
@@ -50,12 +50,10 @@ public function testInstantiateObjectDenormalizer()
$this->assertInstanceOf(__NAMESPACE__.'\Dummy', $normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), []));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\ExtraAttributesException
- * @expectedExceptionMessage Extra attributes are not allowed ("fooFoo", "fooBar" are unknown).
- */
public function testDenormalizeWithExtraAttributes()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\ExtraAttributesException');
+ $this->expectExceptionMessage('Extra attributes are not allowed ("fooFoo", "fooBar" are unknown).');
$factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$normalizer = new AbstractObjectNormalizerDummy($factory);
$normalizer->denormalize(
@@ -66,12 +64,10 @@ public function testDenormalizeWithExtraAttributes()
);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\ExtraAttributesException
- * @expectedExceptionMessage Extra attributes are not allowed ("fooFoo", "fooBar" are unknown).
- */
public function testDenormalizeWithExtraAttributesAndNoGroupsWithMetadataFactory()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\ExtraAttributesException');
+ $this->expectExceptionMessage('Extra attributes are not allowed ("fooFoo", "fooBar" are unknown).');
$normalizer = new AbstractObjectNormalizerWithMetadata();
$normalizer->denormalize(
['fooFoo' => 'foo', 'fooBar' => 'bar', 'bar' => 'bar'],
@@ -152,12 +148,11 @@ private function getDenormalizerForDummyCollection()
/**
* Test that additional attributes throw an exception if no metadata factory is specified.
- *
- * @expectedException \Symfony\Component\Serializer\Exception\LogicException
- * @expectedExceptionMessage A class metadata factory must be provided in the constructor when setting "allow_extra_attributes" to false.
*/
public function testExtraAttributesException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectExceptionMessage('A class metadata factory must be provided in the constructor when setting "allow_extra_attributes" to false.');
$normalizer = new ObjectNormalizer();
$normalizer->denormalize([], \stdClass::class, 'xml', [
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
index ba252106a4eab..6f327657dabc1 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
@@ -114,21 +114,19 @@ public function testDenormalizeHttpFoundationFile()
$this->assertSame(file_get_contents(self::TEST_GIF_DATA), $this->getContent($file->openFile()));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage The provided "data:" URI is not valid.
- */
public function testGiveNotAccessToLocalFiles()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectExceptionMessage('The provided "data:" URI is not valid.');
$this->normalizer->denormalize('/etc/shadow', 'SplFileObject');
}
/**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
* @dataProvider invalidUriProvider
*/
public function testInvalidData($uri)
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$this->normalizer->denormalize($uri, 'SplFileObject');
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
index 0352bb87cf1a5..2f4bee62c2149 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
@@ -64,12 +64,10 @@ public function testNormalizeUsingFormatPassedInConstructor($format, $output, $i
$this->assertEquals($output, (new DateIntervalNormalizer($format))->normalize(new \DateInterval($input)));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- * @expectedExceptionMessage The object must be an instance of "\DateInterval".
- */
public function testNormalizeInvalidObjectThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The object must be an instance of "\DateInterval".');
$this->normalizer->normalize(new \stdClass());
}
@@ -100,36 +98,28 @@ public function testDenormalizeUsingFormatPassedInConstructor($format, $input, $
$this->assertDateIntervalEquals(new \DateInterval($output), (new DateIntervalNormalizer($format))->denormalize($input, \DateInterval::class));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- */
public function testDenormalizeExpectsString()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
$this->normalizer->denormalize(1234, \DateInterval::class);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage Expected a valid ISO 8601 interval string.
- */
public function testDenormalizeNonISO8601IntervalStringThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectExceptionMessage('Expected a valid ISO 8601 interval string.');
$this->normalizer->denormalize('10 years 2 months 3 days', \DateInterval::class, null);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDenormalizeInvalidDataThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$this->normalizer->denormalize('invalid interval', \DateInterval::class);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDenormalizeFormatMismatchThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$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 33463f49346d2..0234cf27cc040 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
@@ -157,12 +157,10 @@ public function normalizeUsingTimeZonePassedInContextAndExpectedFormatWithMicros
];
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- * @expectedExceptionMessage The object must implement the "\DateTimeInterface".
- */
public function testNormalizeInvalidObjectThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The object must implement the "\DateTimeInterface".');
$this->normalizer->normalize(new \stdClass());
}
@@ -238,37 +236,29 @@ public function denormalizeUsingTimezonePassedInContextProvider()
];
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDenormalizeInvalidDataThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$this->normalizer->denormalize('invalid date', \DateTimeInterface::class);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage 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.
- */
public function testDenormalizeNullThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $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);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage 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.
- */
public function testDenormalizeEmptyStringThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $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);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDenormalizeFormatMismatchThrowsException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$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/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
index 809284d525080..3ce06b659f80c 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
@@ -322,11 +322,9 @@ public function testCallbacks($callbacks, $value, $result, $message)
);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testUncallableCallbacks()
{
+ $this->expectException('InvalidArgumentException');
$this->normalizer->setCallbacks(['bar' => null]);
$obj = new GetConstructorDummy('baz', 'quux', true);
@@ -409,12 +407,10 @@ public function provideCallbacks()
];
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\LogicException
- * @expectedExceptionMessage Cannot normalize attribute "object" because the injected serializer is not a normalizer
- */
public function testUnableToNormalizeObjectAttribute()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectExceptionMessage('Cannot normalize attribute "object" because the injected serializer is not a normalizer');
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
$this->normalizer->setSerializer($serializer);
@@ -425,11 +421,9 @@ public function testUnableToNormalizeObjectAttribute()
$this->normalizer->normalize($obj, 'any');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\CircularReferenceException
- */
public function testUnableToNormalizeCircularReference()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\CircularReferenceException');
$serializer = new Serializer([$this->normalizer]);
$this->normalizer->setSerializer($serializer);
$this->normalizer->setCircularReferenceLimit(2);
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
index 9af0d2171fdf5..0532ef47c093b 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
@@ -63,11 +63,9 @@ public function testNormalize()
$this->assertEquals('string_object', $this->normalizer->normalize(new JsonSerializableDummy()));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\CircularReferenceException
- */
public function testCircularNormalize()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\CircularReferenceException');
$this->normalizer->setCircularReferenceLimit(1);
$this->serializer
@@ -83,12 +81,10 @@ public function testCircularNormalize()
$this->assertEquals('string_object', $this->normalizer->normalize(new JsonSerializableDummy()));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
- * @expectedExceptionMessage The object must implement "JsonSerializable".
- */
public function testInvalidDataThrowException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The object must implement "JsonSerializable".');
$this->normalizer->normalize(new \stdClass());
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
index 31679c3c6a95a..2a27c1646ca00 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
@@ -185,12 +185,10 @@ public function testConstructorWithObjectTypeHintDenormalize()
$this->assertEquals('rab', $obj->getInner()->bar);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\RuntimeException
- * @expectedExceptionMessage Could not determine the class of the parameter "unknown".
- */
public function testConstructorWithUnknownObjectTypeHintDenormalize()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\RuntimeException');
+ $this->expectExceptionMessage('Could not determine the class of the parameter "unknown".');
$data = [
'id' => 10,
'unknown' => [
@@ -358,11 +356,9 @@ public function testCallbacks($callbacks, $value, $result, $message)
);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testUncallableCallbacks()
{
+ $this->expectException('InvalidArgumentException');
$this->normalizer->setCallbacks(['bar' => null]);
$obj = new ObjectConstructorDummy('baz', 'quux', true);
@@ -469,12 +465,10 @@ public function provideCallbacks()
];
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\LogicException
- * @expectedExceptionMessage Cannot normalize attribute "object" because the injected serializer is not a normalizer
- */
public function testUnableToNormalizeObjectAttribute()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectExceptionMessage('Cannot normalize attribute "object" because the injected serializer is not a normalizer');
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
$this->normalizer->setSerializer($serializer);
@@ -485,11 +479,9 @@ public function testUnableToNormalizeObjectAttribute()
$this->normalizer->normalize($obj, 'any');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\CircularReferenceException
- */
public function testUnableToNormalizeCircularReference()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\CircularReferenceException');
$serializer = new Serializer([$this->normalizer]);
$this->normalizer->setSerializer($serializer);
$this->normalizer->setCircularReferenceLimit(2);
@@ -603,11 +595,9 @@ public function testMaxDepth()
$this->assertEquals($expected, $result);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testThrowUnexpectedValueException()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$this->normalizer->denormalize(['foo' => 'bar'], ObjectTypeHinted::class);
}
@@ -640,24 +630,20 @@ public function testAcceptJsonNumber()
$this->assertSame(10.0, $serializer->denormalize(['number' => 10], JsonNumber::class, 'jsonld')->number);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage The type of the "date" attribute for class "Symfony\Component\Serializer\Tests\Normalizer\ObjectOuter" must be one of "DateTimeInterface" ("string" given).
- */
public function testRejectInvalidType()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectExceptionMessage('The type of the "date" attribute for class "Symfony\Component\Serializer\Tests\Normalizer\ObjectOuter" must be one of "DateTimeInterface" ("string" given).');
$normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor());
$serializer = new Serializer([$normalizer]);
$serializer->denormalize(['date' => 'foo'], ObjectOuter::class);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- * @expectedExceptionMessage The type of the key "a" must be "int" ("string" given).
- */
public function testRejectInvalidKey()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
+ $this->expectExceptionMessage('The type of the key "a" must be "int" ("string" given).');
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
$normalizer = new ObjectNormalizer(null, null, null, $extractor);
$serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]);
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
index 5223496d8982f..3ed994caaf7fc 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
@@ -135,11 +135,9 @@ public function testCallbacks($callbacks, $value, $result, $message)
);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testUncallableCallbacks()
{
+ $this->expectException('InvalidArgumentException');
$this->normalizer->setCallbacks(['bar' => null]);
$obj = new PropertyConstructorDummy('baz', 'quux');
@@ -323,11 +321,9 @@ public function provideCallbacks()
];
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\CircularReferenceException
- */
public function testUnableToNormalizeCircularReference()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\CircularReferenceException');
$serializer = new Serializer([$this->normalizer]);
$this->normalizer->setSerializer($serializer);
$this->normalizer->setCircularReferenceLimit(2);
@@ -382,12 +378,10 @@ public function testDenormalizeShouldIgnoreStaticProperty()
$this->assertEquals('out_of_scope', PropertyDummy::$outOfScope);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\LogicException
- * @expectedExceptionMessage Cannot normalize attribute "bar" because the injected serializer is not a normalizer
- */
public function testUnableToNormalizeObjectAttribute()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
+ $this->expectExceptionMessage('Cannot normalize attribute "bar" because the injected serializer is not a normalizer');
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
$this->normalizer->setSerializer($serializer);
diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php
index 405317d5fb26a..03708ab048702 100644
--- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Serializer\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
@@ -30,6 +31,8 @@
class SerializerTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testInterface()
{
$serializer = new Serializer();
@@ -41,11 +44,9 @@ public function testInterface()
$this->assertInstanceOf('Symfony\Component\Serializer\Encoder\DecoderInterface', $serializer);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testNormalizeNoMatch()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([$this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()]);
$serializer->normalize(new \stdClass(), 'xml');
}
@@ -64,29 +65,23 @@ public function testNormalizeGivesPriorityToInterfaceOverTraversable()
$this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testNormalizeOnDenormalizer()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([new TestDenormalizer()], []);
$this->assertTrue($serializer->normalize(new \stdClass(), 'json'));
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDenormalizeNoMatch()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([$this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()]);
$serializer->denormalize('foo', 'stdClass');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDenormalizeOnNormalizer()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([new TestNormalizer()], []);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$this->assertTrue($serializer->denormalize(json_encode($data), 'stdClass', 'json'));
@@ -168,21 +163,17 @@ public function testSerializeArrayOfScalars()
$this->assertEquals(json_encode($data), $result);
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testSerializeNoEncoder()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([], []);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->serialize($data, 'json');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\LogicException
- */
public function testSerializeNoNormalizer()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
$serializer = new Serializer([], ['json' => new JsonEncoder()]);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->serialize(Model::fromArray($data), 'json');
@@ -206,31 +197,25 @@ public function testDeserializeUseCache()
$this->assertEquals($data, $result->toArray());
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\LogicException
- */
public function testDeserializeNoNormalizer()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\LogicException');
$serializer = new Serializer([], ['json' => new JsonEncoder()]);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDeserializeWrongNormalizer()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json');
}
- /**
- * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
- */
public function testDeserializeNoEncoder()
{
+ $this->expectException('Symfony\Component\Serializer\Exception\UnexpectedValueException');
$serializer = new Serializer([], []);
$data = ['title' => 'foo', 'numbers' => [5, 3]];
$serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json');
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
index 415ab3e9d56b0..2fa7f563938b1 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Stopwatch\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Stopwatch\StopwatchEvent;
/**
@@ -23,6 +24,8 @@
*/
class StopwatchEventTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const DELTA = 37;
public function testGetOrigin()
@@ -103,11 +106,9 @@ public function testDurationBeforeStop()
$this->assertEquals(100, $event->getDuration(), '', self::DELTA);
}
- /**
- * @expectedException \LogicException
- */
public function testStopWithoutStart()
{
+ $this->expectException('LogicException');
$event = new StopwatchEvent(microtime(true) * 1000);
$event->stop();
}
@@ -154,11 +155,9 @@ public function testStartTime()
$this->assertEquals(0, $event->getStartTime(), '', self::DELTA);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInvalidOriginThrowsAnException()
{
+ $this->expectException('InvalidArgumentException');
new StopwatchEvent('abc');
}
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
index d70e803e43d89..6a7ef1582c3d1 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
@@ -93,20 +93,16 @@ public function testStop()
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
}
- /**
- * @expectedException \LogicException
- */
public function testUnknownEvent()
{
+ $this->expectException('LogicException');
$stopwatch = new Stopwatch();
$stopwatch->getEvent('foo');
}
- /**
- * @expectedException \LogicException
- */
public function testStopWithoutStart()
{
+ $this->expectException('LogicException');
$stopwatch = new Stopwatch();
$stopwatch->stop('foo');
}
@@ -168,11 +164,9 @@ public function testReopenASection()
$this->assertCount(2, $events['__section__']->getPeriods());
}
- /**
- * @expectedException \LogicException
- */
public function testReopenANewSectionShouldThrowAnException()
{
+ $this->expectException('LogicException');
$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 3d61ec2716b59..07c3387d46bdb 100644
--- a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Templating\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\DelegatingEngine;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\Templating\StreamingEngineInterface;
class DelegatingEngineTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testRenderDelegatesToSupportedEngine()
{
$firstEngine = $this->getEngineMock('template.php', false);
@@ -34,12 +37,10 @@ public function testRenderDelegatesToSupportedEngine()
$this->assertSame('', $result);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage No engine is able to work with the template "template.php"
- */
public function testRenderWithNoSupportedEngine()
{
+ $this->expectException('RuntimeException');
+ $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,12 +62,10 @@ public function testStreamDelegatesToSupportedEngine()
$this->assertNull($result);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Template "template.php" cannot be streamed as the engine supporting it does not implement StreamingEngineInterface
- */
public function testStreamRequiresStreamingEngine()
{
+ $this->expectException('LogicException');
+ $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']);
}
@@ -112,12 +111,10 @@ public function testGetExistingEngine()
$this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php'));
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage No engine is able to work with the template "template.php"
- */
public function testGetInvalidEngine()
{
+ $this->expectException('RuntimeException');
+ $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);
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index 6a19c98dcdaf6..247f81e17d4f4 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -127,11 +127,11 @@ public function testRenderParameter()
}
/**
- * @expectedException \InvalidArgumentException
* @dataProvider forbiddenParameterNames
*/
public function testRenderForbiddenParameter($name)
{
+ $this->expectException('InvalidArgumentException');
$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/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
index a638498b6bdef..b9996c8ed3e12 100644
--- a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
+++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
@@ -12,12 +12,15 @@
namespace Symfony\Component\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass;
class TranslationExtractorPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testProcess()
{
$container = new ContainerBuilder();
@@ -46,12 +49,10 @@ public function testProcessNoDefinitionFound()
$this->assertCount($aliasesBefore, $container->getAliases());
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The alias for the tag "translation.extractor" of service "foo.id" must be set.
- */
public function testProcessMissingAlias()
{
+ $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
+ $this->expectExceptionMessage('The alias for the tag "translation.extractor" of service "foo.id" must be set.');
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->disableOriginalConstructor()->getMock();
$container = new ContainerBuilder();
$container->register('translation.extractor');
diff --git a/src/Symfony/Component/Translation/Tests/IntervalTest.php b/src/Symfony/Component/Translation/Tests/IntervalTest.php
index 8da3bb151722a..cbeaea4250a5c 100644
--- a/src/Symfony/Component/Translation/Tests/IntervalTest.php
+++ b/src/Symfony/Component/Translation/Tests/IntervalTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\Interval;
class IntervalTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getTests
*/
@@ -24,11 +27,9 @@ public function testTest($expected, $number, $interval)
$this->assertEquals($expected, Interval::test($number, $interval));
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
- */
public function testTestException()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
Interval::test(1, 'foobar');
}
diff --git a/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
index 4fd5752db222b..13b76bf35b041 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\CsvFileLoader;
class CsvFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new CsvFileLoader();
@@ -39,21 +42,17 @@ public function testLoadDoesNothingIfEmpty()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new CsvFileLoader();
$resource = __DIR__.'/../fixtures/not-exists.csv';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadNonLocalResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$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 601680af8afd1..db845a8d82d5a 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Translation\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
@@ -19,11 +20,11 @@
*/
class IcuDatFileLoaderTest extends LocalizedTestCase
{
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
+ use ForwardCompatTestTrait;
+
public function testLoadInvalidResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new IcuDatFileLoader();
$loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2');
}
@@ -53,11 +54,9 @@ public function testDatFrenchLoad()
$this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$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 962c3af2efeb2..25d5082747ff1 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Translation\Tests\Loader;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Translation\Loader\IcuResFileLoader;
@@ -19,6 +20,8 @@
*/
class IcuResFileLoaderTest extends LocalizedTestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
// resource is build using genrb command
@@ -31,20 +34,16 @@ public function testLoad()
$this->assertEquals([new DirectoryResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new IcuResFileLoader();
$loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadInvalidResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$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 e0d8b2f4c4a09..47ffc9b967c85 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\IniFileLoader;
class IniFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new IniFileLoader();
@@ -39,11 +42,9 @@ public function testLoadDoesNothingIfEmpty()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$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 4c507da5abdfc..0d452e16dfac9 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\JsonFileLoader;
class JsonFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new JsonFileLoader();
@@ -39,22 +42,18 @@ public function testLoadDoesNothingIfEmpty()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new JsonFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.json';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- * @expectedExceptionMessage Error parsing JSON - Syntax error, malformed JSON
- */
public function testParseException()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectExceptionMessage('Error parsing JSON - Syntax error, malformed JSON');
$loader = new JsonFileLoader();
$resource = __DIR__.'/../fixtures/malformed.json';
$loader->load($resource, 'en', 'domain1');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
index d6adecb1736fd..f89584259fa4f 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\MoFileLoader;
class MoFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new MoFileLoader();
@@ -42,21 +45,17 @@ public function testLoadPlurals()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new MoFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.mo';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadInvalidResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$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 68cb2d0b72b51..d6e9712200c2c 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\PhpFileLoader;
class PhpFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new PhpFileLoader();
@@ -28,21 +31,17 @@ public function testLoad()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new PhpFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.php';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadThrowsAnExceptionIfFileNotLocal()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$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 cb94e90a9408f..e55d6db89958e 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\PoFileLoader;
class PoFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new PoFileLoader();
@@ -53,11 +56,9 @@ public function testLoadDoesNothingIfEmpty()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$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 6083b68f7a0d4..6e87b12d422fc 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
@@ -31,31 +31,25 @@ public function testLoad()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new QtFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.ts';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadNonLocalResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new QtFileLoader();
$resource = 'http://domain1.com/resources.ts';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadInvalidResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new QtFileLoader();
$resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf';
$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 af46c02d7693c..118fc4ea2af92 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -99,50 +99,40 @@ public function testTargetAttributesAreStoredCorrectly()
$this->assertEquals('translated', $metadata['target-attributes']['state']);
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadInvalidResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new XliffFileLoader();
$loader->load(__DIR__.'/../fixtures/resources.php', 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadResourceDoesNotValidate()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new XliffFileLoader();
$loader->load(__DIR__.'/../fixtures/non-valid.xlf', 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new XliffFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.xlf';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadThrowsAnExceptionIfFileNotLocal()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new XliffFileLoader();
$resource = 'http://example.com/resources.xlf';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- * @expectedExceptionMessage Document types are not allowed.
- */
public function testDocTypeIsNotAllowed()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
+ $this->expectExceptionMessage('Document types are not allowed.');
$loader = new XliffFileLoader();
$loader->load(__DIR__.'/../fixtures/withdoctype.xlf', 'en', 'domain1');
}
diff --git a/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
index a535db56fc0e4..d05d65d03079f 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\YamlFileLoader;
class YamlFileLoaderTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testLoad()
{
$loader = new YamlFileLoader();
@@ -39,31 +42,25 @@ public function testLoadDoesNothingIfEmpty()
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
- */
public function testLoadNonExistingResource()
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loader = new YamlFileLoader();
$resource = __DIR__.'/../fixtures/non-existing.yml';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadThrowsAnExceptionIfFileNotLocal()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$loader = new YamlFileLoader();
$resource = 'http://example.com/resources.yml';
$loader->load($resource, 'en', 'domain1');
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
- */
public function testLoadThrowsAnExceptionIfNotAnArray()
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
$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 0f9c8d684e3ba..4b10620733f5f 100644
--- a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
+++ b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\MessageCatalogue;
class MessageCatalogueTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetLocale()
{
$catalogue = new MessageCatalogue('en');
@@ -132,11 +135,9 @@ public function testAddFallbackCatalogue()
$this->assertEquals([$r, $r1, $r2], $catalogue->getResources());
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\LogicException
- */
public function testAddFallbackCatalogueWithParentCircularReference()
{
+ $this->expectException('Symfony\Component\Translation\Exception\LogicException');
$main = new MessageCatalogue('en_US');
$fallback = new MessageCatalogue('fr_FR');
@@ -144,11 +145,9 @@ public function testAddFallbackCatalogueWithParentCircularReference()
$main->addFallbackCatalogue($fallback);
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\LogicException
- */
public function testAddFallbackCatalogueWithFallbackCircularReference()
{
+ $this->expectException('Symfony\Component\Translation\Exception\LogicException');
$fr = new MessageCatalogue('fr');
$en = new MessageCatalogue('en');
$es = new MessageCatalogue('es');
@@ -158,11 +157,9 @@ public function testAddFallbackCatalogueWithFallbackCircularReference()
$en->addFallbackCatalogue($fr);
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\LogicException
- */
public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne()
{
+ $this->expectException('Symfony\Component\Translation\Exception\LogicException');
$catalogue = new MessageCatalogue('en');
$catalogue->addCatalogue(new MessageCatalogue('fr', []));
}
diff --git a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php
index a887411eed453..71dcc6169a433 100644
--- a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php
+++ b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\MessageSelector;
class MessageSelectorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider getChooseTests
*/
@@ -35,10 +38,10 @@ public function testReturnMessageIfExactlyOneStandardRuleIsGiven()
/**
* @dataProvider getNonMatchingMessages
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
*/
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$selector = new MessageSelector();
$selector->choose($id, $number, 'en');
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php
index ab6dc5b8d4d42..6d6a946c14496 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php
@@ -12,18 +12,21 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Translator;
class TranslatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
- * @dataProvider getInvalidLocalesTests
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
+ * @dataProvider getInvalidLocalesTests
*/
public function testConstructorInvalidLocale($locale)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
new Translator($locale);
}
@@ -55,11 +58,11 @@ public function testSetGetLocale()
}
/**
- * @dataProvider getInvalidLocalesTests
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
+ * @dataProvider getInvalidLocalesTests
*/
public function testSetInvalidLocale($locale)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$translator = new Translator('fr');
$translator->setLocale($locale);
}
@@ -138,11 +141,11 @@ public function testSetFallbackLocalesMultiple()
}
/**
- * @dataProvider getInvalidLocalesTests
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
+ * @dataProvider getInvalidLocalesTests
*/
public function testSetFallbackInvalidLocales($locale)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$translator = new Translator('fr');
$translator->setFallbackLocales(['fr', $locale]);
}
@@ -170,11 +173,11 @@ public function testTransWithFallbackLocale()
}
/**
- * @dataProvider getInvalidLocalesTests
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
+ * @dataProvider getInvalidLocalesTests
*/
public function testAddResourceInvalidLocales($locale)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$translator = new Translator('fr');
$translator->addResource('array', ['foo' => 'foofoo'], $locale);
}
@@ -205,11 +208,11 @@ public function testAddResourceAfterTrans()
}
/**
- * @dataProvider getTransFileTests
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ * @dataProvider getTransFileTests
*/
public function testTransWithoutFallbackLocaleFile($format, $loader)
{
+ $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException');
$loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader;
$translator = new Translator('en');
$translator->addLoader($format, new $loaderClass());
@@ -264,11 +267,9 @@ public function testTransNonExistentWithFallback()
$this->assertEquals('non-existent', $translator->trans('non-existent'));
}
- /**
- * @expectedException \Symfony\Component\Translation\Exception\RuntimeException
- */
public function testWhenAResourceHasNoRegisteredLoader()
{
+ $this->expectException('Symfony\Component\Translation\Exception\RuntimeException');
$translator = new Translator('en');
$translator->addResource('array', ['foo' => 'foofoo'], 'en');
@@ -318,11 +319,11 @@ public function testTrans($expected, $id, $translation, $parameters, $locale, $d
}
/**
- * @dataProvider getInvalidLocalesTests
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
+ * @dataProvider getInvalidLocalesTests
*/
public function testTransInvalidLocale($locale)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$translator = new Translator('en');
$translator->addLoader('array', new ArrayLoader());
$translator->addResource('array', ['foo' => 'foofoo'], 'en');
@@ -331,7 +332,7 @@ public function testTransInvalidLocale($locale)
}
/**
- * @dataProvider getValidLocalesTests
+ * @dataProvider getValidLocalesTests
*/
public function testTransValidLocale($locale)
{
@@ -368,11 +369,11 @@ public function testTransChoice($expected, $id, $translation, $number, $paramete
}
/**
- * @dataProvider getInvalidLocalesTests
- * @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
+ * @dataProvider getInvalidLocalesTests
*/
public function testTransChoiceInvalidLocale($locale)
{
+ $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
$translator = new Translator('en');
$translator->addLoader('array', new ArrayLoader());
$translator->addResource('array', ['foo' => 'foofoo'], 'en');
@@ -381,7 +382,7 @@ public function testTransChoiceInvalidLocale($locale)
}
/**
- * @dataProvider getValidLocalesTests
+ * @dataProvider getValidLocalesTests
*/
public function testTransChoiceValidLocale($locale)
{
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintTest.php b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
index cc36eaac8c647..9ebcd4e84c98b 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
@@ -207,11 +207,9 @@ public function testSerializeKeepsCustomGroups()
$this->assertSame(['MyGroup'], $constraint->groups);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\InvalidArgumentException
- */
public function testGetErrorNameForUnknownCode()
{
+ $this->expectException('Symfony\Component\Validator\Exception\InvalidArgumentException');
Constraint::getErrorName(1);
}
@@ -226,12 +224,10 @@ public function testOptionsAsDefaultOption()
$this->assertEquals($options, $constraint->property2);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\InvalidOptionsException
- * @expectedExceptionMessage The options "0", "5" do not exist in constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintA".
- */
public function testInvalidOptions()
{
+ $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
+ $this->expectExceptionMessage('The options "0", "5" do not exist in constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintA".');
new ConstraintA(['property2' => 'foo', 'bar', 5 => 'baz']);
}
@@ -246,12 +242,10 @@ public function testOptionsWithInvalidInternalPointer()
$this->assertEquals('foo', $constraint->property1);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- * @expectedExceptionMessage No default option is configured for constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintB".
- */
public function testAnnotationSetUndefinedDefaultOption()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $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 b2f30e7ad1c5d..aefb874fe415a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
@@ -84,20 +84,18 @@ public function provideInvalidConstraintOptions()
/**
* @dataProvider provideInvalidConstraintOptions
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- * @expectedExceptionMessage requires either the "value" or "propertyPath" option to be set.
*/
public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options)
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectExceptionMessage('requires either the "value" or "propertyPath" option to be set.');
$this->createConstraint($options);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- * @expectedExceptionMessage requires only one of the "value" or "propertyPath" options to be set, not both.
- */
public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
+ $this->expectExceptionMessage('requires only one of the "value" or "propertyPath" options to be set, not both.');
$this->createConstraint(([
'value' => 'value',
'propertyPath' => 'propertyPath',
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
index cdd72a22ebc58..450248a6b336c 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Valid;
@@ -20,21 +21,19 @@
*/
class AllTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
+ use ForwardCompatTestTrait;
+
public function testRejectNonConstraints()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new All([
'foo',
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testRejectValidConstraint()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
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 1752f47e700a5..09d756d465864 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\AllValidator;
use Symfony\Component\Validator\Constraints\NotNull;
@@ -19,6 +20,8 @@
class AllValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new AllValidator();
@@ -31,11 +34,9 @@ public function testNullIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testThrowsExceptionIfNotTraversable()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate('foo.barbar', new All(new Range(['min' => 4])));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
index 1c771c2c13aa3..61b72e03aab58 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\CallbackValidator;
@@ -46,6 +47,8 @@ public static function validateStatic($object, ExecutionContextInterface $contex
class CallbackValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new CallbackValidator();
@@ -180,21 +183,17 @@ public function testArrayCallableExplicitName()
->assertRaised();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testExpectValidMethods()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$object = new CallbackValidatorTest_Object();
$this->validator->validate($object, new Callback(['callback' => ['foobar']]));
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testExpectValidCallbacks()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$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 e83cb8997745a..9aeff71cf8e54 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\ChoiceValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -22,6 +23,8 @@ function choice_callback()
class ChoiceValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new ChoiceValidator();
@@ -37,11 +40,9 @@ public function objectMethodCallback()
return ['foo', 'bar'];
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectArrayIfMultipleIsTrue()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$constraint = new Choice([
'choices' => ['foo', 'bar'],
'multiple' => true,
@@ -64,19 +65,15 @@ public function testNullIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testChoicesOrCallbackExpected()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->validator->validate('foobar', new Choice(['strict' => true]));
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testValidCallbackExpected()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$this->validator->validate('foobar', new Choice(['callback' => 'abcd', 'strict' => true]));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
index fec935082afe4..477e8b38440f7 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Optional;
@@ -23,51 +24,43 @@
*/
class CollectionTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
+ use ForwardCompatTestTrait;
+
public function testRejectInvalidFieldsOption()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new Collection([
'fields' => 'foo',
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testRejectNonConstraints()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new Collection([
'foo' => 'bar',
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testRejectValidConstraint()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new Collection([
'foo' => new Valid(),
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testRejectValidConstraintWithinOptional()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new Collection([
'foo' => new Optional(new Valid()),
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testRejectValidConstraintWithinRequired()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
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 fa2ee0985ef1a..417949533dfc4 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\CollectionValidator;
use Symfony\Component\Validator\Constraints\NotNull;
@@ -21,6 +22,8 @@
abstract class CollectionValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new CollectionValidator();
@@ -52,11 +55,9 @@ public function testFieldsAsDefaultOption()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testThrowsExceptionIfNotTraversable()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 3070e6a22f334..4e6c8917006c0 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Composite;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
@@ -37,6 +38,8 @@ public function getDefaultOption()
*/
class CompositeTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testMergeNestedGroupsIfNoExplicitParentGroup()
{
$constraint = new ConcreteComposite([
@@ -79,11 +82,9 @@ public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups()
$this->assertEquals(['Strict'], $constraint->constraints[1]->groups);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new ConcreteComposite([
'constraints' => [
new NotNull(['groups' => ['Default', 'Foobar']]),
@@ -114,33 +115,27 @@ public function testSingleConstraintsAccepted()
$this->assertEquals([$nestedConstraint], $constraint->constraints);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testFailIfNoConstraint()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new ConcreteComposite([
new NotNull(['groups' => 'Default']),
'NotBlank',
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testFailIfNoConstraintObject()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
new ConcreteComposite([
new NotNull(['groups' => 'Default']),
new \ArrayObject(),
]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testValidCantBeNested()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
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 01e23cc3b92cd..ac845aa5478d3 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Count;
use Symfony\Component\Validator\Constraints\CountValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -20,6 +21,8 @@
*/
abstract class CountValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new CountValidator();
@@ -34,11 +37,9 @@ public function testNullIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsCountableType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 23c528363000a..6b12d6362914b 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraints\Country;
use Symfony\Component\Validator\Constraints\CountryValidator;
@@ -18,6 +19,8 @@
class CountryValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new CountryValidator();
@@ -37,11 +40,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 c699f851f26f5..fec42407af127 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraints\Currency;
use Symfony\Component\Validator\Constraints\CurrencyValidator;
@@ -18,6 +19,8 @@
class CurrencyValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new CurrencyValidator();
@@ -37,11 +40,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 6a8fa15b42030..e1fa819f42cbd 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\DateTime;
use Symfony\Component\Validator\Constraints\DateTimeValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class DateTimeValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new DateTimeValidator();
@@ -50,11 +53,9 @@ public function testDateTimeImmutableClassIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 0e0114f0ae650..7956d3836387e 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\DateValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class DateValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new DateValidator();
@@ -50,11 +53,9 @@ public function testDateTimeImmutableClassIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Date());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
index 60cf10e4cac84..ef873d801e36f 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Bridge\PhpUnit\DnsMock;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\EmailValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,6 +22,8 @@
*/
class EmailValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new EmailValidator(false);
@@ -40,11 +43,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Email());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
index e0b6ec8f41f5d..39e375b5e5e1a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
@@ -12,11 +12,14 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
class FileTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideValidSizes
*/
@@ -52,10 +55,10 @@ public function testMaxSizeCanBeSetAfterInitialization($maxSize, $bytes, $binary
/**
* @dataProvider provideInvalidSizes
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($maxSize)
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$file = new File(['maxSize' => 1000]);
$file->maxSize = $maxSize;
}
@@ -77,10 +80,10 @@ public function testMaxSizeCannotBeSetToInvalidValueAfterInitialization($maxSize
/**
* @dataProvider provideInValidSizes
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testInvalidMaxSize($maxSize)
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
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 4d447eb25dcac..0d250be1d2f34 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
@@ -69,11 +69,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleTypeOrFile()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new File());
}
@@ -225,11 +223,9 @@ public function testMaxSizeNotExceeded($bytesWritten, $limit)
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMaxSize()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new File([
'maxSize' => '1abc',
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
index 22bb93bd09311..461ef5e628f6a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
@@ -203,11 +203,9 @@ public function testPixelsTooMany()
->assertRaised();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMinWidth()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'minWidth' => '1abc',
]);
@@ -215,11 +213,9 @@ public function testInvalidMinWidth()
$this->validator->validate($this->image, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMaxWidth()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'maxWidth' => '1abc',
]);
@@ -227,11 +223,9 @@ public function testInvalidMaxWidth()
$this->validator->validate($this->image, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMinHeight()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'minHeight' => '1abc',
]);
@@ -239,11 +233,9 @@ public function testInvalidMinHeight()
$this->validator->validate($this->image, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMaxHeight()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'maxHeight' => '1abc',
]);
@@ -251,11 +243,9 @@ public function testInvalidMaxHeight()
$this->validator->validate($this->image, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMinPixels()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'minPixels' => '1abc',
]);
@@ -263,11 +253,9 @@ public function testInvalidMinPixels()
$this->validator->validate($this->image, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMaxPixels()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'maxPixels' => '1abc',
]);
@@ -318,11 +306,9 @@ public function testMaxRatioUsesTwoDecimalsOnly()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMinRatio()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'minRatio' => '1abc',
]);
@@ -330,11 +316,9 @@ public function testInvalidMinRatio()
$this->validator->validate($this->image, $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidMaxRatio()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$constraint = new Image([
'maxRatio' => '1abc',
]);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
index 1ee44e7c518d6..14d88afd55c6b 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Ip;
use Symfony\Component\Validator\Constraints\IpValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class IpValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new IpValidator();
@@ -36,19 +39,15 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Ip());
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testInvalidValidatorVersion()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
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 3c17fd403ad0b..ec8715ed7dd1a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Isbn;
use Symfony\Component\Validator\Constraints\IsbnValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -20,6 +21,8 @@
*/
class IsbnValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new IsbnValidator();
@@ -136,11 +139,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 c9ca7ade88773..ecdc0a2e4fbc0 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Issn;
use Symfony\Component\Validator\Constraints\IssnValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -20,6 +21,8 @@
*/
class IssnValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new IssnValidator();
@@ -106,11 +109,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 247301df2e169..02970ff5fc714 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraints\Language;
use Symfony\Component\Validator\Constraints\LanguageValidator;
@@ -18,6 +19,8 @@
class LanguageValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new LanguageValidator();
@@ -37,11 +40,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Language());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
index f1daee534aa3f..31f63c02e5718 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\LengthValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class LengthValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new LengthValidator();
@@ -36,11 +39,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Length(5));
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
index 3d5123116534d..98569092230b2 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Locale;
use Symfony\Component\Validator\Constraints\LocaleValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class LocaleValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new LocaleValidator();
@@ -36,11 +39,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Locale());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
index 02aae3adbc317..0afb0358734a1 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Luhn;
use Symfony\Component\Validator\Constraints\LuhnValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class LuhnValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new LuhnValidator();
@@ -99,11 +102,11 @@ public function getInvalidNumbers()
}
/**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
* @dataProvider getInvalidTypes
*/
public function testInvalidTypes($number)
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$constraint = new Luhn();
$this->validator->validate($number, $constraint);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
index 55e739b036884..31f0432537f64 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Regex;
use Symfony\Component\Validator\Constraints\RegexValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class RegexValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new RegexValidator();
@@ -36,11 +39,9 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 fe22e9673b7ca..6f3ed9db5c3f3 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
@@ -11,12 +11,15 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Time;
use Symfony\Component\Validator\Constraints\TimeValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class TimeValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new TimeValidator();
@@ -43,11 +46,9 @@ public function testDateTimeClassIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Time());
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
index bd1c9a3e09f92..d35623091c18a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Bridge\PhpUnit\DnsMock;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Url;
use Symfony\Component\Validator\Constraints\UrlValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,6 +22,8 @@
*/
class UrlValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new UrlValidator();
@@ -47,11 +50,9 @@ public function testEmptyStringFromObjectIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$this->validator->validate(new \stdClass(), new Url());
}
@@ -281,11 +282,11 @@ public function testCheckDnsWithBoolean()
}
/**
- * @expectedException \Symfony\Component\Validator\Exception\InvalidOptionsException
* @requires function Symfony\Bridge\PhpUnit\DnsMock::withMockedHosts
*/
public function testCheckDnsWithInvalidType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]);
$constraint = new Url([
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
index 6c379b9430fb9..d3ca7c214223d 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Uuid;
use Symfony\Component\Validator\Constraints\UuidValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -20,6 +21,8 @@
*/
class UuidValidatorTest extends ConstraintValidatorTestCase
{
+ use ForwardCompatTestTrait;
+
protected function createValidator()
{
return new UuidValidator();
@@ -39,21 +42,17 @@ public function testEmptyStringIsValid()
$this->assertNoViolation();
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsUuidConstraintCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$constraint = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\Constraint');
$this->validator->validate('216fff40-98d9-11e3-a5e2-0800200c9a66', $constraint);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
- */
public function testExpectsStringCompatibleType()
{
+ $this->expectException('Symfony\Component\Validator\Exception\UnexpectedTypeException');
$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 5178bc3b3060d..41b0fa8eaad99 100644
--- a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Blank as BlankConstraint;
@@ -20,6 +21,8 @@
class ContainerConstraintValidatorFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testGetInstanceCreatesValidator()
{
$factory = new ContainerConstraintValidatorFactory(new Container());
@@ -45,11 +48,9 @@ public function testGetInstanceReturnsService()
$this->assertSame($validator, $factory->getInstance(new DummyConstraint()));
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ValidatorException
- */
public function testGetInstanceInvalidValidatorClass()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
$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 c3224840bb2da..48943a3fb2654 100644
--- a/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
+++ b/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -21,6 +22,8 @@
class AddConstraintValidatorsPassTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testThatConstraintValidatorServicesAreProcessed()
{
$container = new ContainerBuilder();
@@ -43,12 +46,10 @@ public function testThatConstraintValidatorServicesAreProcessed()
$this->assertEquals($expected, $container->getDefinition((string) $validatorFactory->getArgument(0)));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.
- */
public function testAbstractConstraintValidator()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.');
$container = new ContainerBuilder();
$container->register('validator.validator_factory')
->addArgument([]);
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
index bb1c2fed0cef7..e8929d9f81c51 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
@@ -253,47 +253,37 @@ public function testGroupSequencesWorkIfContainingDefaultGroup()
$this->assertInstanceOf('Symfony\Component\Validator\Constraints\GroupSequence', $this->metadata->getGroupSequence());
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException
- */
public function testGroupSequencesFailIfNotContainingDefaultGroup()
{
+ $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
$this->metadata->setGroupSequence(['Foo', 'Bar']);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException
- */
public function testGroupSequencesFailIfContainingDefault()
{
+ $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
$this->metadata->setGroupSequence(['Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP]);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException
- */
public function testGroupSequenceFailsIfGroupSequenceProviderIsSet()
{
+ $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
$metadata = new ClassMetadata(self::PROVIDERCLASS);
$metadata->setGroupSequenceProvider(true);
$metadata->setGroupSequence(['GroupSequenceProviderEntity', 'Foo']);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException
- */
public function testGroupSequenceProviderFailsIfGroupSequenceIsSet()
{
+ $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
$metadata = new ClassMetadata(self::PROVIDERCLASS);
$metadata->setGroupSequence(['GroupSequenceProviderEntity', 'Foo']);
$metadata->setGroupSequenceProvider(true);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException
- */
public function testGroupSequenceProviderFailsIfDomainClassIsInvalid()
{
+ $this->expectException('Symfony\Component\Validator\Exception\GroupDefinitionException');
$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 a323567d2316b..9b844a28990e6 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
@@ -12,15 +12,16 @@
namespace Symfony\Component\Validator\Tests\Mapping\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory;
class BlackHoleMetadataFactoryTest extends TestCase
{
- /**
- * @expectedException \LogicException
- */
+ use ForwardCompatTestTrait;
+
public function testGetMetadataForThrowsALogicException()
{
+ $this->expectException('LogicException');
$metadataFactory = new BlackHoleMetadataFactory();
$metadataFactory->getMetadataFor('foo');
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
index 9ad85e3f904fe..a1f66ce4ce66f 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Mapping\Factory;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
@@ -20,6 +21,8 @@
class LazyLoadingMetadataFactoryTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
const CLASS_NAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const PARENT_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
const INTERFACE_A_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceA';
@@ -149,11 +152,9 @@ public function testReadMetadataFromCache()
$this->assertEquals($metadata, $factory->getMetadataFor(self::PARENT_CLASS));
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException
- */
public function testNonClassNameStringValues()
{
+ $this->expectException('Symfony\Component\Validator\Exception\NoSuchMetadataException');
$testedValue = 'error@example.com';
$loader = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
$cache = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Cache\CacheInterface')->getMock();
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
index fd62ea80f2832..7c78a0bb7243e 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
@@ -64,12 +64,10 @@ public function testGetPropertyValueFromHasser()
$this->assertEquals('permissions', $metadata->getPropertyValue($entity));
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ValidatorException
- * @expectedExceptionMessage The hasLastName() method does not exist in class Symfony\Component\Validator\Tests\Fixtures\Entity.
- */
public function testUndefinedMethodNameThrowsException()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
+ $this->expectExceptionMessage('The hasLastName() method does not exist in class Symfony\Component\Validator\Tests\Fixtures\Entity.');
new GetterMetadata(self::CLASSNAME, 'lastName', 'hasLastName');
}
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
index 158bebdbc779e..d30a83d8b846e 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -43,10 +43,10 @@ public function testLoadClassMetadataReturnsFalseIfEmpty()
/**
* @dataProvider provideInvalidYamlFiles
- * @expectedException \InvalidArgumentException
*/
public function testInvalidYamlFiles($path)
{
+ $this->expectException('InvalidArgumentException');
$loader = new YamlFileLoader(__DIR__.'/'.$path);
$metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
index 64b3f78934f1d..fe2ee1a50d199 100644
--- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
@@ -12,16 +12,19 @@
namespace Symfony\Component\Validator\Tests\Resources;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class TranslationFilesTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
index a2525311c56ac..85b81ebe52c8d 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
@@ -414,11 +414,9 @@ public function testTraversalDisabledOnClass()
$this->assertCount(0, $violations);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
- */
public function testExpectTraversableIfTraversalEnabledOnClass()
{
+ $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
$entity = new Entity();
$this->metadata->addConstraint(new Traverse(true));
@@ -572,11 +570,9 @@ public function testNoDuplicateValidationIfPropertyConstraintInMultipleGroups()
$this->assertCount(1, $violations);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\RuntimeException
- */
public function testValidateFailsIfNoConstraintsAndNoObjectOrArray()
{
+ $this->expectException('Symfony\Component\Validator\Exception\RuntimeException');
$this->validate('Foobar');
}
diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
index e07a158fa2535..9d345b763ae7d 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
@@ -502,11 +502,9 @@ public function testsIgnoreNullReference()
$this->assertCount(0, $violations);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException
- */
public function testFailOnScalarReferences()
{
+ $this->expectException('Symfony\Component\Validator\Exception\NoSuchMetadataException');
$entity = new Entity();
$entity->reference = 'string';
@@ -741,11 +739,9 @@ public function testDisableTraversableTraversal()
$this->assertCount(0, $violations);
}
- /**
- * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException
- */
public function testMetadataMustExistIfTraversalIsDisabled()
{
+ $this->expectException('Symfony\Component\Validator\Exception\NoSuchMetadataException');
$entity = new Entity();
$entity->reference = new \ArrayIterator();
diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php
index f330777a64a73..817b8fce401eb 100644
--- a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php
+++ b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php
@@ -3,16 +3,17 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\DefinitionBuilder;
use Symfony\Component\Workflow\Transition;
class DefinitionBuilderTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
- */
+ use ForwardCompatTestTrait;
+
public function testAddPlaceInvalidName()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
$builder = new DefinitionBuilder(['a"', 'b']);
}
diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
index 506cfee6a8dab..e334adde8350a 100644
--- a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
@@ -3,11 +3,14 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Transition;
class DefinitionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testAddPlaces()
{
$places = range('a', 'e');
@@ -18,11 +21,9 @@ public function testAddPlaces()
$this->assertEquals('a', $definition->getInitialPlace());
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
- */
public function testAddPlacesInvalidArgument()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
$places = ['a"', 'e"'];
$definition = new Definition($places, []);
}
@@ -35,12 +36,10 @@ public function testSetInitialPlace()
$this->assertEquals($places[3], $definition->getInitialPlace());
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage Place "d" cannot be the initial place as it does not exist.
- */
public function testSetInitialPlaceAndPlaceIsNotDefined()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('Place "d" cannot be the initial place as it does not exist.');
$definition = new Definition([], [], 'd');
}
@@ -55,23 +54,19 @@ public function testAddTransition()
$this->assertSame($transition, $definition->getTransitions()[0]);
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage Place "c" referenced in transition "name" does not exist.
- */
public function testAddTransitionAndFromPlaceIsNotDefined()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('Place "c" referenced in transition "name" does not exist.');
$places = range('a', 'b');
new Definition($places, [new Transition('name', 'c', $places[1])]);
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage Place "c" referenced in transition "name" does not exist.
- */
public function testAddTransitionAndToPlaceIsNotDefined()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('Place "c" referenced in transition "name" does not exist.');
$places = range('a', 'b');
new Definition($places, [new Transition('name', $places[0], 'c')]);
diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
index 038af0d89fde2..3032dccd15927 100644
--- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php
+++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
@@ -46,23 +46,19 @@ public function testGetWithSuccess()
$this->assertSame('workflow2', $workflow->getName());
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
- * @expectedExceptionMessage At least two workflows match this subject. Set a different name on each and use the second (name) argument of this method.
- */
public function testGetWithMultipleMatch()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('At least two workflows match this subject. 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);
$this->assertSame('workflow1', $w1->getName());
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
- * @expectedExceptionMessage Unable to find a workflow for class "stdClass".
- */
public function testGetWithNoMatch()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('Unable to find a workflow for class "stdClass".');
$w1 = $this->registry->get(new \stdClass());
$this->assertInstanceOf(Workflow::class, $w1);
$this->assertSame('workflow1', $w1->getName());
diff --git a/src/Symfony/Component/Workflow/Tests/TransitionTest.php b/src/Symfony/Component/Workflow/Tests/TransitionTest.php
index 2f500ff5e5c70..f349cca8b9b6a 100644
--- a/src/Symfony/Component/Workflow/Tests/TransitionTest.php
+++ b/src/Symfony/Component/Workflow/Tests/TransitionTest.php
@@ -3,16 +3,17 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Transition;
class TransitionTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
- * @expectedExceptionMessage The transition "foo.bar" contains invalid characters.
- */
+ use ForwardCompatTestTrait;
+
public function testValidateName()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
+ $this->expectExceptionMessage('The transition "foo.bar" contains invalid characters.');
$transition = new Transition('foo.bar', 'a', 'b');
}
diff --git a/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
index 4e344560557d4..23c70f39da203 100644
--- a/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
@@ -3,18 +3,19 @@
namespace Symfony\Component\Workflow\Tests\Validator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\Validator\StateMachineValidator;
class StateMachineValidatorTest extends TestCase
{
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidDefinitionException
- * @expectedExceptionMessage A transition from a place/state must have an unique name.
- */
+ use ForwardCompatTestTrait;
+
public function testWithMultipleTransitionWithSameNameShareInput()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('A transition from a place/state must have an unique name.');
$places = ['a', 'b', 'c'];
$transitions[] = new Transition('t1', 'a', 'b');
$transitions[] = new Transition('t1', 'a', 'c');
@@ -35,12 +36,10 @@ public function testWithMultipleTransitionWithSameNameShareInput()
// +----+ +----+
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidDefinitionException
- * @expectedExceptionMessage A transition in StateMachine can only have one output.
- */
public function testWithMultipleTos()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('A transition in StateMachine can only have one output.');
$places = ['a', 'b', 'c'];
$transitions[] = new Transition('t1', 'a', ['b', 'c']);
$definition = new Definition($places, $transitions);
@@ -60,12 +59,10 @@ public function testWithMultipleTos()
// +----+
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidDefinitionException
- * @expectedExceptionMessage A transition in StateMachine can only have one input.
- */
public function testWithMultipleFroms()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('A transition in StateMachine can only have one input.');
$places = ['a', 'b', 'c'];
$transitions[] = new Transition('t1', ['a', 'b'], 'c');
$definition = new Definition($places, $transitions);
diff --git a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
index 4a5c5a57dd85f..e6fc8f442e1db 100644
--- a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Workflow\Tests\Validator;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
use Symfony\Component\Workflow\Transition;
@@ -10,14 +11,13 @@
class WorkflowValidatorTest extends TestCase
{
+ use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidDefinitionException
- * @expectedExceptionMessage The marking store of workflow "foo" can not store many places.
- */
public function testSinglePlaceWorkflowValidatorAndComplexWorkflow()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('The marking store of workflow "foo" can not store many places.');
$definition = $this->createComplexWorkflowDefinition();
(new WorkflowValidator(true))->validate($definition, 'foo');
@@ -33,12 +33,10 @@ public function testSinglePlaceWorkflowValidatorAndSimpleWorkflow()
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\InvalidDefinitionException
- * @expectedExceptionMessage All transitions for a place must have an unique name. Multiple transitions named "t1" where found for place "a" in workflow "foo".
- */
public function testWorkflowWithInvalidNames()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
+ $this->expectExceptionMessage('All transitions for a place must have an unique name. Multiple transitions named "t1" where found for place "a" in workflow "foo".');
$places = range('a', 'c');
$transitions = [];
diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
index d6f6bae45cbf1..21d5ed2026cec 100644
--- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
+++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
@@ -3,6 +3,7 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Event\Event;
@@ -15,14 +16,13 @@
class WorkflowTest extends TestCase
{
+ use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage The value returned by the MarkingStore is not an instance of "Symfony\Component\Workflow\Marking" for workflow "unnamed".
- */
public function testGetMarkingWithInvalidStoreReturn()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('The value returned by the MarkingStore is not an instance of "Symfony\Component\Workflow\Marking" for workflow "unnamed".');
$subject = new \stdClass();
$subject->marking = null;
$workflow = new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock());
@@ -30,12 +30,10 @@ public function testGetMarkingWithInvalidStoreReturn()
$workflow->getMarking($subject);
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage The Marking is empty and there is no initial place for workflow "unnamed".
- */
public function testGetMarkingWithEmptyDefinition()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('The Marking is empty and there is no initial place for workflow "unnamed".');
$subject = new \stdClass();
$subject->marking = null;
$workflow = new Workflow(new Definition([], []), new MultipleStateMarkingStore());
@@ -43,12 +41,10 @@ public function testGetMarkingWithEmptyDefinition()
$workflow->getMarking($subject);
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage Place "nope" is not valid for workflow "unnamed".
- */
public function testGetMarkingWithImpossiblePlace()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('Place "nope" is not valid for workflow "unnamed".');
$subject = new \stdClass();
$subject->marking = ['nope' => 1];
$workflow = new Workflow(new Definition([], []), new MultipleStateMarkingStore());
@@ -162,12 +158,10 @@ public function testCanDoesNotTriggerGuardEventsForNotEnabledTransitions()
$this->assertSame(['workflow_name.guard.t3'], $dispatchedEvents);
}
- /**
- * @expectedException \Symfony\Component\Workflow\Exception\LogicException
- * @expectedExceptionMessage Unable to apply transition "t2" for workflow "unnamed".
- */
public function testApplyWithImpossibleTransition()
{
+ $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
+ $this->expectExceptionMessage('Unable to apply transition "t2" for workflow "unnamed".');
$definition = $this->createComplexWorkflowDefinition();
$subject = new \stdClass();
$subject->marking = null;
diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
index cb86e951d273c..c9ec8109bd505 100644
--- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
@@ -81,11 +81,9 @@ public function testCustomTagsError()
$this->assertSame(1, $ret, 'lint:yaml exits with code 1 in case of error');
}
- /**
- * @expectedException \RuntimeException
- */
public function testLintFileNotReadable()
{
+ $this->expectException('RuntimeException');
$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 0a85acd9a28f2..e3ecfa1a7b953 100644
--- a/src/Symfony/Component/Yaml/Tests/DumperTest.php
+++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php
@@ -234,20 +234,18 @@ public function testObjectSupportDisabledButNoExceptions()
$this->assertEquals('{ foo: null, bar: 1 }', $dump, '->dump() does not dump objects when disabled');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\DumpException
- */
public function testObjectSupportDisabledWithExceptions()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\DumpException');
$this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
}
/**
* @group legacy
- * @expectedException \Symfony\Component\Yaml\Exception\DumpException
*/
public function testObjectSupportDisabledWithExceptionsPassingTrue()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\DumpException');
$this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, true);
}
@@ -562,21 +560,17 @@ public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock
$this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(["a\r\nb\nc"], 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The indentation must be greater than zero
- */
public function testZeroIndentationThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The indentation must be greater than zero');
new Dumper(0);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The indentation must be greater than zero
- */
public function testNegativeIndentationThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $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 58f1719d9e7d9..851398c44c601 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -65,21 +65,17 @@ public function getTestsForParsePhpConstants()
];
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage The constant "WRONG_CONSTANT" is not defined
- */
public function testParsePhpConstantThrowsExceptionWhenUndefined()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('The constant "WRONG_CONSTANT" is not defined');
Inline::parse('!php/const WRONG_CONSTANT', Yaml::PARSE_CONSTANT);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessageRegExp #The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#
- */
public function testParsePhpConstantThrowsExceptionOnInvalidType()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessageRegExp('#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);
}
@@ -152,46 +148,36 @@ public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedTo
$this->assertSame($value, Inline::parse(Inline::dump($value)));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Found unknown escape character "\V".
- */
public function testParseScalarWithNonEscapedBlackslashShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('Found unknown escape character "\V".');
Inline::parse('"Foo\Var"');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Inline::parse('"Foo\\"');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$value = "'don't do somthin' like that'";
Inline::parse($value);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$value = '"don"t do somthin" like that"';
Inline::parse($value);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testParseInvalidMappingKeyShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$value = '{ "foo " bar": "bar" }';
Inline::parse($value);
}
@@ -206,19 +192,15 @@ public function testParseMappingKeyWithColonNotFollowedBySpace()
Inline::parse('{1:""}');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testParseInvalidMappingShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Inline::parse('[foo] bar');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testParseInvalidSequenceShouldThrowException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Inline::parse('{ foo: bar } bar');
}
@@ -284,21 +266,17 @@ public function testParseMapReferenceInSequenceAsFifthArgument()
$this->assertSame([$foo], Inline::parse('[*foo]', false, false, false, ['foo' => $foo]));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage A reference must contain at least one character at line 1.
- */
public function testParseUnquotedAsterisk()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('A reference must contain at least one character at line 1.');
Inline::parse('{ foo: * }');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage A reference must contain at least one character at line 1.
- */
public function testParseUnquotedAsteriskFollowedByAComment()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('A reference must contain at least one character at line 1.');
Inline::parse('{ foo: * #foo }');
}
@@ -688,10 +666,10 @@ public function getBinaryData()
/**
* @dataProvider getInvalidBinaryData
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp($expectedMessage);
Inline::parse($data);
@@ -707,12 +685,10 @@ public function getInvalidBinaryData()
];
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported} at line 1.
- */
public function testNotSupportedMissingValue()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('Malformed inline YAML string: {this, is not, supported} at line 1.');
Inline::parse('{this, is not, supported}');
}
@@ -796,12 +772,10 @@ public function testDeprecatedStrTag()
$this->assertSame(['foo' => 'bar'], Inline::parse('{ foo: !str bar }'));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Unexpected end of line, expected one of ",}" at line 1 (near "{abc: 'def'").
- */
public function testUnfinishedInlineMap()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('Unexpected end of line, expected one of ",}" 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 f2412fc56784a..a40c49790f2e0 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -613,10 +613,10 @@ public function getObjectForMapTests()
/**
* @dataProvider invalidDumpedObjectProvider
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testObjectsSupportDisabledWithExceptions($yaml)
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml, Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}
@@ -634,10 +634,10 @@ public function testCanParseContentWithTrailingSpaces()
/**
* @group legacy
* @dataProvider invalidDumpedObjectProvider
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testObjectsSupportDisabledWithExceptionsUsingBooleanToggles($yaml)
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml, true);
}
@@ -680,11 +680,9 @@ public function testNonUtf8Exception()
}
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testUnindentedCollectionException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$yaml = <<<'EOF'
collection:
@@ -697,11 +695,9 @@ public function testUnindentedCollectionException()
$this->parser->parse($yaml);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testShortcutKeyUnindentedCollectionException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$yaml = <<<'EOF'
collection:
@@ -713,12 +709,10 @@ public function testShortcutKeyUnindentedCollectionException()
$this->parser->parse($yaml);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessageRegExp /^Multiple documents are not supported.+/
- */
public function testMultipleDocumentsNotSupportedException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessageRegExp('/^Multiple documents are not supported.+/');
Yaml::parse(<<<'EOL'
# Ranking of 1998 home runs
---
@@ -734,11 +728,9 @@ public function testMultipleDocumentsNotSupportedException()
);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testSequenceInAMapping()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Yaml::parse(<<<'EOF'
yaml:
hash: me
@@ -843,10 +835,10 @@ public function getParseExceptionNotAffectedMultiLineStringLastResortParsing()
/**
* @dataProvider getParseExceptionNotAffectedMultiLineStringLastResortParsing
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseExceptionNotAffectedByMultiLineStringLastResortParsing($yaml)
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml);
}
@@ -876,11 +868,9 @@ public function testMultiLineStringLastResortParsing()
$this->assertSame($expected, $this->parser->parse($yaml));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- */
public function testMappingInASequence()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Yaml::parse(<<<'EOF'
yaml:
- array stuff
@@ -889,12 +879,10 @@ public function testMappingInASequence()
);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage missing colon
- */
public function testScalarInSequence()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('missing colon');
Yaml::parse(<<<'EOF'
foo:
- bar
@@ -1245,12 +1233,10 @@ public function testExplicitStringCasting()
$this->assertEquals($expected, $this->parser->parse($yaml));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage A colon cannot be used in an unquoted mapping value
- */
public function testColonInMappingValueException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('A colon cannot be used in an unquoted mapping value');
$yaml = <<<'EOF'
foo: bar: baz
EOF;
@@ -1484,10 +1470,10 @@ public function getBinaryData()
/**
* @dataProvider getInvalidBinaryData
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp($expectedMessage);
$this->parser->parse($data);
@@ -1798,12 +1784,10 @@ public function taggedValuesProvider()
];
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!iterator" at line 1 (near "!iterator [foo]").
- */
public function testCustomTagsDisabled()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $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]');
}
@@ -1816,12 +1800,10 @@ public function testUnsupportedTagWithScalar()
$this->assertEquals('!iterator foo', $this->parser->parse('!iterator foo'));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").
- */
public function testExceptionWhenUsingUnsuportedBuiltInTags()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").');
$this->parser->parse('!!foo');
}
@@ -1871,12 +1853,10 @@ public function testComplexMappingNestedInSequenceThrowsParseException()
$this->parser->parse($yaml);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Unable to parse at line 1 (near "[parameters]").
- */
public function testParsingIniThrowsException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('Unable to parse at line 1 (near "[parameters]").');
$ini = <<assertEquals($trickyVal, $arrayFromYaml);
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Reference "foo" does not exist at line 2
- */
public function testParserCleansUpReferencesBetweenRuns()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('Reference "foo" does not exist at line 2');
$yaml = <<assertIsArray($this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessageRegExp #^File ".+/Fixtures/nonexistent.yml" does not exist\.$#
- */
public function testParsingNonExistentFilesThrowsException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessageRegExp('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
$this->parser->parseFile(__DIR__.'/Fixtures/nonexistent.yml');
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessageRegExp #^File ".+/Fixtures/not_readable.yml" cannot be read\.$#
- */
public function testParsingNotReadableFilesThrowsException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessageRegExp('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
}
@@ -2160,12 +2134,10 @@ public function testParseReferencesOnMergeKeysWithMappingsParsedAsObjects()
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
}
- /**
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
- * @expectedExceptionMessage Reference "foo" does not exist
- */
public function testEvalRefException()
{
+ $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage('Reference "foo" does not exist');
$yaml = <<expectException('Symfony\Component\Yaml\Exception\ParseException');
+ $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 5a792c51160a1..158d581d6691d 100644
--- a/src/Symfony/Component/Yaml/Tests/YamlTest.php
+++ b/src/Symfony/Component/Yaml/Tests/YamlTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Yaml;
class YamlTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testParseAndDump()
{
$data = ['lorem' => 'ipsum', 'dolor' => 'sit'];
@@ -24,21 +27,17 @@ public function testParseAndDump()
$this->assertEquals($data, $parsed);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The indentation must be greater than zero
- */
public function testZeroIndentationThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The indentation must be greater than zero');
Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0);
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The indentation must be greater than zero
- */
public function testNegativeIndentationThrowsException()
{
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The indentation must be greater than zero');
Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4);
}
}
From a22a9c453fc29aa79ad39a11a96156bd5877bb5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Fri, 2 Aug 2019 01:19:44 +0200
Subject: [PATCH 030/147] Fix tests
---
.../CompilerPass/RegisterMappingsPassTest.php | 2 +-
.../Tests/Compiler/ResolveBindingsPassTest.php | 2 +-
.../DependencyInjection/Tests/Loader/YamlFileLoaderTest.php | 2 +-
.../Form/Tests/Extension/Core/Type/FormTypeTest.php | 4 ++--
.../Component/Form/Tests/Resources/TranslationFilesTest.php | 5 +----
.../Component/Lock/Tests/Store/AbstractRedisStoreTest.php | 2 ++
.../Component/Lock/Tests/Store/ExpiringStoreTestTrait.php | 2 --
.../PropertyAccess/Tests/PropertyAccessorCollectionTest.php | 4 ++--
.../Component/Routing/Tests/Matcher/UrlMatcherTest.php | 2 +-
.../Security/Core/Tests/Resources/TranslationFilesTest.php | 5 +----
.../Validator/Tests/Resources/TranslationFilesTest.php | 5 +----
11 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
index 7dd9b666789cc..e6c06fd328e17 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
@@ -15,7 +15,7 @@ class RegisterMappingsPassTest extends TestCase
public function testNoDriverParmeterException()
{
$this->expectException('InvalidArgumentException');
- $this->getExpectedExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
+ $this->expectExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
$container = $this->createBuilder();
$this->process($container, [
'manager.param.one',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
index e17db39219174..089f4a78ebf27 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
@@ -68,7 +68,7 @@ public function testUnusedBinding()
public function testMissingParent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
- $this->expectExceptionMessageRegExp('Unused binding "$quz" in service [\s\S]+ Invalid service ".*\\ParentNotExists": class NotExists not found\.');
+ $this->expectExceptionMessageRegExp('/Unused binding "\$quz" in service [\s\S]+/');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index 94ec672561346..f149d7a558d4b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -311,7 +311,7 @@ public function testTagWithEmptyNameThrowsException()
public function testTagWithNonStringNameThrowsException()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
- $this->expectExceptionMessageRegExp('The tag name for service "\.+" must be a non-empty string');
+ $this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('tag_name_no_string.yml');
}
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 73af2eb6b8473..7b1b7d05f7739 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -20,8 +20,6 @@
class FormTest_AuthorWithoutRefSetter
{
- use ForwardCompatTestTrait;
-
protected $reference;
protected $referenceCopy;
@@ -54,6 +52,8 @@ public function setReferenceCopy($reference)
class FormTypeTest extends BaseTypeTest
{
+ use ForwardCompatTestTrait;
+
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FormType';
public function testCreateFormInstances()
diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
index b8879ba50871e..d0bc82e759659 100644
--- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Form\Tests\Resources;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class TranslationFilesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
+ \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
diff --git a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php
index 4b9c81bd8e8c2..1cc36eb5dc386 100644
--- a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Store\RedisStore;
/**
@@ -18,6 +19,7 @@
*/
abstract class AbstractRedisStoreTest extends AbstractStoreTest
{
+ use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;
/**
diff --git a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
index 32ce98f08c71f..a66061d4675cf 100644
--- a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
+++ b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
@@ -21,8 +21,6 @@
*/
trait ExpiringStoreTestTrait
{
- use ForwardCompatTestTrait;
-
/**
* Amount of microseconds used as a delay to test expiration. Should be
* small enough not to slow the test suite too much, and high enough not to
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
index 9c3d79a77a100..97543cc91a20e 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
@@ -191,8 +191,8 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable()
{
- $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
-expectedExceptionMessageRegExp /The property "axes" in class "Mock_PropertyAccessorCollectionTest_Car[^"]*" can be defined with the methods "addAxis()", "removeAxis()" but the new value must be an array or an instance of \Traversable, "string" given./');
+ $this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
+ $this->expectExceptionMessage('Could not determine access type for property "axes" in class "Symfony\Component\PropertyAccess\Tests\PropertyAccessorCollectionTest_Car".');
$car = new PropertyAccessorCollectionTest_Car();
$this->propertyAccessor->setValue($car, 'axes', 'Not an array or Traversable');
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
index 0b921d0dabeb8..d38994703081e 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -339,7 +339,7 @@ public function testDefaultRequirementOfVariableDisallowsNextSeparator()
public function testSchemeRequirement()
{
- $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
+ $this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
$matcher = $this->getUrlMatcher($coll);
diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
index 9e2d0ffeb4633..f4e0d9e6e8f90 100644
--- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Security\Core\Tests\Resources;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class TranslationFilesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
+ \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
index fe2ee1a50d199..64b3f78934f1d 100644
--- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Validator\Tests\Resources;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class TranslationFilesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
+ \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
From 7bdd8ff872687b62bc3770cd4a33f2712b8ef107 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Fri, 2 Aug 2019 16:07:32 +0200
Subject: [PATCH 031/147] Run the phpunit-bridge from a PR
---
.gitignore | 1 +
.travis.yml | 20 ++
.../Bridge/PhpUnit/ForwardCompatTestTrait.php | 35 --
.../Legacy/ForwardCompatTestTraitForV5.php | 306 ------------------
.../Legacy/ForwardCompatTestTraitForV7.php | 35 --
.../Legacy/ForwardCompatTestTraitForV8.php | 58 ----
6 files changed, 21 insertions(+), 434 deletions(-)
delete mode 100644 src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
delete mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
delete mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
delete mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php
diff --git a/.gitignore b/.gitignore
index 0f504231b6e95..dc8ee794ab441 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ vendor/
composer.lock
phpunit.xml
.php_cs.cache
+.phpunit.result.cache
composer.phar
package.tar
/packages.json
diff --git a/.travis.yml b/.travis.yml
index c1e2cfd8b566f..911a27d8ba94b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -194,6 +194,22 @@ before_install:
fi
install:
+ - |
+ # Install the phpunit-bridge from a PR if required
+ #
+ # To run a PR with a patched phpunit-bridge, first submit the path for the
+ # phpunit-bridge as a separate PR against the next feature-branch then
+ # uncomment and update the following line with that PR number
+ #SYMFONY_PHPUNIT_BRIDGE_PR=32886
+
+ if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
+ git fetch origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
+ git rm -rq src/Symfony/Bridge/PhpUnit
+ git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
+ SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
+ sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
+ fi
+
- |
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
if [[ ! $deps ]]; then
@@ -206,6 +222,10 @@ install:
mv composer.json composer.json.phpunit &&
mv composer.json.orig composer.json
fi
+ if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
+ git rm -fq -- src/Symfony/Bridge/PhpUnit/composer.json
+ git diff --staged -- src/Symfony/Bridge/PhpUnit/ | git apply -R --index
+ fi
- |
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
diff --git a/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php b/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
deleted file mode 100644
index 29597bbe10cb0..0000000000000
--- a/src/Symfony/Bridge/PhpUnit/ForwardCompatTestTrait.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bridge\PhpUnit;
-
-use PHPUnit\Framework\TestCase;
-
-// A trait to provide forward compatibility with newest PHPUnit versions
-
-$r = new \ReflectionClass(TestCase::class);
-
-if (\PHP_VERSION_ID < 70000 || !$r->hasMethod('createMock') || !$r->getMethod('createMock')->hasReturnType()) {
- trait ForwardCompatTestTrait
- {
- use Legacy\ForwardCompatTestTraitForV5;
- }
-} elseif ($r->getMethod('tearDown')->hasReturnType()) {
- trait ForwardCompatTestTrait
- {
- use Legacy\ForwardCompatTestTraitForV8;
- }
-} else {
- trait ForwardCompatTestTrait
- {
- use Legacy\ForwardCompatTestTraitForV7;
- }
-}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
deleted file mode 100644
index 83f7db407af85..0000000000000
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php
+++ /dev/null
@@ -1,306 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bridge\PhpUnit\Legacy;
-
-use PHPUnit\Framework\MockObject\MockObject;
-use PHPUnit\Framework\TestCase;
-
-/**
- * @internal
- */
-trait ForwardCompatTestTraitForV5
-{
- private $forwardCompatExpectedExceptionMessage = '';
- private $forwardCompatExpectedExceptionCode = null;
-
- /**
- * @return void
- */
- public static function setUpBeforeClass()
- {
- self::doSetUpBeforeClass();
- }
-
- /**
- * @return void
- */
- public static function tearDownAfterClass()
- {
- self::doTearDownAfterClass();
- }
-
- /**
- * @return void
- */
- protected function setUp()
- {
- self::doSetUp();
- }
-
- /**
- * @return void
- */
- protected function tearDown()
- {
- self::doTearDown();
- }
-
- /**
- * @return void
- */
- private static function doSetUpBeforeClass()
- {
- parent::setUpBeforeClass();
- }
-
- /**
- * @return void
- */
- private static function doTearDownAfterClass()
- {
- parent::tearDownAfterClass();
- }
-
- /**
- * @return void
- */
- private function doSetUp()
- {
- parent::setUp();
- }
-
- /**
- * @return void
- */
- private function doTearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @param string $originalClassName
- *
- * @return MockObject
- */
- protected function createMock($originalClassName)
- {
- $mock = $this->getMockBuilder($originalClassName)
- ->disableOriginalConstructor()
- ->disableOriginalClone()
- ->disableArgumentCloning();
-
- if (method_exists($mock, 'disallowMockingUnknownTypes')) {
- $mock = $mock->disallowMockingUnknownTypes();
- }
-
- return $mock->getMock();
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsArray($actual, $message = '')
- {
- static::assertInternalType('array', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsBool($actual, $message = '')
- {
- static::assertInternalType('bool', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsFloat($actual, $message = '')
- {
- static::assertInternalType('float', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsInt($actual, $message = '')
- {
- static::assertInternalType('int', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsNumeric($actual, $message = '')
- {
- static::assertInternalType('numeric', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsObject($actual, $message = '')
- {
- static::assertInternalType('object', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsResource($actual, $message = '')
- {
- static::assertInternalType('resource', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsString($actual, $message = '')
- {
- static::assertInternalType('string', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsScalar($actual, $message = '')
- {
- static::assertInternalType('scalar', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsCallable($actual, $message = '')
- {
- static::assertInternalType('callable', $actual, $message);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public static function assertIsIterable($actual, $message = '')
- {
- static::assertInternalType('iterable', $actual, $message);
- }
-
- /**
- * @param string $exception
- *
- * @return void
- */
- public function expectException($exception)
- {
- if (method_exists(TestCase::class, 'expectException')) {
- parent::expectException($exception);
-
- return;
- }
-
- parent::setExpectedException($exception, $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
- }
-
- /**
- * @return void
- */
- public function expectExceptionCode($code)
- {
- if (method_exists(TestCase::class, 'expectExceptionCode')) {
- parent::expectExceptionCode($code);
-
- return;
- }
-
- $this->forwardCompatExpectedExceptionCode = $code;
- parent::setExpectedException(parent::getExpectedException(), $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
- }
-
- /**
- * @param string $message
- *
- * @return void
- */
- public function expectExceptionMessage($message)
- {
- if (method_exists(TestCase::class, 'expectExceptionMessage')) {
- parent::expectExceptionMessage($message);
-
- return;
- }
-
- $this->forwardCompatExpectedExceptionMessage = $message;
- parent::setExpectedException(parent::getExpectedException(), $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
- }
-
- /**
- * @param string $messageRegExp
- *
- * @return void
- */
- public function expectExceptionMessageRegExp($messageRegExp)
- {
- if (method_exists(TestCase::class, 'expectExceptionMessageRegExp')) {
- parent::expectExceptionMessageRegExp($messageRegExp);
-
- return;
- }
-
- parent::setExpectedExceptionRegExp(parent::getExpectedException(), $messageRegExp, $this->forwardCompatExpectedExceptionCode);
- }
-
- /**
- * @param string $exceptionMessage
- *
- * @return void
- */
- public function setExpectedException($exceptionName, $exceptionMessage = '', $exceptionCode = null)
- {
- $this->forwardCompatExpectedExceptionMessage = $exceptionMessage;
- $this->forwardCompatExpectedExceptionCode = $exceptionCode;
-
- parent::setExpectedException($exceptionName, $exceptionMessage, $exceptionCode);
- }
-
- /**
- * @param string $exceptionMessageRegExp
- *
- * @return void
- */
- public function setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp = '', $exceptionCode = null)
- {
- $this->forwardCompatExpectedExceptionCode = $exceptionCode;
-
- parent::setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp, $exceptionCode);
- }
-}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
deleted file mode 100644
index f77239ef09e86..0000000000000
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV7.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bridge\PhpUnit\Legacy;
-
-use PHPUnit\Framework\MockObject\MockObject;
-
-/**
- * @internal
- */
-trait ForwardCompatTestTraitForV7
-{
- use ForwardCompatTestTraitForV5;
-
- /**
- * @param string|string[] $originalClassName
- */
- protected function createMock($originalClassName): MockObject
- {
- return $this->getMockBuilder($originalClassName)
- ->disableOriginalConstructor()
- ->disableOriginalClone()
- ->disableArgumentCloning()
- ->disallowMockingUnknownTypes()
- ->getMock();
- }
-}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php b/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php
deleted file mode 100644
index 4963ed9e0c38a..0000000000000
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV8.php
+++ /dev/null
@@ -1,58 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bridge\PhpUnit\Legacy;
-
-/**
- * @internal
- */
-trait ForwardCompatTestTraitForV8
-{
- public static function setUpBeforeClass(): void
- {
- self::doSetUpBeforeClass();
- }
-
- public static function tearDownAfterClass(): void
- {
- self::doTearDownAfterClass();
- }
-
- protected function setUp(): void
- {
- self::doSetUp();
- }
-
- protected function tearDown(): void
- {
- self::doTearDown();
- }
-
- private static function doSetUpBeforeClass(): void
- {
- parent::setUpBeforeClass();
- }
-
- private static function doTearDownAfterClass(): void
- {
- parent::tearDownAfterClass();
- }
-
- private function doSetUp(): void
- {
- parent::setUp();
- }
-
- private function doTearDown(): void
- {
- parent::tearDown();
- }
-}
From 2e7f43ed7fb34f91004bee3c23f2f61c1fb67bf7 Mon Sep 17 00:00:00 2001
From: Arman Hosseini <44655055+Arman-Hosseini@users.noreply.github.com>
Date: Sat, 3 Aug 2019 01:59:27 +0430
Subject: [PATCH 032/147] [Validator] Improve Fa translations
---
.../Resources/translations/validators.fa.xlf | 30 +++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf
index 2cfcbea4b086c..c0b42096b5bd7 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf
@@ -36,7 +36,7 @@
The fields {{ fields }} were not expected.
- فیلدهای {{ fields }} اضافی هستند.
+ فیلدهای {{ fields }} شامل فیلدهای مورد انتظار نمی باشند.The fields {{ fields }} are missing.
@@ -60,7 +60,7 @@
The file is not readable.
- فایل قابلیت خوانده شدن ندارد.
+ پرونده خواندنی نمی باشد.The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.
@@ -160,19 +160,19 @@
The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
- طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px می باشد.
+ طول تصویر بسیار بزرگ است({{ width }}px). بیشینه طول مجاز {{ max_width }}px می باشد.The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
- طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px می باشد.
+ طول تصویر بسیار کوچک است({{ width }}px). کمینه طول موردنظر {{ min_width }}px می باشد.The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
- ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px می باشد.
+ ارتفاع تصویر بسیار بزرگ است({{ height }}px). بیشینه ارتفاع مجاز {{ max_height }}px می باشد.The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
- ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px می باشد.
+ ارتفاع تصویر بسیار کوچک است({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px می باشد.This value should be the user's current password.
@@ -192,7 +192,7 @@
No temporary folder was configured in php.ini.
- فولدر موقت در php.ini پیکربندی نگردیده است.
+ پوشه موقتی در php.ini پیکربندی نگردیده است.Cannot write temporary file to disk.
@@ -224,7 +224,7 @@
This is not a valid International Bank Account Number (IBAN).
- این یک شماره حساب بانک بین المللی معتبر نمی باشد (IBAN).
+ این یک شماره حساب بانک بین المللی معتبر نمی باشد(IBAN).This value is not a valid ISBN-10.
@@ -280,23 +280,23 @@
The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
- ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} می باشد.
+ ابعاد({{ ratio }}) عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} می باشد.The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
- ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} می باشد.
+ ابعاد({{ ratio }}) عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} می باشد.The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
- این تصویر یک مربع width }}x{{ height }}px}} می باشد.تصویر مربع مجاز نمی باشد.
+ این تصویر یک مربع({{ width }}x{{ height }}px) می باشد. تصویر مربع مجاز نمی باشد.The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.
- این تصویر افقی width }}x{{ height }}px}} می باشد.تصویر افقی مجاز نمی باشد.
+ این تصویر افقی({{ width }}x{{ height }}px) می باشد. تصویر افقی مجاز نمی باشد.The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.
- این تصویر عمودی width }}x{{ height }}px}} می باشد.تصویر عمودی مجاز نمی باشد.
+ این تصویر عمودی({{ width }}x{{ height }}px) می باشد. تصویر عمودی مجاز نمی باشد.An empty file is not allowed.
@@ -312,7 +312,7 @@
This is not a valid Business Identifier Code (BIC).
- این مقدار یک BIC معتبر نمی باشد.
+ این مقدار یک(BIC) معتبر نمی باشد.Error
@@ -328,7 +328,7 @@
This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
- این BIC با IBAN ارتباطی ندارد.
+ این(BIC) با IBAN ارتباطی ندارد.
From 1451c0b9158f779756c4f3017da197a862084dc7 Mon Sep 17 00:00:00 2001
From: Vincent Langlet
Date: Sat, 3 Aug 2019 14:01:57 +0200
Subject: [PATCH 033/147] Allow sutFqcnResolver to return array
---
src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
index 8e9bdbe92ed4d..1f9aabc5195a8 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
@@ -76,7 +76,7 @@ public function startTest($test)
$cache = $r->getValue();
$cache = array_replace_recursive($cache, array(
\get_class($test) => array(
- 'covers' => array($sutFqcn),
+ 'covers' => \is_array($sutFqcn) ? $sutFqcn : array($sutFqcn),
),
));
$r->setValue($testClass, $cache);
From 9fb1c421f395f7579915eaf9d88c538d67ec0308 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Fri, 2 Aug 2019 15:23:07 +0200
Subject: [PATCH 034/147] Adopt `@PHPUnit55Migration:risky` rule of
php-cs-fixer
---
.php_cs.dist | 5 +++--
.../Component/Console/Tests/Logger/ConsoleLoggerTest.php | 2 +-
.../Component/Debug/Tests/Exception/FlattenExceptionTest.php | 5 ++++-
.../Component/DependencyInjection/ContainerBuilder.php | 4 ++--
.../Component/DependencyInjection/Tests/ContainerTest.php | 1 -
.../NumberToLocalizedStringTransformerTest.php | 1 +
.../Form/Tests/Extension/Core/Type/ButtonTypeTest.php | 1 -
src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php | 2 +-
.../Intl/DateFormatter/DateFormat/TimezoneTransformer.php | 4 ++--
.../Component/Lock/Tests/Store/ExpiringStoreTestTrait.php | 1 -
src/Symfony/Component/Yaml/Tests/ParserTest.php | 1 -
11 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/.php_cs.dist b/.php_cs.dist
index 85c75692eb44f..960f153ae603d 100644
--- a/.php_cs.dist
+++ b/.php_cs.dist
@@ -8,8 +8,9 @@ return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
- '@PHPUnit48Migration:risky' => true,
- 'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
+ '@PHPUnit75Migration:risky' => true,
+ 'php_unit_dedicate_assert' => ['target' => '3.5'],
+ 'phpdoc_no_empty_return' => false, // triggers almost always false positive
'array_syntax' => ['syntax' => 'short'],
'fopen_flags' => false,
'ordered_imports' => true,
diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
index 591f58a62faac..8c8bc56be56c2 100644
--- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
+++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
@@ -165,7 +165,7 @@ public function testObjectCastToString()
if (method_exists($this, 'createPartialMock')) {
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
} else {
- $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
+ $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
}
$dummy->method('__toString')->willReturn('DUMMY');
diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
index f755a78cfcb52..eff43f8c66f76 100644
--- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
+++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Debug\Tests\Exception;
use PHPUnit\Framework\TestCase;
+use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -31,6 +32,8 @@
class FlattenExceptionTest extends TestCase
{
+ use ForwardCompatTestTrait;
+
public function testStatusCode()
{
$flattened = FlattenException::create(new \RuntimeException(), 403);
@@ -256,7 +259,7 @@ function () {},
// assertEquals() does not like NAN values.
$this->assertEquals($array[$i][0], 'float');
- $this->assertTrue(is_nan($array[$i++][1]));
+ $this->assertNan($array[$i++][1]);
}
public function testRecursionInArguments()
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index 73145fd8dfaec..6676c33cab6b7 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -946,8 +946,8 @@ public function getAlias($id)
* This methods allows for simple registration of service definition
* with a fluid interface.
*
- * @param string $id The service identifier
- * @param string $class|null The service class
+ * @param string $id The service identifier
+ * @param string|null $class The service class
*
* @return Definition A Definition instance
*/
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
index 57e3e382f4372..286a98b9d7dd7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
-use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
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 c4e8c7a3d6ab5..8be0c99e13aeb 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -509,6 +509,7 @@ public function testReverseTransformExpectsValidNumber()
/**
* @dataProvider nanRepresentationProvider
+ *
* @see https://github.com/symfony/symfony/issues/3161
*/
public function testReverseTransformDisallowsNaN($nan)
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 98df91d7e873d..7e47a74ed40e8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
@@ -28,7 +28,6 @@ public function testCreateButtonInstances()
}
/**
- *
* @param string $emptyData
* @param null $expectedData
*/
diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
index 1c8c064c3de4f..dad38b8ae2724 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
@@ -142,7 +142,7 @@ public function testObjectCastToString()
if (method_exists($this, 'createPartialMock')) {
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
} else {
- $dummy = $this->getMock(DummyTest::class, ['__toString']);
+ $dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
}
$dummy->expects($this->atLeastOnce())
->method('__toString')
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
index c77fbc160b5bb..a066ba90839cf 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
@@ -92,8 +92,8 @@ public function extractDateOptions($matched, $length)
*
* @return string A timezone identifier
*
- * @see http://php.net/manual/en/timezones.others.php
- * @see http://www.twinsun.com/tz/tz-link.htm
+ * @see http://php.net/manual/en/timezones.others.php
+ * @see http://www.twinsun.com/tz/tz-link.htm
*
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
* @throws \InvalidArgumentException When the value can not be matched with pattern
diff --git a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
index a66061d4675cf..1d36d420b932b 100644
--- a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
+++ b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Exception\LockExpiredException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\StoreInterface;
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index a40c49790f2e0..a2bd72e70066b 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
-use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Component\Yaml\Yaml;
From faef73888e2b018e94aa2ce222d227c537ba979a Mon Sep 17 00:00:00 2001
From: Aleksandr Dankovtsev
Date: Thu, 1 Aug 2019 14:16:39 +0300
Subject: [PATCH 035/147] [Yaml] PHP-8: Uncaught TypeError: abs() expects
parameter 1 to be int or float, string given
---
src/Symfony/Component/Yaml/Parser.php | 2 +-
.../Component/Yaml/Tests/ParserTest.php | 42 +++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index 4f5c30e16836d..013810df7a25e 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -715,7 +715,7 @@ private function parseValue($value, $flags, $context)
if (self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) {
$modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
- $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers));
+ $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs((int) $modifiers));
if ('' !== $matches['tag']) {
if ('!!binary' === $matches['tag']) {
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index d3217b6302ec6..56dc748a188f7 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -2307,6 +2307,48 @@ public function testMultiLineComment()
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
}
+
+ public function testParseValueWithModifiers()
+ {
+ $yaml = <<assertSame(
+ [
+ 'parameters' => [
+ 'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
+ ],
+ ],
+ $this->parser->parse($yaml)
+ );
+ }
+
+ public function testParseValueWithNegativeModifiers()
+ {
+ $yaml = <<assertSame(
+ [
+ 'parameters' => [
+ 'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
+ ],
+ ],
+ $this->parser->parse($yaml)
+ );
+ }
}
class B
From 114ec6c41bbb293c025a7b666a6224d90227faf8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Sat, 3 Aug 2019 19:53:51 +0200
Subject: [PATCH 036/147] Remove deprecated methods assertArraySubset
---
.../Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php | 2 +-
.../Tests/Normalizer/JsonSerializableNormalizerTest.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php
index 2859693a17c28..fe2030f995b1d 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php
@@ -70,6 +70,6 @@ public function testDefaultJsonLoginBadRequest()
$this->assertSame(400, $response->getStatusCode());
$this->assertSame('application/json', $response->headers->get('Content-Type'));
- $this->assertArraySubset(['error' => ['code' => 400, 'message' => 'Bad Request']], json_decode($response->getContent(), true));
+ $this->assertSame(['error' => ['code' => 400, 'message' => 'Bad Request']], json_decode($response->getContent(), true));
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
index 0532ef47c093b..af8f0e7ad9d0e 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
@@ -54,7 +54,7 @@ public function testNormalize()
->expects($this->once())
->method('normalize')
->willReturnCallback(function ($data) {
- $this->assertArraySubset(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], $data);
+ $this->assertSame(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], array_diff_key($data, ['qux' => '']));
return 'string_object';
})
From 7cf9ed613b76a641c4f6308656d3d1c431da21df Mon Sep 17 00:00:00 2001
From: ABGEO
Date: Thu, 1 Aug 2019 19:16:41 +0400
Subject: [PATCH 037/147] #32853 Check if $this->parameters is array.
---
src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index a18d1665c5391..3e586ff71e83e 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -969,7 +969,7 @@ private function startClass($class, $baseClass, $baseClassWithNamespace)
*/
class $class extends $baseClass
{
- private \$parameters;
+ private \$parameters = [];
private \$targetDirs = [];
public function __construct()
From ac6242f36b5bb17b00ee29399bbc38e0f6e2f78b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Fri, 2 Aug 2019 19:02:27 +0200
Subject: [PATCH 038/147] Remove use of ForwardCompatTrait
---
.travis.yml | 1 +
.../Tests/ContainerAwareEventManagerTest.php | 5 +--
...erEventListenersAndSubscribersPassTest.php | 3 --
.../CompilerPass/RegisterMappingsPassTest.php | 3 --
.../DoctrineExtensionTest.php | 5 +--
.../ChoiceList/DoctrineChoiceLoaderTest.php | 5 +--
.../CollectionToArrayTransformerTest.php | 5 +--
.../MergeDoctrineCollectionListenerTest.php | 7 ++--
.../Form/Type/EntityTypePerformanceTest.php | 5 +--
.../Tests/Form/Type/EntityTypeTest.php | 7 ++--
.../Doctrine/Tests/ManagerRegistryTest.php | 5 +--
.../PropertyInfo/DoctrineExtractorTest.php | 5 +--
.../Security/User/EntityUserProviderTest.php | 3 --
.../Constraints/UniqueEntityValidatorTest.php | 5 +--
.../Bridge/PhpUnit/Tests/ClockMockTest.php | 7 ++--
.../Bridge/PhpUnit/Tests/DnsMockTest.php | 5 +--
.../PhpUnit/Tests/ProcessIsolationTest.php | 3 --
.../Instantiator/RuntimeInstantiatorTest.php | 5 +--
.../LazyProxy/PhpDumper/ProxyDumperTest.php | 5 +--
.../Bridge/Twig/Tests/AppVariableTest.php | 5 +--
.../Twig/Tests/Command/LintCommandTest.php | 7 ++--
...xtensionBootstrap3HorizontalLayoutTest.php | 5 +--
.../FormExtensionBootstrap3LayoutTest.php | 4 +--
...xtensionBootstrap4HorizontalLayoutTest.php | 4 +--
.../FormExtensionBootstrap4LayoutTest.php | 4 +--
.../Extension/FormExtensionDivLayoutTest.php | 4 +--
.../FormExtensionTableLayoutTest.php | 4 +--
.../Extension/HttpKernelExtensionTest.php | 3 --
.../Extension/StopwatchExtensionTest.php | 3 --
.../Extension/TranslationExtensionTest.php | 3 --
.../Tests/Extension/WebLinkExtensionTest.php | 5 +--
.../Tests/Extension/WorkflowExtensionTest.php | 5 +--
.../Tests/Translation/TwigExtractorTest.php | 3 --
.../Bridge/Twig/Tests/TwigEngineTest.php | 3 --
.../AnnotationsCacheWarmerTest.php | 7 ++--
.../CacheWarmer/SerializerCacheWarmerTest.php | 3 --
.../TemplatePathsCacheWarmerTest.php | 7 ++--
.../CacheWarmer/ValidatorCacheWarmerTest.php | 3 --
.../CacheClearCommandTest.php | 7 ++--
.../Tests/Command/RouterDebugCommandTest.php | 3 --
.../Command/TranslationDebugCommandTest.php | 7 ++--
.../Command/TranslationUpdateCommandTest.php | 7 ++--
.../Tests/Command/YamlLintCommandTest.php | 7 ++--
.../Console/Descriptor/TextDescriptorTest.php | 7 ++--
.../Controller/ControllerNameParserTest.php | 7 ++--
.../Tests/Controller/ControllerTraitTest.php | 3 --
.../Controller/TemplateControllerTest.php | 3 --
.../Compiler/AddConsoleCommandPassTest.php | 3 --
.../AddConstraintValidatorsPassTest.php | 3 --
.../Compiler/CachePoolPassTest.php | 5 +--
.../Compiler/CachePoolPrunerPassTest.php | 3 --
.../DataCollectorTranslatorPassTest.php | 5 +--
.../Compiler/FormPassTest.php | 3 --
.../Compiler/ProfilerPassTest.php | 3 --
.../Compiler/SerializerPassTest.php | 3 --
.../WorkflowGuardListenerPassTest.php | 5 +--
.../DependencyInjection/ConfigurationTest.php | 3 --
.../FrameworkExtensionTest.php | 3 --
.../PhpFrameworkExtensionTest.php | 3 --
.../Tests/Functional/AbstractWebTestCase.php | 7 ++--
.../Functional/CachePoolClearCommandTest.php | 5 +--
.../Tests/Functional/CachePoolsTest.php | 3 --
.../Functional/ConfigDebugCommandTest.php | 5 +--
.../ConfigDumpReferenceCommandTest.php | 5 +--
.../Tests/Routing/RouterTest.php | 3 --
.../Tests/Templating/DelegatingEngineTest.php | 3 --
.../Tests/Templating/GlobalVariablesTest.php | 5 +--
.../Templating/Helper/AssetsHelperTest.php | 5 +--
.../Helper/FormHelperDivLayoutTest.php | 5 +--
.../Helper/FormHelperTableLayoutTest.php | 5 +--
.../Templating/Helper/RequestHelperTest.php | 5 +--
.../Templating/Helper/SessionHelperTest.php | 7 ++--
.../Templating/Loader/TemplateLocatorTest.php | 3 --
.../Tests/Templating/PhpEngineTest.php | 3 --
.../Templating/TemplateFilenameParserTest.php | 7 ++--
.../Templating/TemplateNameParserTest.php | 7 ++--
.../Tests/Translation/TranslatorTest.php | 7 ++--
.../ConstraintValidatorFactoryTest.php | 3 --
.../Compiler/AddSecurityVotersPassTest.php | 3 --
.../CompleteConfigurationTest.php | 3 --
.../MainConfigurationTest.php | 3 --
.../GuardAuthenticationFactoryTest.php | 3 --
.../SecurityExtensionTest.php | 3 --
.../Tests/Functional/AbstractWebTestCase.php | 7 ++--
.../UserPasswordEncoderCommandTest.php | 7 ++--
.../Compiler/TwigLoaderPassTest.php | 5 +--
.../Tests/Functional/CacheWarmingTest.php | 7 ++--
.../Functional/NoTemplatingEntryTest.php | 7 ++--
.../Tests/Loader/FilesystemLoaderTest.php | 3 --
.../WebProfilerExtensionTest.php | 7 ++--
.../Tests/Profiler/TemplateManagerTest.php | 5 +--
.../Component/Asset/Tests/PackagesTest.php | 3 --
.../Component/Asset/Tests/UrlPackageTest.php | 3 --
.../JsonManifestVersionStrategyTest.php | 3 --
.../Component/BrowserKit/Tests/CookieTest.php | 3 --
.../Adapter/AbstractRedisAdapterTest.php | 7 ++--
.../Cache/Tests/Adapter/AdapterTestCase.php | 5 +--
.../Cache/Tests/Adapter/ChainAdapterTest.php | 3 --
.../Tests/Adapter/FilesystemAdapterTest.php | 5 +--
.../Tests/Adapter/MaxIdLengthAdapterTest.php | 3 --
.../Tests/Adapter/MemcachedAdapterTest.php | 5 +--
.../Cache/Tests/Adapter/PdoAdapterTest.php | 6 ++--
.../Tests/Adapter/PdoDbalAdapterTest.php | 6 ++--
.../Tests/Adapter/PhpArrayAdapterTest.php | 7 ++--
.../PhpArrayAdapterWithFallbackTest.php | 7 ++--
.../Tests/Adapter/PhpFilesAdapterTest.php | 5 +--
.../Cache/Tests/Adapter/PredisAdapterTest.php | 5 +--
.../Adapter/PredisClusterAdapterTest.php | 7 ++--
.../Adapter/PredisRedisClusterAdapterTest.php | 7 ++--
.../Cache/Tests/Adapter/ProxyAdapterTest.php | 3 --
.../Cache/Tests/Adapter/RedisAdapterTest.php | 5 +--
.../Tests/Adapter/RedisArrayAdapterTest.php | 5 +--
.../Tests/Adapter/RedisClusterAdapterTest.php | 5 +--
.../Tests/Adapter/TagAwareAdapterTest.php | 5 +--
.../Component/Cache/Tests/CacheItemTest.php | 3 --
.../Tests/Simple/AbstractRedisCacheTest.php | 7 ++--
.../Cache/Tests/Simple/CacheTestCase.php | 5 +--
.../Cache/Tests/Simple/ChainCacheTest.php | 3 --
.../Cache/Tests/Simple/MemcachedCacheTest.php | 5 +--
.../Cache/Tests/Simple/PdoCacheTest.php | 6 ++--
.../Cache/Tests/Simple/PdoDbalCacheTest.php | 6 ++--
.../Cache/Tests/Simple/PhpArrayCacheTest.php | 7 ++--
.../Simple/PhpArrayCacheWithFallbackTest.php | 7 ++--
.../Tests/Simple/RedisArrayCacheTest.php | 5 +--
.../Cache/Tests/Simple/RedisCacheTest.php | 5 +--
.../Tests/Simple/RedisClusterCacheTest.php | 5 +--
.../ClassLoader/Tests/ApcClassLoaderTest.php | 7 ++--
.../Tests/ClassCollectionLoaderTest.php | 3 --
.../Config/Tests/ConfigCacheFactoryTest.php | 3 --
.../Config/Tests/ConfigCacheTest.php | 7 ++--
.../Config/Tests/Definition/ArrayNodeTest.php | 3 --
.../Tests/Definition/BooleanNodeTest.php | 3 --
.../Builder/ArrayNodeDefinitionTest.php | 3 --
.../Builder/BooleanNodeDefinitionTest.php | 3 --
.../Builder/EnumNodeDefinitionTest.php | 3 --
.../Definition/Builder/ExprBuilderTest.php | 3 --
.../Definition/Builder/NodeBuilderTest.php | 3 --
.../Builder/NumericNodeDefinitionTest.php | 3 --
.../Definition/Builder/TreeBuilderTest.php | 3 --
.../Config/Tests/Definition/EnumNodeTest.php | 3 --
.../Config/Tests/Definition/FloatNodeTest.php | 3 --
.../Tests/Definition/IntegerNodeTest.php | 3 --
.../Config/Tests/Definition/MergeTest.php | 3 --
.../Tests/Definition/NormalizationTest.php | 3 --
.../Tests/Definition/ScalarNodeTest.php | 3 --
.../Config/Tests/FileLocatorTest.php | 3 --
.../Tests/Loader/DelegatingLoaderTest.php | 3 --
.../Config/Tests/Loader/LoaderTest.php | 3 --
.../Resource/ClassExistenceResourceTest.php | 3 --
.../Tests/Resource/DirectoryResourceTest.php | 7 ++--
.../Resource/FileExistenceResourceTest.php | 7 ++--
.../Tests/Resource/FileResourceTest.php | 7 ++--
.../Tests/Resource/GlobResourceTest.php | 5 +--
.../Tests/ResourceCheckerConfigCacheTest.php | 7 ++--
.../Config/Tests/Util/XmlUtilsTest.php | 3 --
.../Console/Tests/ApplicationTest.php | 9 ++---
.../Console/Tests/Command/CommandTest.php | 5 +--
.../Tests/Command/LockableTraitTest.php | 5 +--
.../ContainerCommandLoaderTest.php | 3 --
.../FactoryCommandLoaderTest.php | 3 --
.../AddConsoleCommandPassTest.php | 3 --
.../OutputFormatterStyleStackTest.php | 3 --
.../Formatter/OutputFormatterStyleTest.php | 3 --
.../Console/Tests/Helper/ProgressBarTest.php | 7 ++--
.../Tests/Helper/ProgressIndicatorTest.php | 3 --
.../Tests/Helper/QuestionHelperTest.php | 3 --
.../Helper/SymfonyQuestionHelperTest.php | 3 --
.../Console/Tests/Helper/TableStyleTest.php | 3 --
.../Console/Tests/Helper/TableTest.php | 33 +++++++++----------
.../Console/Tests/Input/ArgvInputTest.php | 3 --
.../Console/Tests/Input/ArrayInputTest.php | 3 --
.../Console/Tests/Input/InputArgumentTest.php | 3 --
.../Tests/Input/InputDefinitionTest.php | 5 +--
.../Console/Tests/Input/InputOptionTest.php | 3 --
.../Console/Tests/Input/InputTest.php | 3 --
.../Tests/Logger/ConsoleLoggerTest.php | 3 --
.../Console/Tests/Output/StreamOutputTest.php | 7 ++--
.../Console/Tests/Style/SymfonyStyleTest.php | 7 ++--
.../Component/Console/Tests/TerminalTest.php | 7 ++--
.../Tests/Tester/ApplicationTesterTest.php | 7 ++--
.../Tests/Tester/CommandTesterTest.php | 7 ++--
.../Tests/CssSelectorConverterTest.php | 3 --
.../CssSelector/Tests/Parser/ParserTest.php | 3 --
.../Tests/Parser/TokenStreamTest.php | 3 --
.../Tests/XPath/TranslatorTest.php | 3 --
.../Debug/Tests/DebugClassLoaderTest.php | 7 ++--
.../Debug/Tests/ErrorHandlerTest.php | 3 --
.../Tests/Exception/FlattenExceptionTest.php | 3 --
.../Debug/Tests/ExceptionHandlerTest.php | 7 ++--
.../ClassNotFoundFatalErrorHandlerTest.php | 5 +--
.../Tests/ChildDefinitionTest.php | 3 --
.../Compiler/AutoAliasServicePassTest.php | 3 --
.../Tests/Compiler/AutowirePassTest.php | 3 --
.../CheckArgumentsValidityPassTest.php | 3 --
.../CheckCircularReferencesPassTest.php | 3 --
.../CheckDefinitionValidityPassTest.php | 3 --
...tionOnInvalidReferenceBehaviorPassTest.php | 3 --
.../CheckReferenceValidityPassTest.php | 3 --
.../DefinitionErrorExceptionPassTest.php | 3 --
.../Compiler/ExtensionCompilerPassTest.php | 5 +--
.../InlineServiceDefinitionsPassTest.php | 3 --
.../MergeExtensionConfigurationPassTest.php | 3 --
.../RegisterEnvVarProcessorsPassTest.php | 3 --
.../RegisterServiceSubscribersPassTest.php | 3 --
...ReplaceAliasByActualDefinitionPassTest.php | 3 --
.../Compiler/ResolveBindingsPassTest.php | 3 --
.../ResolveChildDefinitionsPassTest.php | 3 --
.../Tests/Compiler/ResolveClassPassTest.php | 3 --
.../Compiler/ResolveFactoryClassPassTest.php | 3 --
.../ResolveInstanceofConditionalsPassTest.php | 3 --
.../ResolveNamedArgumentsPassTest.php | 3 --
.../ResolveParameterPlaceHoldersPassTest.php | 5 +--
.../ResolveReferencesToAliasesPassTest.php | 3 --
.../Compiler/ServiceLocatorTagPassTest.php | 3 --
.../Config/AutowireServiceResourceTest.php | 7 ++--
...ContainerParametersResourceCheckerTest.php | 5 +--
.../ContainerParametersResourceTest.php | 5 +--
.../Tests/ContainerBuilderTest.php | 3 --
.../Tests/ContainerTest.php | 3 --
.../Tests/CrossCheckTest.php | 5 +--
.../Tests/DefinitionDecoratorTest.php | 3 --
.../Tests/DefinitionTest.php | 3 --
.../Tests/Dumper/GraphvizDumperTest.php | 5 +--
.../Tests/Dumper/PhpDumperTest.php | 5 +--
.../Tests/Dumper/XmlDumperTest.php | 5 +--
.../Tests/Dumper/YamlDumperTest.php | 5 +--
.../Tests/EnvVarProcessorTest.php | 3 --
.../Tests/Extension/ExtensionTest.php | 3 --
.../OtherDir/Component1/Dir2/Service2.php | 1 -
.../OtherDir/Component2/Dir2/Service5.php | 1 -
.../Tests/Fixtures/StubbedTranslator.php | 1 -
.../Tests/Loader/DirectoryLoaderTest.php | 7 ++--
.../Tests/Loader/FileLoaderTest.php | 5 +--
.../Tests/Loader/IniFileLoaderTest.php | 5 +--
.../Tests/Loader/LoaderResolverTest.php | 5 +--
.../Tests/Loader/PhpFileLoaderTest.php | 3 --
.../Tests/Loader/XmlFileLoaderTest.php | 5 +--
.../Tests/Loader/YamlFileLoaderTest.php | 5 +--
.../EnvPlaceholderParameterBagTest.php | 3 --
.../ParameterBag/FrozenParameterBagTest.php | 3 --
.../Tests/ParameterBag/ParameterBagTest.php | 3 --
.../Tests/ServiceLocatorTest.php | 3 --
.../DomCrawler/Tests/CrawlerTest.php | 3 --
.../Tests/Field/FileFormFieldTest.php | 3 --
.../Component/DomCrawler/Tests/FormTest.php | 5 +--
.../Component/DomCrawler/Tests/ImageTest.php | 3 --
.../Component/DomCrawler/Tests/LinkTest.php | 3 --
.../Component/Dotenv/Tests/DotenvTest.php | 3 --
.../Tests/AbstractEventDispatcherTest.php | 7 ++--
.../RegisterListenersPassTest.php | 3 --
.../EventDispatcher/Tests/EventTest.php | 7 ++--
.../Tests/GenericEventTest.php | 7 ++--
.../Tests/ImmutableEventDispatcherTest.php | 5 +--
.../Tests/ExpressionFunctionTest.php | 3 --
.../Tests/ExpressionLanguageTest.php | 3 --
.../ExpressionLanguage/Tests/LexerTest.php | 5 +--
.../ParserCache/ParserCacheAdapterTest.php | 3 --
.../ExpressionLanguage/Tests/ParserTest.php | 3 --
.../Filesystem/Tests/FilesystemTest.php | 3 --
.../Filesystem/Tests/FilesystemTestCase.php | 9 ++---
.../Filesystem/Tests/LockHandlerTest.php | 3 --
.../Component/Finder/Tests/FinderTest.php | 3 --
.../Iterator/CustomFilterIteratorTest.php | 3 --
.../Tests/Iterator/RealIteratorTestCase.php | 7 ++--
.../Component/Form/Tests/AbstractFormTest.php | 7 ++--
.../Form/Tests/AbstractLayoutTest.php | 6 ++--
.../Form/Tests/AbstractRequestHandlerTest.php | 5 +--
.../Form/Tests/ButtonBuilderTest.php | 3 --
.../Component/Form/Tests/ButtonTest.php | 5 +--
.../ChoiceList/AbstractChoiceListTest.php | 5 +--
.../Tests/ChoiceList/ArrayChoiceListTest.php | 5 +--
.../Factory/CachingFactoryDecoratorTest.php | 5 +--
.../Factory/DefaultChoiceListFactoryTest.php | 5 +--
.../Factory/PropertyAccessDecoratorTest.php | 5 +--
.../Tests/ChoiceList/LazyChoiceListTest.php | 5 +--
.../Loader/CallbackChoiceLoaderTest.php | 7 ++--
.../Form/Tests/Command/DebugCommandTest.php | 3 --
.../Component/Form/Tests/CompoundFormTest.php | 3 --
.../Console/Descriptor/JsonDescriptorTest.php | 7 ++--
.../Console/Descriptor/TextDescriptorTest.php | 7 ++--
.../DependencyInjection/FormPassTest.php | 3 --
.../DataMapper/PropertyPathMapperTest.php | 5 +--
.../ArrayToPartsTransformerTest.php | 7 ++--
.../BaseDateTimeTransformerTest.php | 3 --
.../BooleanToStringTransformerTest.php | 7 ++--
.../ChoiceToValueTransformerTest.php | 7 ++--
.../ChoicesToValuesTransformerTest.php | 7 ++--
.../DateIntervalToArrayTransformerTest.php | 3 --
.../DateIntervalToStringTransformerTest.php | 3 --
.../DateTimeToArrayTransformerTest.php | 3 --
...imeToHtml5LocalDateTimeTransformerTest.php | 2 --
...teTimeToLocalizedStringTransformerTest.php | 7 ++--
.../DateTimeToRfc3339TransformerTest.php | 7 ++--
.../DateTimeToStringTransformerTest.php | 3 --
.../DateTimeToTimestampTransformerTest.php | 3 --
.../DateTimeZoneToStringTransformerTest.php | 3 --
...ntegerToLocalizedStringTransformerTest.php | 7 ++--
.../MoneyToLocalizedStringTransformerTest.php | 7 ++--
...NumberToLocalizedStringTransformerTest.php | 7 ++--
...ercentToLocalizedStringTransformerTest.php | 7 ++--
.../ValueToDuplicatesTransformerTest.php | 7 ++--
.../MergeCollectionListenerTest.php | 7 ++--
.../EventListener/ResizeFormListenerTest.php | 7 ++--
.../Extension/Core/Type/BirthdayTypeTest.php | 3 --
.../Extension/Core/Type/ButtonTypeTest.php | 3 --
.../Extension/Core/Type/ChoiceTypeTest.php | 7 ++--
.../Core/Type/CollectionTypeTest.php | 3 --
.../Extension/Core/Type/CountryTypeTest.php | 5 +--
.../Extension/Core/Type/CurrencyTypeTest.php | 5 +--
.../Extension/Core/Type/DateTimeTypeTest.php | 5 +--
.../Extension/Core/Type/DateTypeTest.php | 7 ++--
.../Extension/Core/Type/FormTypeTest.php | 3 --
.../Extension/Core/Type/IntegerTypeTest.php | 5 +--
.../Extension/Core/Type/LanguageTypeTest.php | 5 +--
.../Extension/Core/Type/LocaleTypeTest.php | 5 +--
.../Extension/Core/Type/MoneyTypeTest.php | 7 ++--
.../Extension/Core/Type/NumberTypeTest.php | 7 ++--
.../Extension/Core/Type/RepeatedTypeTest.php | 5 +--
.../Extension/Core/Type/TimeTypeTest.php | 3 --
.../Tests/Extension/Core/Type/UrlTypeTest.php | 3 --
.../CsrfValidationListenerTest.php | 7 ++--
.../Csrf/Type/FormTypeCsrfExtensionTest.php | 7 ++--
.../DataCollectorExtensionTest.php | 5 +--
.../DataCollector/FormDataCollectorTest.php | 5 +--
.../DataCollector/FormDataExtractorTest.php | 4 +--
.../Type/DataCollectorTypeExtensionTest.php | 5 +--
.../DependencyInjectionExtensionTest.php | 3 --
.../HttpFoundationRequestHandlerTest.php | 3 --
.../Constraints/FormValidatorTest.php | 5 +--
.../EventListener/ValidationListenerTest.php | 5 +--
.../Type/BaseValidatorExtensionTest.php | 3 --
.../Validator/ValidatorTypeGuesserTest.php | 5 +--
.../ViolationMapper/ViolationMapperTest.php | 5 +--
.../ViolationMapper/ViolationPathTest.php | 3 --
.../Component/Form/Tests/FormBuilderTest.php | 7 ++--
.../Component/Form/Tests/FormConfigTest.php | 3 --
.../Form/Tests/FormFactoryBuilderTest.php | 5 +--
.../Component/Form/Tests/FormFactoryTest.php | 5 +--
.../Component/Form/Tests/FormRegistryTest.php | 5 +--
.../Component/Form/Tests/Guess/GuessTest.php | 3 --
.../Form/Tests/NativeRequestHandlerTest.php | 9 ++---
.../Form/Tests/ResolvedFormTypeTest.php | 5 +--
.../Component/Form/Tests/SimpleFormTest.php | 3 --
.../Form/Tests/Util/OrderedHashMapTest.php | 3 --
.../Tests/BinaryFileResponseTest.php | 5 +--
.../HttpFoundation/Tests/CookieTest.php | 3 --
.../Tests/ExpressionRequestMatcherTest.php | 3 --
.../HttpFoundation/Tests/File/FileTest.php | 3 --
.../Tests/File/MimeType/MimeTypeTest.php | 5 +--
.../Tests/File/UploadedFileTest.php | 5 +--
.../HttpFoundation/Tests/FileBagTest.php | 7 ++--
.../HttpFoundation/Tests/HeaderBagTest.php | 3 --
.../HttpFoundation/Tests/IpUtilsTest.php | 3 --
.../HttpFoundation/Tests/JsonResponseTest.php | 5 +--
.../Tests/RedirectResponseTest.php | 3 --
.../HttpFoundation/Tests/RequestTest.php | 5 +--
.../Tests/ResponseFunctionalTest.php | 7 ++--
.../Tests/ResponseHeaderBagTest.php | 3 --
.../HttpFoundation/Tests/ResponseTest.php | 3 --
.../Session/Attribute/AttributeBagTest.php | 7 ++--
.../Attribute/NamespacedAttributeBagTest.php | 7 ++--
.../Session/Flash/AutoExpireFlashBagTest.php | 7 ++--
.../Tests/Session/Flash/FlashBagTest.php | 7 ++--
.../Tests/Session/SessionTest.php | 7 ++--
.../Handler/AbstractSessionHandlerTest.php | 7 ++--
.../Handler/MemcacheSessionHandlerTest.php | 7 ++--
.../Handler/MemcachedSessionHandlerTest.php | 7 ++--
.../Handler/MongoDbSessionHandlerTest.php | 5 +--
.../Handler/NativeFileSessionHandlerTest.php | 3 --
.../Storage/Handler/PdoSessionHandlerTest.php | 5 +--
.../Tests/Session/Storage/MetadataBagTest.php | 7 ++--
.../Storage/MockArraySessionStorageTest.php | 7 ++--
.../Storage/MockFileSessionStorageTest.php | 7 ++--
.../Storage/NativeSessionStorageTest.php | 7 ++--
.../Storage/PhpBridgeSessionStorageTest.php | 7 ++--
.../Storage/Proxy/AbstractProxyTest.php | 7 ++--
.../Storage/Proxy/SessionHandlerProxyTest.php | 7 ++--
.../Tests/StreamedResponseTest.php | 3 --
.../HttpKernel/Tests/Bundle/BundleTest.php | 3 --
.../CacheClearer/ChainCacheClearerTest.php | 7 ++--
.../CacheClearer/Psr6CacheClearerTest.php | 3 --
.../CacheWarmer/CacheWarmerAggregateTest.php | 7 ++--
.../Tests/CacheWarmer/CacheWarmerTest.php | 7 ++--
.../Config/EnvParametersResourceTest.php | 7 ++--
.../Tests/Config/FileLocatorTest.php | 3 --
.../Tests/Controller/ArgumentResolverTest.php | 5 +--
.../ContainerControllerResolverTest.php | 3 --
.../Controller/ControllerResolverTest.php | 3 --
.../ArgumentMetadataFactoryTest.php | 5 +--
.../ArgumentMetadataTest.php | 3 --
.../DataCollector/MemoryDataCollectorTest.php | 3 --
.../DataCollector/Util/ValueExporterTest.php | 5 +--
.../FragmentRendererPassTest.php | 3 --
...sterControllerArgumentLocatorsPassTest.php | 3 --
.../ResettableServicePassTest.php | 3 --
.../ServicesResetterTest.php | 5 +--
.../AddRequestFormatsListenerTest.php | 7 ++--
.../EventListener/FragmentListenerTest.php | 3 --
.../EventListener/LocaleListenerTest.php | 5 +--
.../EventListener/ResponseListenerTest.php | 7 ++--
.../EventListener/RouterListenerTest.php | 5 +--
.../EventListener/TestSessionListenerTest.php | 5 +--
.../EventListener/TranslatorListenerTest.php | 5 +--
.../ValidateRequestListenerTest.php | 5 +--
.../Fragment/EsiFragmentRendererTest.php | 3 --
.../Tests/Fragment/FragmentHandlerTest.php | 5 +--
.../Fragment/HIncludeFragmentRendererTest.php | 3 --
.../Fragment/InlineFragmentRendererTest.php | 3 --
.../Fragment/RoutableFragmentRendererTest.php | 3 --
.../Fragment/SsiFragmentRendererTest.php | 3 --
.../HttpKernel/Tests/HttpCache/EsiTest.php | 3 --
.../Tests/HttpCache/HttpCacheTestCase.php | 7 ++--
.../HttpKernel/Tests/HttpCache/SsiTest.php | 3 --
.../HttpKernel/Tests/HttpCache/StoreTest.php | 7 ++--
.../Tests/HttpCache/SubRequestHandlerTest.php | 7 ++--
.../HttpKernel/Tests/HttpKernelTest.php | 3 --
.../Component/HttpKernel/Tests/KernelTest.php | 5 +--
.../HttpKernel/Tests/Log/LoggerTest.php | 7 ++--
.../Profiler/FileProfilerStorageTest.php | 7 ++--
.../Tests/Profiler/ProfilerTest.php | 7 ++--
.../Intl/Tests/Collator/CollatorTest.php | 3 --
.../Collator/Verification/CollatorTest.php | 5 +--
.../Bundle/Reader/BundleEntryReaderTest.php | 5 +--
.../Bundle/Reader/IntlBundleReaderTest.php | 5 +--
.../Bundle/Reader/JsonBundleReaderTest.php | 5 +--
.../Bundle/Reader/PhpBundleReaderTest.php | 5 +--
.../Bundle/Writer/JsonBundleWriterTest.php | 7 ++--
.../Bundle/Writer/PhpBundleWriterTest.php | 7 ++--
.../Bundle/Writer/TextBundleWriterTest.php | 7 ++--
.../AbstractCurrencyDataProviderTest.php | 5 +--
.../Provider/AbstractDataProviderTest.php | 5 +--
.../AbstractLanguageDataProviderTest.php | 5 +--
.../AbstractLocaleDataProviderTest.php | 5 +--
.../AbstractRegionDataProviderTest.php | 5 +--
.../AbstractScriptDataProviderTest.php | 5 +--
.../Tests/Data/Util/LocaleScannerTest.php | 7 ++--
.../Intl/Tests/Data/Util/RingBufferTest.php | 5 +--
.../AbstractIntlDateFormatterTest.php | 5 +--
.../DateFormatter/IntlDateFormatterTest.php | 3 --
.../Verification/IntlDateFormatterTest.php | 5 +--
.../Globals/Verification/IntlGlobalsTest.php | 5 +--
.../Intl/Tests/Locale/LocaleTest.php | 3 --
.../Tests/Locale/Verification/LocaleTest.php | 5 +--
.../AbstractNumberFormatterTest.php | 3 --
.../NumberFormatter/NumberFormatterTest.php | 3 --
.../Verification/NumberFormatterTest.php | 5 +--
.../Intl/Tests/Util/GitRepositoryTest.php | 3 --
.../Tests/Adapter/ExtLdap/AdapterTest.php | 3 --
.../Adapter/ExtLdap/EntryManagerTest.php | 3 --
.../Tests/Adapter/ExtLdap/LdapManagerTest.php | 5 +--
.../Component/Ldap/Tests/LdapClientTest.php | 5 +--
src/Symfony/Component/Ldap/Tests/LdapTest.php | 5 +--
src/Symfony/Component/Lock/Tests/LockTest.php | 3 --
.../Tests/Store/AbstractRedisStoreTest.php | 2 --
.../Lock/Tests/Store/CombinedStoreTest.php | 4 +--
.../Lock/Tests/Store/FlockStoreTest.php | 2 --
.../Lock/Tests/Store/MemcachedStoreTest.php | 4 +--
.../Lock/Tests/Store/PredisStoreTest.php | 5 +--
.../Lock/Tests/Store/RedisArrayStoreTest.php | 5 +--
.../Tests/Store/RedisClusterStoreTest.php | 5 +--
.../Lock/Tests/Store/RedisStoreTest.php | 5 +--
.../Tests/Strategy/ConsensusStrategyTest.php | 5 +--
.../Tests/Strategy/UnanimousStrategyTest.php | 5 +--
.../Debug/OptionsResolverIntrospectorTest.php | 3 --
.../Tests/OptionsResolverTest.php | 5 +--
.../Process/Tests/ExecutableFinderTest.php | 5 +--
.../Process/Tests/ProcessBuilderTest.php | 3 --
.../Tests/ProcessFailedExceptionTest.php | 3 --
.../Component/Process/Tests/ProcessTest.php | 7 ++--
.../Tests/PropertyAccessorArrayAccessTest.php | 5 +--
.../Tests/PropertyAccessorBuilderTest.php | 7 ++--
.../Tests/PropertyAccessorCollectionTest.php | 3 --
.../Tests/PropertyAccessorTest.php | 5 +--
.../Tests/PropertyPathBuilderTest.php | 5 +--
.../PropertyAccess/Tests/PropertyPathTest.php | 3 --
.../AbstractPropertyInfoExtractorTest.php | 5 +--
.../Tests/Extractor/PhpDocExtractorTest.php | 5 +--
.../Extractor/ReflectionExtractorTest.php | 5 +--
.../Extractor/SerializerExtractorTest.php | 5 +--
.../Tests/PropertyInfoCacheExtractorTest.php | 5 +--
.../Component/PropertyInfo/Tests/TypeTest.php | 3 --
.../Routing/Tests/Annotation/RouteTest.php | 3 --
.../Dumper/PhpGeneratorDumperTest.php | 7 ++--
.../Tests/Generator/UrlGeneratorTest.php | 3 --
.../Loader/AnnotationClassLoaderTest.php | 5 +--
.../Loader/AnnotationDirectoryLoaderTest.php | 5 +--
.../Tests/Loader/AnnotationFileLoaderTest.php | 5 +--
.../Tests/Loader/DirectoryLoaderTest.php | 5 +--
.../Tests/Loader/ObjectRouteLoaderTest.php | 3 --
.../Tests/Loader/XmlFileLoaderTest.php | 3 --
.../Tests/Loader/YamlFileLoaderTest.php | 3 --
.../Tests/Matcher/DumpedUrlMatcherTest.php | 3 --
.../Matcher/Dumper/PhpMatcherDumperTest.php | 7 ++--
.../Matcher/RedirectableUrlMatcherTest.php | 3 --
.../Routing/Tests/Matcher/UrlMatcherTest.php | 3 --
.../Tests/RouteCollectionBuilderTest.php | 3 --
.../Routing/Tests/RouteCompilerTest.php | 3 --
.../Component/Routing/Tests/RouteTest.php | 3 --
.../Component/Routing/Tests/RouterTest.php | 5 +--
.../AuthenticationProviderManagerTest.php | 3 --
.../AnonymousAuthenticationProviderTest.php | 3 --
.../DaoAuthenticationProviderTest.php | 3 --
.../LdapBindAuthenticationProviderTest.php | 3 --
...uthenticatedAuthenticationProviderTest.php | 3 --
.../RememberMeAuthenticationProviderTest.php | 3 --
.../SimpleAuthenticationProviderTest.php | 3 --
.../UserAuthenticationProviderTest.php | 3 --
.../RememberMe/InMemoryTokenProviderTest.php | 3 --
.../Token/RememberMeTokenTest.php | 3 --
.../Token/UsernamePasswordTokenTest.php | 3 --
.../AccessDecisionManagerTest.php | 3 --
.../AuthorizationCheckerTest.php | 5 +--
.../Tests/Authorization/Voter/VoterTest.php | 5 +--
.../Encoder/Argon2iPasswordEncoderTest.php | 5 +--
.../Encoder/BCryptPasswordEncoderTest.php | 3 --
.../Tests/Encoder/BasePasswordEncoderTest.php | 3 --
.../Core/Tests/Encoder/EncoderFactoryTest.php | 3 --
.../MessageDigestPasswordEncoderTest.php | 3 --
.../Encoder/Pbkdf2PasswordEncoderTest.php | 3 --
.../Encoder/PlaintextPasswordEncoderTest.php | 3 --
.../Core/Tests/User/ChainUserProviderTest.php | 3 --
.../Tests/User/InMemoryUserProviderTest.php | 3 --
.../Core/Tests/User/LdapUserProviderTest.php | 3 --
.../Core/Tests/User/UserCheckerTest.php | 3 --
.../Security/Core/Tests/User/UserTest.php | 3 --
.../Constraints/UserPasswordValidatorTest.php | 5 +--
.../Csrf/Tests/CsrfTokenManagerTest.php | 7 ++--
.../UriSafeTokenGeneratorTest.php | 9 ++---
.../NativeSessionTokenStorageTest.php | 5 +--
.../TokenStorage/SessionTokenStorageTest.php | 5 +--
.../FormLoginAuthenticatorTest.php | 5 +--
.../GuardAuthenticationListenerTest.php | 7 ++--
.../Tests/GuardAuthenticatorHandlerTest.php | 7 ++--
.../GuardAuthenticationProviderTest.php | 7 ++--
...efaultAuthenticationFailureHandlerTest.php | 5 +--
.../SimpleAuthenticationHandlerTest.php | 5 +--
.../Tests/Firewall/AccessListenerTest.php | 3 --
.../BasicAuthenticationListenerTest.php | 3 --
.../Tests/Firewall/ContextListenerTest.php | 3 --
.../Http/Tests/Firewall/DigestDataTest.php | 5 +--
.../Tests/Firewall/LogoutListenerTest.php | 3 --
.../Tests/Firewall/RememberMeListenerTest.php | 3 --
.../RemoteUserAuthenticationListenerTest.php | 3 --
.../SimplePreAuthenticationListenerTest.php | 7 ++--
.../Tests/Firewall/SwitchUserListenerTest.php | 5 +--
...PasswordFormAuthenticationListenerTest.php | 3 --
...PasswordJsonAuthenticationListenerTest.php | 3 --
.../X509AuthenticationListenerTest.php | 3 --
.../Security/Http/Tests/HttpUtilsTest.php | 3 --
.../CsrfTokenClearingLogoutHandlerTest.php | 5 +--
.../Tests/Logout/LogoutUrlGeneratorTest.php | 5 +--
.../AbstractRememberMeServicesTest.php | 3 --
...istentTokenBasedRememberMeServicesTest.php | 5 +--
.../SessionAuthenticationStrategyTest.php | 3 --
.../Tests/Annotation/GroupsTest.php | 3 --
.../Tests/Annotation/MaxDepthTest.php | 3 --
.../SerializerPassTest.php | 3 --
.../Tests/Encoder/ChainDecoderTest.php | 5 +--
.../Tests/Encoder/ChainEncoderTest.php | 5 +--
.../Tests/Encoder/CsvEncoderTest.php | 5 +--
.../Tests/Encoder/JsonDecodeTest.php | 5 +--
.../Tests/Encoder/JsonEncodeTest.php | 5 +--
.../Tests/Encoder/JsonEncoderTest.php | 5 +--
.../Tests/Encoder/XmlEncoderTest.php | 5 +--
.../Factory/CacheMetadataFactoryTest.php | 3 --
.../Mapping/Loader/AnnotationLoaderTest.php | 5 +--
.../Mapping/Loader/XmlFileLoaderTest.php | 5 +--
.../Mapping/Loader/YamlFileLoaderTest.php | 5 +--
.../Normalizer/AbstractNormalizerTest.php | 5 +--
.../AbstractObjectNormalizerTest.php | 3 --
.../Normalizer/ArrayDenormalizerTest.php | 5 +--
.../Tests/Normalizer/CustomNormalizerTest.php | 5 +--
.../Normalizer/DataUriNormalizerTest.php | 5 +--
.../Normalizer/DateIntervalNormalizerTest.php | 5 +--
.../Normalizer/DateTimeNormalizerTest.php | 5 +--
.../Normalizer/GetSetMethodNormalizerTest.php | 5 +--
.../JsonSerializableNormalizerTest.php | 5 +--
.../Tests/Normalizer/ObjectNormalizerTest.php | 5 +--
.../Normalizer/PropertyNormalizerTest.php | 5 +--
.../Serializer/Tests/SerializerTest.php | 3 --
.../Stopwatch/Tests/StopwatchEventTest.php | 3 --
.../Stopwatch/Tests/StopwatchTest.php | 3 --
.../Templating/Tests/DelegatingEngineTest.php | 3 --
.../Tests/Loader/ChainLoaderTest.php | 5 +--
.../Tests/Loader/FilesystemLoaderTest.php | 5 +--
.../Templating/Tests/PhpEngineTest.php | 7 ++--
.../Tests/TemplateNameParserTest.php | 7 ++--
.../Tests/Catalogue/AbstractOperationTest.php | 3 --
.../TranslationDataCollectorTest.php | 5 +--
.../TranslationExtractorPassTest.php | 3 --
.../Translation/Tests/IntervalTest.php | 3 --
.../Tests/Loader/CsvFileLoaderTest.php | 3 --
.../Tests/Loader/IcuDatFileLoaderTest.php | 3 --
.../Tests/Loader/IcuResFileLoaderTest.php | 3 --
.../Tests/Loader/IniFileLoaderTest.php | 3 --
.../Tests/Loader/JsonFileLoaderTest.php | 3 --
.../Tests/Loader/LocalizedTestCase.php | 5 +--
.../Tests/Loader/MoFileLoaderTest.php | 3 --
.../Tests/Loader/PhpFileLoaderTest.php | 3 --
.../Tests/Loader/PoFileLoaderTest.php | 3 --
.../Tests/Loader/QtFileLoaderTest.php | 3 --
.../Tests/Loader/XliffFileLoaderTest.php | 3 --
.../Tests/Loader/YamlFileLoaderTest.php | 3 --
.../Tests/MessageCatalogueTest.php | 3 --
.../Translation/Tests/MessageSelectorTest.php | 3 --
.../Translation/Tests/TranslatorCacheTest.php | 7 ++--
.../Translation/Tests/TranslatorTest.php | 3 --
.../Validator/Tests/ConstraintTest.php | 3 --
.../Tests/ConstraintViolationListTest.php | 7 ++--
.../AbstractComparisonValidatorTestCase.php | 3 --
.../Validator/Tests/Constraints/AllTest.php | 3 --
.../Tests/Constraints/AllValidatorTest.php | 3 --
.../Constraints/CallbackValidatorTest.php | 3 --
.../Tests/Constraints/ChoiceValidatorTest.php | 3 --
.../Tests/Constraints/CollectionTest.php | 3 --
.../Constraints/CollectionValidatorTest.php | 3 --
.../Tests/Constraints/CompositeTest.php | 3 --
.../Tests/Constraints/CountValidatorTest.php | 3 --
.../Constraints/CountryValidatorTest.php | 3 --
.../Constraints/CurrencyValidatorTest.php | 3 --
.../Constraints/DateTimeValidatorTest.php | 3 --
.../Tests/Constraints/DateValidatorTest.php | 3 --
.../Tests/Constraints/EmailValidatorTest.php | 3 --
.../Validator/Tests/Constraints/FileTest.php | 3 --
.../Tests/Constraints/FileValidatorTest.php | 7 ++--
.../Tests/Constraints/ImageValidatorTest.php | 5 +--
.../Tests/Constraints/IpValidatorTest.php | 3 --
.../Tests/Constraints/IsbnValidatorTest.php | 3 --
.../Tests/Constraints/IssnValidatorTest.php | 3 --
.../Constraints/LanguageValidatorTest.php | 3 --
.../Tests/Constraints/LengthValidatorTest.php | 3 --
.../Tests/Constraints/LocaleValidatorTest.php | 3 --
.../Tests/Constraints/LuhnValidatorTest.php | 3 --
.../Tests/Constraints/RegexValidatorTest.php | 3 --
.../Tests/Constraints/TimeValidatorTest.php | 3 --
.../Tests/Constraints/TypeValidatorTest.php | 5 +--
.../Tests/Constraints/UrlValidatorTest.php | 3 --
.../Tests/Constraints/UuidValidatorTest.php | 3 --
...ontainerConstraintValidatorFactoryTest.php | 3 --
.../ValidatorDataCollectorTest.php | 3 --
.../AddConstraintValidatorsPassTest.php | 3 --
.../Tests/Mapping/Cache/DoctrineCacheTest.php | 5 +--
.../Tests/Mapping/Cache/Psr6CacheTest.php | 5 +--
.../Tests/Mapping/ClassMetadataTest.php | 7 ++--
.../Factory/BlackHoleMetadataFactoryTest.php | 3 --
.../LazyLoadingMetadataFactoryTest.php | 3 --
.../Tests/Mapping/GetterMetadataTest.php | 3 --
.../Mapping/Loader/StaticMethodLoaderTest.php | 7 ++--
.../Mapping/Loader/XmlFileLoaderTest.php | 3 --
.../Mapping/Loader/YamlFileLoaderTest.php | 3 --
.../Tests/Mapping/MemberMetadataTest.php | 7 ++--
.../Tests/Mapping/PropertyMetadataTest.php | 3 --
.../Tests/Validator/AbstractTest.php | 5 +--
.../Tests/Validator/AbstractValidatorTest.php | 7 ++--
.../Validator/TraceableValidatorTest.php | 3 --
.../Validator/Tests/ValidatorBuilderTest.php | 7 ++--
.../Tests/Caster/ExceptionCasterTest.php | 30 ++++++++---------
.../Tests/Caster/XmlReaderCasterTest.php | 6 ++--
.../VarDumper/Tests/Cloner/DataTest.php | 3 --
.../Tests/HttpHeaderSerializerTest.php | 5 +--
.../Workflow/Tests/DefinitionBuilderTest.php | 3 --
.../Workflow/Tests/DefinitionTest.php | 3 --
.../Tests/Dumper/GraphvizDumperTest.php | 4 +--
.../Dumper/StateMachineGraphvizDumperTest.php | 4 +--
.../Tests/EventListener/GuardListenerTest.php | 7 ++--
.../Component/Workflow/Tests/RegistryTest.php | 7 ++--
.../Workflow/Tests/TransitionTest.php | 3 --
.../Validator/StateMachineValidatorTest.php | 3 --
.../Tests/Validator/WorkflowValidatorTest.php | 2 --
.../Component/Workflow/Tests/WorkflowTest.php | 2 --
.../Yaml/Tests/Command/LintCommandTest.php | 7 ++--
.../Component/Yaml/Tests/DumperTest.php | 7 ++--
.../Component/Yaml/Tests/InlineTest.php | 5 +--
.../Component/Yaml/Tests/ParserTest.php | 7 ++--
src/Symfony/Component/Yaml/Tests/YamlTest.php | 3 --
675 files changed, 521 insertions(+), 2514 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 911a27d8ba94b..8ccbc40da30aa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ env:
global:
- MIN_PHP=5.5.9
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/5.6/bin/php
+ - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1
matrix:
include:
diff --git a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php
index 060a8b6af7d1f..b3fb8bc3ac94e 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php
@@ -13,17 +13,14 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\ContainerAwareEventManager;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
class ContainerAwareEventManagerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $container;
private $evm;
- private function doSetUp()
+ protected function setUp()
{
$this->container = new Container();
$this->evm = new ContainerAwareEventManager($this->container);
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
index 1b204a5c3259b..7650d8dc7929a 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
@@ -13,15 +13,12 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
class RegisterEventListenersAndSubscribersPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testExceptionOnAbstractTaggedSubscriber()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
index e6c06fd328e17..eed9cf3bf9658 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php
@@ -4,14 +4,11 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterMappingsPass;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class RegisterMappingsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testNoDriverParmeterException()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
index e24a78ff34e54..01e493066ab3c 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -22,14 +21,12 @@
*/
class DoctrineExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension
*/
private $extension;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
index cdd0375ebd1b2..325ef31e2b933 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
@@ -18,7 +18,6 @@
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
@@ -27,8 +26,6 @@
*/
class DoctrineChoiceLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ChoiceListFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -74,7 +71,7 @@ class DoctrineChoiceLoaderTest extends TestCase
*/
private $obj3;
- private function doSetUp()
+ protected function setUp()
{
$this->factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
index e2129dc66d0b9..217456a523e08 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php
@@ -14,21 +14,18 @@
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Form\DataTransformer\CollectionToArrayTransformer;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Bernhard Schussek
*/
class CollectionToArrayTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var CollectionToArrayTransformer
*/
private $transformer;
- private function doSetUp()
+ protected function setUp()
{
$this->transformer = new CollectionToArrayTransformer();
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php
index a9eb4d76a0deb..c70bc3d0372a7 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php
@@ -14,7 +14,6 @@
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Form\EventListener\MergeDoctrineCollectionListener;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormEvent;
@@ -22,8 +21,6 @@
class MergeDoctrineCollectionListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var \Doctrine\Common\Collections\ArrayCollection */
private $collection;
/** @var \Symfony\Component\EventDispatcher\EventDispatcher */
@@ -31,7 +28,7 @@ class MergeDoctrineCollectionListenerTest extends TestCase
private $factory;
private $form;
- private function doSetUp()
+ protected function setUp()
{
$this->collection = new ArrayCollection(['test']);
$this->dispatcher = new EventDispatcher();
@@ -40,7 +37,7 @@ private function doSetUp()
->getForm();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->collection = null;
$this->dispatcher = null;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
index 225a1ade00dfc..5dc184fb91009 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
@@ -15,7 +15,6 @@
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Symfony\Component\Form\Test\FormPerformanceTestCase;
@@ -24,8 +23,6 @@
*/
class EntityTypePerformanceTest extends FormPerformanceTestCase
{
- use ForwardCompatTestTrait;
-
const ENTITY_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity';
/**
@@ -53,7 +50,7 @@ protected function getExtensions()
];
}
- private function doSetUp()
+ protected function setUp()
{
$this->em = DoctrineTestHelper::createTestEntityManager();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index f7b2360efb5eb..d6ef1f41d575a 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -28,7 +28,6 @@
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringCastableIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Forms;
@@ -37,8 +36,6 @@
class EntityTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Bridge\Doctrine\Form\Type\EntityType';
const ITEM_GROUP_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity';
@@ -62,7 +59,7 @@ class EntityTypeTest extends BaseTypeTest
protected static $supportedFeatureSetVersion = 304;
- private function doSetUp()
+ protected function setUp()
{
$this->em = DoctrineTestHelper::createTestEntityManager();
$this->emRegistry = $this->createRegistryMock('default', $this->em);
@@ -92,7 +89,7 @@ private function doSetUp()
}
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
index d909292d49c06..e5ebeeacf813a 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
@@ -13,14 +13,11 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\ManagerRegistry;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper\PhpDumperTest;
class ManagerRegistryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!class_exists('PHPUnit_Framework_TestCase')) {
self::markTestSkipped('proxy-manager-bridge is not yet compatible with namespaced phpunit versions.');
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
index eb0dea017e8bc..cad2dfeaac89e 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
@@ -16,7 +16,6 @@
use Doctrine\ORM\Tools\Setup;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Type;
/**
@@ -24,14 +23,12 @@
*/
class DoctrineExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var DoctrineExtractor
*/
private $extractor;
- private function doSetUp()
+ protected function setUp()
{
$config = Setup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true);
$entityManager = EntityManager::create(['driver' => 'pdo_sqlite'], $config);
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
index b60a08b2ff712..36bb326eceb33 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
@@ -16,12 +16,9 @@
use Symfony\Bridge\Doctrine\Security\User\EntityUserProvider;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Bridge\Doctrine\Tests\Fixtures\User;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class EntityUserProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRefreshUserGetsUserByPrimaryKey()
{
$em = DoctrineTestHelper::createTestEntityManager();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
index 15e3b5f79647f..ff29b1f284c4e 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
@@ -32,7 +32,6 @@
use Symfony\Bridge\Doctrine\Tests\Fixtures\Type\StringWrapper;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
@@ -40,8 +39,6 @@
*/
class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
const EM_NAME = 'foo';
/**
@@ -61,7 +58,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
protected $repositoryFactory;
- private function doSetUp()
+ protected function setUp()
{
$this->repositoryFactory = new TestRepositoryFactory();
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
index 75a494dbb18ee..82cfb6f566d9e 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClockMock;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Dominic Tubach
@@ -22,14 +21,12 @@
*/
class ClockMockTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
ClockMock::register(__CLASS__);
}
- private function doSetUp()
+ protected function setUp()
{
ClockMock::withClockMock(1234567890.125);
}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
index 4ef2d75b805e3..a178ac7e898c7 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
@@ -13,13 +13,10 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DnsMock;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class DnsMockTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doTearDown()
+ protected function tearDown()
{
DnsMock::withMockedHosts(array());
}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
index b75ff1cfc0c5d..b8125dc5582e7 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Bridge\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* Don't remove this test case, it tests the legacy group.
@@ -14,8 +13,6 @@
*/
class ProcessIsolationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @expectedDeprecation Test abc
*/
diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php
index 9ea6791fd3386..e58b7d6356161 100644
--- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php
+++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Instantiator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
use Symfony\Component\DependencyInjection\Definition;
@@ -23,8 +22,6 @@
*/
class RuntimeInstantiatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var RuntimeInstantiator
*/
@@ -33,7 +30,7 @@ class RuntimeInstantiatorTest extends TestCase
/**
* {@inheritdoc}
*/
- private function doSetUp()
+ protected function setUp()
{
$this->instantiator = new RuntimeInstantiator();
}
diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
index 6b97cf48ef476..5328c9ae1227d 100644
--- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -25,8 +24,6 @@
*/
class ProxyDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ProxyDumper
*/
@@ -35,7 +32,7 @@ class ProxyDumperTest extends TestCase
/**
* {@inheritdoc}
*/
- private function doSetUp()
+ protected function setUp()
{
$this->dumper = new ProxyDumper();
}
diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
index a461ef4c55fbe..4a3f04fddef18 100644
--- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Bridge\Twig\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\AppVariable;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
@@ -11,14 +10,12 @@
class AppVariableTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var AppVariable
*/
protected $appVariable;
- private function doSetUp()
+ protected function setUp()
{
$this->appVariable = new AppVariable();
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
index 55efa1d4bcf56..5a698221bd9a0 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Command\LintCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\OutputInterface;
@@ -22,8 +21,6 @@
class LintCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $files;
public function testLintCorrectFile()
@@ -114,12 +111,12 @@ private function createFile($content)
return $filename;
}
- private function doSetUp()
+ protected function setUp()
{
$this->files = [];
}
- private function doTearDown()
+ protected function tearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
index 11d42626ca8ad..02f6ac9b1e269 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -23,8 +22,6 @@
class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3HorizontalLayoutTest
{
- use ForwardCompatTestTrait;
-
use RuntimeLoaderProvider;
protected $testableFeatures = [
@@ -36,7 +33,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
*/
private $renderer;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
index 590ee7658e653..0c2ef171b254b 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -23,7 +22,6 @@
class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
{
- use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
@@ -31,7 +29,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
*/
private $renderer;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
index 658f069019cd4..319c0e57308a2 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -28,7 +27,6 @@
*/
class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4HorizontalLayoutTest
{
- use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
protected $testableFeatures = [
@@ -37,7 +35,7 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori
private $renderer;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
index 1f9808eb76cd1..ea36552d85b71 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -28,14 +27,13 @@
*/
class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
{
- use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
* @var FormRenderer
*/
private $renderer;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
index b5780b96fd856..214df3c7f6b18 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -25,7 +24,6 @@
class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
{
- use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
@@ -35,7 +33,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
protected static $supportedFeatureSetVersion = 304;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
index 2b02970963510..f956767363a97 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
@@ -24,7 +23,6 @@
class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
{
- use ForwardCompatTestTrait;
use RuntimeLoaderProvider;
/**
@@ -34,7 +32,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
protected static $supportedFeatureSetVersion = 304;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
index bcee512a21fbf..c635935f3e7ae 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\HttpKernelExtension;
use Symfony\Bridge\Twig\Extension\HttpKernelRuntime;
use Symfony\Component\HttpFoundation\Request;
@@ -23,8 +22,6 @@
class HttpKernelExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testFragmentWithError()
{
$this->expectException('Twig\Error\RuntimeError');
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
index cac643f45b014..2b38122e56410 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\StopwatchExtension;
use Twig\Environment;
use Twig\Error\RuntimeError;
@@ -20,8 +19,6 @@
class StopwatchExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testFailIfStoppingWrongEvent()
{
$this->expectException('Twig\Error\SyntaxError');
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
index 087ddf195426f..aeb109fd250d3 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Translator;
@@ -21,8 +20,6 @@
class TranslationExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testEscaping()
{
$output = $this->getTemplate('{% trans %}Percent: %value%%% (%msg%){% endtrans %}')->render(['value' => 12, 'msg' => 'approx.']);
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php
index e9a4ce166736b..f49eea396d0d8 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php
@@ -13,7 +13,6 @@
use Fig\Link\Link;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\WebLinkExtension;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -23,8 +22,6 @@
*/
class WebLinkExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var Request
*/
@@ -35,7 +32,7 @@ class WebLinkExtensionTest extends TestCase
*/
private $extension;
- private function doSetUp()
+ protected function setUp()
{
$this->request = new Request();
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php
index e608e450736a2..20d78bfe3986c 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\WorkflowExtension;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Registry;
@@ -22,11 +21,9 @@
class WorkflowExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $extension;
- private function doSetUp()
+ protected function setUp()
{
$places = ['ordered', 'waiting_for_payment', 'processed'];
$transitions = [
diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
index 4b82573391f9f..3f14878d1eb1c 100644
--- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests\Translation;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Translation\TwigExtractor;
use Symfony\Component\Translation\MessageCatalogue;
@@ -22,8 +21,6 @@
class TwigExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getExtractData
*/
diff --git a/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php b/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php
index b198fff13a2b1..e136d0c763c66 100644
--- a/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bridge\Twig\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\Templating\TemplateReference;
use Twig\Environment;
@@ -20,8 +19,6 @@
class TwigEngineTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testExistsWithTemplateInstances()
{
$engine = $this->getTwig();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
index b5c8c4c171695..9cc3bfa2d2f91 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
@@ -5,7 +5,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Annotations\Reader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -16,11 +15,9 @@
class AnnotationsCacheWarmerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $cacheDir;
- private function doSetUp()
+ protected function setUp()
{
$this->cacheDir = sys_get_temp_dir().'/'.uniqid();
$fs = new Filesystem();
@@ -28,7 +25,7 @@ private function doSetUp()
parent::setUp();
}
- private function doTearDown()
+ protected function tearDown()
{
$fs = new Filesystem();
$fs->remove($this->cacheDir);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
index e0ac2485b0221..51c979c597825 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -23,8 +22,6 @@
class SerializerCacheWarmerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testWarmUp()
{
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
index 68fb05bdc8ae9..b63c746eb60ca 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;
@@ -22,8 +21,6 @@
class TemplatePathsCacheWarmerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var Filesystem */
private $filesystem;
@@ -38,7 +35,7 @@ class TemplatePathsCacheWarmerTest extends TestCase
private $tmpDir;
- private function doSetUp()
+ protected function setUp()
{
$this->templateFinder = $this
->getMockBuilder(TemplateFinderInterface::class)
@@ -59,7 +56,7 @@ private function doSetUp()
$this->filesystem->mkdir($this->tmpDir);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->filesystem->remove($this->tmpDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
index 416f4b6123a36..3f0a9a14d4f64 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
use PHPUnit\Framework\Warning;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -23,8 +22,6 @@
class ValidatorCacheWarmerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testWarmUp()
{
if (\PHP_VERSION_ID >= 70400) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
index c811fdadea577..c2cded7ab0966 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture\TestAppKernel;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -24,15 +23,13 @@
class CacheClearCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var TestAppKernel */
private $kernel;
/** @var Filesystem */
private $fs;
private $rootDir;
- private function doSetUp()
+ protected function setUp()
{
$this->fs = new Filesystem();
$this->kernel = new TestAppKernel('test', true);
@@ -41,7 +38,7 @@ private function doSetUp()
$this->fs->mkdir($this->rootDir);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->fs->remove($this->rootDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
index b6ff5aa7c2e73..aa6229c5355ea 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -22,8 +21,6 @@
class RouterDebugCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDebugAllRoutes()
{
$tester = $this->createCommandTester();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index ab9df092daac1..a93906e15b106 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -21,8 +20,6 @@
class TranslationDebugCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $fs;
private $translationDir;
@@ -110,7 +107,7 @@ public function testDebugInvalidDirectory()
$tester->execute(['locale' => 'en', 'bundle' => 'dir']);
}
- private function doSetUp()
+ protected function setUp()
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation', true);
@@ -120,7 +117,7 @@ private function doSetUp()
$this->fs->mkdir($this->translationDir.'/templates');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->fs->remove($this->translationDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index cd691df5972aa..7e487ff527113 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -21,8 +20,6 @@
class TranslationUpdateCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $fs;
private $translationDir;
@@ -90,7 +87,7 @@ public function testWriteMessagesForSpecificDomain()
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
}
- private function doSetUp()
+ protected function setUp()
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation', true);
@@ -100,7 +97,7 @@ private function doSetUp()
$this->fs->mkdir($this->translationDir.'/templates');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->fs->remove($this->translationDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
index 9ace5673074bb..cb6595bf1f296 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Application as BaseApplication;
@@ -29,8 +28,6 @@
*/
class YamlLintCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $files;
public function testLintCorrectFile()
@@ -184,13 +181,13 @@ private function getKernelAwareApplicationMock()
return $application;
}
- private function doSetUp()
+ protected function setUp()
{
@mkdir(sys_get_temp_dir().'/yml-lint-test');
$this->files = [];
}
- private function doTearDown()
+ protected function tearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
index 1b9d91df1c2b4..e775ac7cf199a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
@@ -11,19 +11,16 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Descriptor\TextDescriptor;
class TextDescriptorTest extends AbstractDescriptorTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
putenv('COLUMNS=121');
}
- private function doTearDown()
+ protected function tearDown()
{
putenv('COLUMNS');
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
index f6a6590396de9..91a72821e9539 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
use Composer\Autoload\ClassLoader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\HttpKernel\Kernel;
class ControllerNameParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $loader;
- private function doSetUp()
+ protected function setUp()
{
$this->loader = new ClassLoader();
$this->loader->add('TestBundle', __DIR__.'/../Fixtures');
@@ -31,7 +28,7 @@ private function doSetUp()
$this->loader->register();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->loader->unregister();
$this->loader = null;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
index 5cefd5cff2ce8..030b31f0d00a0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
@@ -32,8 +31,6 @@
abstract class ControllerTraitTest extends TestCase
{
- use ForwardCompatTestTrait;
-
abstract protected function createController();
public function testForward()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php
index 5972595d96666..7b4ed8e514481 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Controller\TemplateController;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -21,8 +20,6 @@
*/
class TemplateControllerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testTwig()
{
$twig = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
index 8b999941b7f4f..16f0f68d2745f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -23,8 +22,6 @@
*/
class AddConsoleCommandPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider visibilityProvider
*/
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php
index f0f16698eeda7..81a8512858d89 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -25,8 +24,6 @@
*/
class AddConstraintValidatorsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testThatConstraintValidatorServicesAreProcessed()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
index a8d0e2d9fedbf..53ea1bf68227d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\DependencyInjection\ChildDefinition;
@@ -22,11 +21,9 @@
class CachePoolPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $cachePoolPass;
- private function doSetUp()
+ protected function setUp()
{
$this->cachePoolPass = new CachePoolPass();
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php
index e1175fea8eea2..1439d36f887d1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
@@ -22,8 +21,6 @@
class CachePoolPrunerPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCompilerPassReplacesCommandArgument()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
index 580b81aec0741..8748d1e9c7300 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -20,12 +19,10 @@
class DataCollectorTranslatorPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $container;
private $dataCollectorTranslatorPass;
- private function doSetUp()
+ protected function setUp()
{
$this->container = new ContainerBuilder();
$this->dataCollectorTranslatorPass = new DataCollectorTranslatorPass();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
index 8c73d9650a00b..a73093e7cc80f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -25,8 +24,6 @@
*/
class FormPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDoNothingIfFormExtensionNotLoaded()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
index bb4c5e00b4b6c..99299282aa06c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class ProfilerPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* Tests that collectors that specify a template but no "id" will throw
* an exception (both are needed if the template is specified).
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
index 9cf8d0fc0c85c..0bc621acb4a04 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -26,8 +25,6 @@
*/
class SerializerPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testThrowExceptionWhenNoNormalizers()
{
$this->expectException('RuntimeException');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
index e1595fabc37cf..a267908ec0866 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\WorkflowGuardListenerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
@@ -23,12 +22,10 @@
class WorkflowGuardListenerPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $container;
private $compilerPass;
- private function doSetUp()
+ protected function setUp()
{
$this->container = new ContainerBuilder();
$this->compilerPass = new WorkflowGuardListenerPass();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
index bf986714c5832..35c6101537e5b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
use Symfony\Bundle\FullStack;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
@@ -21,8 +20,6 @@
class ConfigurationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDefaultConfig()
{
$processor = new Processor();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 7517b1a42f677..7ff16746fd64a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
use Doctrine\Common\Annotations\Annotation;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -48,8 +47,6 @@
abstract class FrameworkExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $containerCache = [];
abstract protected function loadFromFile(ContainerBuilder $container, $file);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
index 6f36888de4136..afccc84d5b047 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
class PhpFrameworkExtensionTest extends FrameworkExtensionTest
{
- use ForwardCompatTestTrait;
-
protected function loadFromFile(ContainerBuilder $container, $file)
{
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
index c7c13eb05f3b8..03c6bdcbd7e11 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
@@ -11,26 +11,23 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
abstract class AbstractWebTestCase extends BaseWebTestCase
{
- use ForwardCompatTestTrait;
-
public static function assertRedirect($response, $location)
{
self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.$response->getStatusCode());
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
}
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
static::deleteTmpDir();
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
static::deleteTmpDir();
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
index 95cf725ce9c7e..bb33f5436e12c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -21,9 +20,7 @@
*/
class CachePoolClearCommandTest extends AbstractWebTestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
static::bootKernel(['test_case' => 'CachePoolClear', 'root_config' => 'config.yml']);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
index f3a69dfcc7c3d..13815b95989ee 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
class CachePoolsTest extends AbstractWebTestCase
{
- use ForwardCompatTestTrait;
-
public function testCachePools()
{
$this->doTestCachePools([], AdapterInterface::class);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
index 11048a4605e92..c10750eaa9352 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
@@ -22,11 +21,9 @@
*/
class ConfigDebugCommandTest extends AbstractWebTestCase
{
- use ForwardCompatTestTrait;
-
private $application;
- private function doSetUp()
+ protected function setUp()
{
$kernel = static::createKernel(['test_case' => 'ConfigDump', 'root_config' => 'config.yml']);
$this->application = new Application($kernel);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
index f402af5c3717c..b8ac6645f6fac 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
@@ -22,11 +21,9 @@
*/
class ConfigDumpReferenceCommandTest extends AbstractWebTestCase
{
- use ForwardCompatTestTrait;
-
private $application;
- private function doSetUp()
+ protected function setUp()
{
$kernel = static::createKernel(['test_case' => 'ConfigDump', 'root_config' => 'config.yml']);
$this->application = new Application($kernel);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
index 2280a4bec590a..7560badbe3207 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Routing;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
use Symfony\Component\Routing\Route;
@@ -20,8 +19,6 @@
class RouterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGenerateWithServiceParam()
{
$routes = new RouteCollection();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
index 41094ad2aa726..54733955980c3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
use Symfony\Component\HttpFoundation\Response;
class DelegatingEngineTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupportsRetrievesEngineFromTheContainer()
{
$container = $this->getContainerMock([
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
index 5e15b25d63177..46a581b9442e4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
@@ -11,19 +11,16 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
class GlobalVariablesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $container;
private $globals;
- private function doSetUp()
+ protected function setUp()
{
$this->container = new Container();
$this->globals = new GlobalVariables($this->container);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php
index e86b647cf175f..83df0640bfaee 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper;
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\Packages;
@@ -20,11 +19,9 @@
class AssetsHelperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $helper;
- private function doSetUp()
+ protected function setUp()
{
$fooPackage = new Package(new StaticVersionStrategy('42', '%s?v=%s'));
$barPackage = new Package(new StaticVersionStrategy('22', '%s?%s'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
index edd3ae6b9cc38..03b2ed6961b7d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTranslator;
@@ -23,8 +22,6 @@
class FormHelperDivLayoutTest extends AbstractDivLayoutTest
{
- use ForwardCompatTestTrait;
-
/**
* @var PhpEngine
*/
@@ -55,7 +52,7 @@ protected function getExtensions()
]);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->engine = null;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
index 72b6aeda061eb..bd088078c32d1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTranslator;
@@ -23,8 +22,6 @@
class FormHelperTableLayoutTest extends AbstractTableLayoutTest
{
- use ForwardCompatTestTrait;
-
/**
* @var PhpEngine
*/
@@ -80,7 +77,7 @@ protected function getExtensions()
]);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->engine = null;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php
index 3cf9a3f103083..a2068ae757741 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
class RequestHelperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $requestStack;
- private function doSetUp()
+ protected function setUp()
{
$this->requestStack = new RequestStack();
$request = new Request();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
index 0265a77f8e3cd..06984095f1a4b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -21,11 +20,9 @@
class SessionHelperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $requestStack;
- private function doSetUp()
+ protected function setUp()
{
$request = new Request();
@@ -39,7 +36,7 @@ private function doSetUp()
$this->requestStack->push($request);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->requestStack = null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
index d4d0cebfd6145..93a3d8d5e1020 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
class TemplateLocatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLocateATemplate()
{
$template = new TemplateReference('bundle', 'controller', 'name', 'format', 'engine');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
index 0e9f7dd20e4f6..16c66811750c9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
use Symfony\Bundle\FrameworkBundle\Templating\PhpEngine;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -24,8 +23,6 @@
class PhpEngineTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testEvaluateAddsAppGlobal()
{
$container = $this->getContainer();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php
index 1224d62ec8d61..3c44612b87631 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php
@@ -11,23 +11,20 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
class TemplateFilenameParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $parser;
- private function doSetUp()
+ protected function setUp()
{
$this->parser = new TemplateFilenameParser();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->parser = null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
index 180d0c938b8d7..b9cb308592c53 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -19,11 +18,9 @@
class TemplateNameParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $parser;
- private function doSetUp()
+ protected function setUp()
{
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel
@@ -40,7 +37,7 @@ private function doSetUp()
$this->parser = new TemplateNameParser($kernel);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->parser = null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
index 3c23f9a06c56e..c9396624f0bac 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Translation\Formatter\MessageFormatter;
@@ -21,17 +20,15 @@
class TranslatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $tmpDir;
- private function doSetUp()
+ protected function setUp()
{
$this->tmpDir = sys_get_temp_dir().'/sf2_translation';
$this->deleteTmpDir();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->deleteTmpDir();
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
index 8a3af2f2f2700..1b54098055846 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Validator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Validator\Constraint;
@@ -24,8 +23,6 @@
*/
class ConstraintValidatorFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetInstanceCreatesValidator()
{
$factory = new ConstraintValidatorFactory(new Container());
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
index b3825c5a8c851..48a03b3a62fc6 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddSecurityVotersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
@@ -22,8 +21,6 @@
class AddSecurityVotersPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testNoVoters()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
index 65243c7e4cf4c..60ab81a24e37d 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -23,8 +22,6 @@
abstract class CompleteConfigurationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
abstract protected function getLoader(ContainerBuilder $container);
abstract protected function getFileExtension();
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php
index 1097d9064c509..c3c6857243557 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\MainConfiguration;
use Symfony\Component\Config\Definition\Processor;
class MainConfigurationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* The minimal, required config needed to not have any required validation
* issues.
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php
index b6fa11875bedd..f327eece8f99c 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Security\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\GuardAuthenticationFactory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -21,8 +20,6 @@
class GuardAuthenticationFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getValidConfigurationTests
*/
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
index e3328ad0ddc96..02203a38af7b8 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\UserProvider\DummyProvider;
@@ -20,8 +19,6 @@
class SecurityExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testInvalidCheckPath()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
index 5d8d3516f4fad..72a67a9a48763 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
@@ -11,26 +11,23 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
class AbstractWebTestCase extends BaseWebTestCase
{
- use ForwardCompatTestTrait;
-
public static function assertRedirect($response, $location)
{
self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.substr($response, 0, 2000));
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
}
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
static::deleteTmpDir();
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
static::deleteTmpDir();
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
index bb0aed9bd82ed..8c327ad267af2 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand;
use Symfony\Component\Console\Application as ConsoleApplication;
@@ -28,8 +27,6 @@
*/
class UserPasswordEncoderCommandTest extends AbstractWebTestCase
{
- use ForwardCompatTestTrait;
-
/** @var CommandTester */
private $passwordEncoderCommandTester;
@@ -246,7 +243,7 @@ public function testLegacy()
$this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $tester->getDisplay());
}
- private function doSetUp()
+ protected function setUp()
{
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
$kernel = $this->createKernel(['test_case' => 'PasswordEncode']);
@@ -259,7 +256,7 @@ private function doSetUp()
$this->passwordEncoderCommandTester = new CommandTester($passwordEncoderCommand);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->passwordEncoderCommandTester = null;
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
index 46911e37c7b16..a112b64b55734 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class TwigLoaderPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ContainerBuilder
*/
@@ -34,7 +31,7 @@ class TwigLoaderPassTest extends TestCase
*/
private $pass;
- private function doSetUp()
+ protected function setUp()
{
$this->builder = new ContainerBuilder();
$this->builder->register('twig');
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
index 90d9010442d8f..63710a8e16eab 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
@@ -21,8 +20,6 @@
class CacheWarmingTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCacheIsProperlyWarmedWhenTemplatingIsAvailable()
{
$kernel = new CacheWarmingKernel(true);
@@ -47,12 +44,12 @@ public function testCacheIsProperlyWarmedWhenTemplatingIsDisabled()
$this->assertFileExists($kernel->getCacheDir().'/twig');
}
- private function doSetUp()
+ protected function setUp()
{
$this->deleteTempDir();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->deleteTempDir();
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
index be93a3225b3ef..dddfff76efcb7 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
@@ -21,8 +20,6 @@
class NoTemplatingEntryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function test()
{
$kernel = new NoTemplatingEntryKernel('dev', true);
@@ -33,12 +30,12 @@ public function test()
$this->assertContains('{ a: b }', $content);
}
- private function doSetUp()
+ protected function setUp()
{
$this->deleteTempDir();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->deleteTempDir();
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
index 9e5eb299b3586..7fa8dd2b42d03 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Bundle\TwigBundle\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
class FilesystemLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetSourceContext()
{
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
index 5c81319b3a8ed..7ec5f7dc2d550 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\WebProfilerBundle\Tests\DependencyInjection;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\WebProfilerBundle\DependencyInjection\WebProfilerExtension;
use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
@@ -23,8 +22,6 @@
class WebProfilerExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $kernel;
/**
* @var \Symfony\Component\DependencyInjection\Container
@@ -49,7 +46,7 @@ public static function assertSaneContainer(Container $container, $message = '',
self::assertEquals([], $errors, $message);
}
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -76,7 +73,7 @@ private function doSetUp()
$this->container->addCompilerPass(new RegisterListenersPass());
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
index d4fb9f402cb4e..1e5639a0b695b 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\WebProfilerBundle\Tests\Profiler;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symfony\Component\HttpKernel\Profiler\Profile;
@@ -24,8 +23,6 @@
*/
class TemplateManagerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var Environment
*/
@@ -41,7 +38,7 @@ class TemplateManagerTest extends TestCase
*/
protected $templateManager;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Asset/Tests/PackagesTest.php b/src/Symfony/Component/Asset/Tests/PackagesTest.php
index 0ab1505a8aa0f..b2d0de375051e 100644
--- a/src/Symfony/Component/Asset/Tests/PackagesTest.php
+++ b/src/Symfony/Component/Asset/Tests/PackagesTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Asset\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\Packages;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
class PackagesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetterSetters()
{
$packages = new Packages();
diff --git a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
index c95228ab7c659..8fc617a682201 100644
--- a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
+++ b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Asset\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
class UrlPackageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getConfigs
*/
diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
index 83f6885a2c01c..d74f3f6321687 100644
--- a/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
+++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Asset\Tests\VersionStrategy;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy;
class JsonManifestVersionStrategyTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetVersion()
{
$strategy = $this->createStrategy('manifest-valid.json');
diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
index 249703e82e96e..694b164851e19 100644
--- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\BrowserKit\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\BrowserKit\Cookie;
class CookieTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testToString()
{
$cookie = new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php
index b4beee075c429..d1fa9535cf5ca 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\RedisAdapter;
abstract class AbstractRedisAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testExpiration' => 'Testing expiration slows down the test suite',
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
@@ -31,7 +28,7 @@ public function createCachePool($defaultLifetime = 0)
return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!\extension_loaded('redis')) {
self::markTestSkipped('Extension redis required.');
@@ -42,7 +39,7 @@ private static function doSetUpBeforeClass()
}
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
index 15341bc8dde66..5758a28618e27 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
@@ -13,14 +13,11 @@
use Cache\IntegrationTests\CachePoolTest;
use Psr\Cache\CacheItemPoolInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\PruneableInterface;
abstract class AdapterTestCase extends CachePoolTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
index 4688a3736cbfd..5da7fa40174d5 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ChainAdapter;
@@ -25,8 +24,6 @@
*/
class ChainAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
public function createCachePool($defaultLifetime = 0)
{
return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
index 0beb73666b85c..fa8306826e5d8 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemPoolInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
/**
@@ -20,14 +19,12 @@
*/
class FilesystemAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
public function createCachePool($defaultLifetime = 0)
{
return new FilesystemAdapter('', $defaultLifetime);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
self::rmdir(sys_get_temp_dir().'/symfony-cache');
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php
index b54007bbbb08e..a803988d05bfc 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
class MaxIdLengthAdapterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLongKey()
{
$cache = $this->getMockBuilder(MaxIdLengthAdapter::class)
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
index b4fc5f87f9b37..3a996079ad96c 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
class MemcachedAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
@@ -26,7 +23,7 @@ class MemcachedAdapterTest extends AdapterTestCase
protected static $client;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!MemcachedAdapter::isSupported()) {
self::markTestSkipped('Extension memcached >=2.2.0 required.');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
index 761ab8d88a800..dd2a911858b32 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\PdoAdapter;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -20,12 +19,11 @@
*/
class PdoAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -37,7 +35,7 @@ private static function doSetUpBeforeClass()
$pool->createTable();
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
index 4c45b27bad404..aa53958cfab32 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Doctrine\DBAL\DriverManager;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\PdoAdapter;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -21,12 +20,11 @@
*/
class PdoDbalAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -38,7 +36,7 @@ private static function doSetUpBeforeClass()
$pool->createTable();
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
index 89d9b2d9dac13..751f758cc2c0b 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
@@ -21,8 +20,6 @@
*/
class PhpArrayAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testBasicUsage' => 'PhpArrayAdapter is read-only.',
'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.',
@@ -58,12 +55,12 @@ class PhpArrayAdapterTest extends AdapterTestCase
protected static $file;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- private function doTearDown()
+ protected function tearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php
index 4984656b108d6..4bdd7580fc557 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
@@ -20,8 +19,6 @@
*/
class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
@@ -33,12 +30,12 @@ class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
protected static $file;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- private function doTearDown()
+ protected function tearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php
index 3b5abc9e2bcfc..247160d53c268 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemPoolInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
/**
@@ -20,8 +19,6 @@
*/
class PhpFilesAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.',
];
@@ -35,7 +32,7 @@ public function createCachePool()
return new PhpFilesAdapter('sf-cache');
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
index 896624766af1b..7b43c61c6a6fb 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Predis\Connection\StreamConnection;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\RedisAdapter;
class PredisAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = new \Predis\Client(['host' => getenv('REDIS_HOST')]);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
index 02bbde1290053..b083703eea114 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
@@ -11,19 +11,16 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class PredisClusterAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = new \Predis\Client([['host' => getenv('REDIS_HOST')]]);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
index ee275789554ea..a06477342bbcc 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
@@ -25,7 +22,7 @@ private static function doSetUpBeforeClass()
self::$redis = new \Predis\Client(explode(' ', $hosts), ['cluster' => 'redis']);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
index 93e070671f8ed..810cb31a24712 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ProxyAdapter;
use Symfony\Component\Cache\CacheItem;
@@ -22,8 +21,6 @@
*/
class ProxyAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.',
'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.',
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
index b5db20a14aba4..0ab893a28ac31 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
@@ -11,16 +11,13 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Traits\RedisProxy;
class RedisAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
index f2734ff082455..77d3eadc8af67 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class RedisArrayAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
parent::setupBeforeClass();
if (!class_exists('RedisArray')) {
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
index 6bec87178ba7e..0df9b00331202 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class RedisClusterAdapterTest extends AbstractRedisAdapterTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
index 627822d61f03a..a28624402a40f 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
@@ -21,14 +20,12 @@
*/
class TagAwareAdapterTest extends AdapterTestCase
{
- use ForwardCompatTestTrait;
-
public function createCachePool($defaultLifetime = 0)
{
return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime));
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
}
diff --git a/src/Symfony/Component/Cache/Tests/CacheItemTest.php b/src/Symfony/Component/Cache/Tests/CacheItemTest.php
index 3c70b915a8ba8..28c681d156e98 100644
--- a/src/Symfony/Component/Cache/Tests/CacheItemTest.php
+++ b/src/Symfony/Component/Cache/Tests/CacheItemTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Cache\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\CacheItem;
class CacheItemTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testValidKey()
{
$this->assertSame('foo', CacheItem::validateKey('foo'));
diff --git a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
index a739084f71dd5..e6d10284e50c0 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\RedisCache;
abstract class AbstractRedisCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testSetTtl' => 'Testing expiration slows down the test suite',
'testSetMultipleTtl' => 'Testing expiration slows down the test suite',
@@ -31,7 +28,7 @@ public function createSimpleCache($defaultLifetime = 0)
return new RedisCache(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!\extension_loaded('redis')) {
self::markTestSkipped('Extension redis required.');
@@ -42,7 +39,7 @@ private static function doSetUpBeforeClass()
}
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
self::$redis = null;
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php b/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php
index 4c016fdc4f6b8..ff9944a3400b2 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php
@@ -13,14 +13,11 @@
use Cache\IntegrationTests\SimpleCacheTest;
use Psr\SimpleCache\CacheInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\PruneableInterface;
abstract class CacheTestCase extends SimpleCacheTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
index b9642843e3b80..bb469fad5bd97 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
use Psr\SimpleCache\CacheInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Simple\ArrayCache;
use Symfony\Component\Cache\Simple\ChainCache;
@@ -23,8 +22,6 @@
*/
class ChainCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
-
public function createSimpleCache($defaultLifetime = 0)
{
return new ChainCache([new ArrayCache($defaultLifetime), new FilesystemCache('', $defaultLifetime)], $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
index dd7c07d741892..21332232bcfa3 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Simple\MemcachedCache;
class MemcachedCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testSetTtl' => 'Testing expiration slows down the test suite',
'testSetMultipleTtl' => 'Testing expiration slows down the test suite',
@@ -27,7 +24,7 @@ class MemcachedCacheTest extends CacheTestCase
protected static $client;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!MemcachedCache::isSupported()) {
self::markTestSkipped('Extension memcached >=2.2.0 required.');
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
index 0886fc5da617b..f5a26341f1014 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\PdoCache;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -20,12 +19,11 @@
*/
class PdoCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -37,7 +35,7 @@ private static function doSetUpBeforeClass()
$pool->createTable();
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
index 8e48cd3a86972..4da2b603cf88f 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
use Doctrine\DBAL\DriverManager;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\PdoCache;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -21,12 +20,11 @@
*/
class PdoDbalCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
use PdoPruneableTrait;
protected static $dbFile;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!\extension_loaded('pdo_sqlite')) {
self::markTestSkipped('Extension pdo_sqlite required.');
@@ -38,7 +36,7 @@ private static function doSetUpBeforeClass()
$pool->createTable();
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$dbFile);
}
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php
index 0bcdeeacf9027..c18f714429614 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\NullCache;
use Symfony\Component\Cache\Simple\PhpArrayCache;
use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
@@ -21,8 +20,6 @@
*/
class PhpArrayCacheTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testBasicUsageWithLongKey' => 'PhpArrayCache does no writes',
@@ -52,12 +49,12 @@ class PhpArrayCacheTest extends CacheTestCase
protected static $file;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- private function doTearDown()
+ protected function tearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
index dbb2d300d411f..eba749cece224 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\FilesystemCache;
use Symfony\Component\Cache\Simple\PhpArrayCache;
use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
@@ -21,8 +20,6 @@
*/
class PhpArrayCacheWithFallbackTest extends CacheTestCase
{
- use ForwardCompatTestTrait;
-
protected $skippedTests = [
'testGetInvalidKeys' => 'PhpArrayCache does no validation',
'testGetMultipleInvalidKeys' => 'PhpArrayCache does no validation',
@@ -39,12 +36,12 @@ class PhpArrayCacheWithFallbackTest extends CacheTestCase
protected static $file;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
}
- private function doTearDown()
+ protected function tearDown()
{
if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
index 5de1114fc327f..4b60da4c62b95 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class RedisArrayCacheTest extends AbstractRedisCacheTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
parent::setupBeforeClass();
if (!class_exists('RedisArray')) {
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
index 5485c69869ec3..c2cd31a5b5495 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Simple\RedisCache;
class RedisCacheTest extends AbstractRedisCacheTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
parent::setupBeforeClass();
self::$redis = RedisCache::createConnection('redis://'.getenv('REDIS_HOST'));
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
index 5cbfe8eae99b6..de0f936589662 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Cache\Tests\Simple;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class RedisClusterCacheTest extends AbstractRedisCacheTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
diff --git a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
index ae6cb0d390d44..6706acbd36290 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\ClassLoader\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\ClassLoader\ClassLoader;
@@ -21,9 +20,7 @@
*/
class ApcClassLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
if (!(filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) {
$this->markTestSkipped('The apc extension is not enabled.');
@@ -32,7 +29,7 @@ private function doSetUp()
}
}
- private function doTearDown()
+ protected function tearDown()
{
if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
apcu_clear_cache();
diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
index ba14198f09673..e1d5f56de3ad5 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\ClassLoader\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\ClassLoader\Tests\Fixtures\DeclaredClass;
use Symfony\Component\ClassLoader\Tests\Fixtures\WarmedClass;
@@ -27,8 +26,6 @@
*/
class ClassCollectionLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testTraitDependencies()
{
require_once __DIR__.'/Fixtures/deps/traits.php';
diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php
index 595a4f25b459c..6190b9b450b40 100644
--- a/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php
+++ b/src/Symfony/Component/Config/Tests/ConfigCacheFactoryTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\ConfigCacheFactory;
class ConfigCacheFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCacheWithInvalidCallback()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php
index 5000b0edd7335..d0b70899b513a 100644
--- a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php
+++ b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php
@@ -12,22 +12,19 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Tests\Resource\ResourceStub;
class ConfigCacheTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $cacheFile = null;
- private function doSetUp()
+ protected function setUp()
{
$this->cacheFile = tempnam(sys_get_temp_dir(), 'config_');
}
- private function doTearDown()
+ protected function tearDown()
{
$files = [$this->cacheFile, $this->cacheFile.'.meta'];
diff --git a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
index 32ac55067ef57..25c2cfc699047 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\ScalarNode;
class ArrayNodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testNormalizeThrowsExceptionWhenFalseIsNotAllowed()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
diff --git a/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
index df10377d4a928..8552eeba39b75 100644
--- a/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\BooleanNode;
class BooleanNodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getValidValues
*/
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
index 976b46c27446c..1123b41599021 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;
@@ -20,8 +19,6 @@
class ArrayNodeDefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAppendingSomeNode()
{
$parent = new ArrayNodeDefinition('root');
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php
index dd605b80b0147..6f568a2df64f7 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition;
class BooleanNodeDefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCannotBeEmptyThrowsAnException()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php
index 6247bfaea39d8..2e43a1354de11 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition;
class EnumNodeDefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testWithOneValue()
{
$def = new EnumNodeDefinition('foo');
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
index 4332b60ddcfdf..85d0d36319e5c 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class ExprBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAlwaysExpression()
{
$test = $this->getTestBuilder()
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php
index cf91b69216c4a..5cc7cfea4f492 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder;
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition;
class NodeBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testThrowsAnExceptionWhenTryingToCreateANonRegisteredNodeType()
{
$this->expectException('RuntimeException');
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
index cfd71f4196d99..e60bf407fe6d4 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition;
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition;
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition;
class NumericNodeDefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testIncoherentMinAssertion()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
index edf30c6b7cb8b..53c9c256b32a0 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
class TreeBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testUsingACustomNodeBuilder()
{
$builder = new TreeBuilder();
diff --git a/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php
index 75625a6fbdee0..fa89eea23870b 100644
--- a/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\EnumNode;
class EnumNodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testFinalizeValue()
{
$node = new EnumNode('foo', null, ['foo', 'bar']);
diff --git a/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
index 16b570930d213..fed9f013db8ad 100644
--- a/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\FloatNode;
class FloatNodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getValidValues
*/
diff --git a/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
index b7fb73caf6b16..3fb1b771e5f94 100644
--- a/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\IntegerNode;
class IntegerNodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getValidValues
*/
diff --git a/src/Symfony/Component/Config/Tests/Definition/MergeTest.php b/src/Symfony/Component/Config/Tests/Definition/MergeTest.php
index db72d7f8fc8e7..8fee2635c7622 100644
--- a/src/Symfony/Component/Config/Tests/Definition/MergeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/MergeTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class MergeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testForbiddenOverwrite()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException');
diff --git a/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php b/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php
index db67a9f4916bf..200a985944f38 100644
--- a/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\NodeInterface;
class NormalizationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getEncoderTests
*/
diff --git a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
index e59421211d2a9..4413baf3c7841 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\ScalarNode;
class ScalarNodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getValidValues
*/
diff --git a/src/Symfony/Component/Config/Tests/FileLocatorTest.php b/src/Symfony/Component/Config/Tests/FileLocatorTest.php
index 6e2b1a045d6f9..e931916af9187 100644
--- a/src/Symfony/Component/Config/Tests/FileLocatorTest.php
+++ b/src/Symfony/Component/Config/Tests/FileLocatorTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
class FileLocatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getIsAbsolutePathTests
*/
diff --git a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
index ca8780370d8a4..438af9f286eae 100644
--- a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
+++ b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderResolver;
class DelegatingLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$loader = new DelegatingLoader($resolver = new LoaderResolver());
diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
index 55a6f70672fd1..35a911ef3a2d9 100644
--- a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
+++ b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Loader\Loader;
class LoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetSetResolver()
{
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
diff --git a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
index 8807d9fb0e235..5b1ec6461f416 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
@@ -13,15 +13,12 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fixtures\BadParent;
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
class ClassExistenceResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testToString()
{
$res = new ClassExistenceResource('BarClass');
diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
index 2bdd3849b2fc5..69f781c2e980e 100644
--- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
@@ -12,16 +12,13 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\DirectoryResource;
class DirectoryResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $directory;
- private function doSetUp()
+ protected function setUp()
{
$this->directory = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'symfonyDirectoryIterator';
if (!file_exists($this->directory)) {
@@ -30,7 +27,7 @@ private function doSetUp()
touch($this->directory.'/tmp.xml');
}
- private function doTearDown()
+ protected function tearDown()
{
if (!is_dir($this->directory)) {
return;
diff --git a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php
index ff80eddd4a790..433f65e8203db 100644
--- a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php
@@ -12,25 +12,22 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileExistenceResource;
class FileExistenceResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $resource;
protected $file;
protected $time;
- private function doSetUp()
+ protected function setUp()
{
$this->file = realpath(sys_get_temp_dir()).'/tmp.xml';
$this->time = time();
$this->resource = new FileExistenceResource($this->file);
}
- private function doTearDown()
+ protected function tearDown()
{
if (file_exists($this->file)) {
unlink($this->file);
diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
index 8aa0e4b3ac9a6..bf9e6f3155b73 100644
--- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
class FileResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $resource;
protected $file;
protected $time;
- private function doSetUp()
+ protected function setUp()
{
$this->file = sys_get_temp_dir().'/tmp.xml';
$this->time = time();
@@ -31,7 +28,7 @@ private function doSetUp()
$this->resource = new FileResource($this->file);
}
- private function doTearDown()
+ protected function tearDown()
{
if (!file_exists($this->file)) {
return;
diff --git a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php
index 4bc1d1aef25ba..cfbfd2b4554e2 100644
--- a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\GlobResource;
class GlobResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doTearDown()
+ protected function tearDown()
{
$dir = \dirname(__DIR__).'/Fixtures';
@rmdir($dir.'/TmpGlob');
diff --git a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php
index c235465178307..a2c2eeb811b20 100644
--- a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php
+++ b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php
@@ -12,23 +12,20 @@
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\ResourceCheckerConfigCache;
use Symfony\Component\Config\Tests\Resource\ResourceStub;
class ResourceCheckerConfigCacheTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $cacheFile = null;
- private function doSetUp()
+ protected function setUp()
{
$this->cacheFile = tempnam(sys_get_temp_dir(), 'config_');
}
- private function doTearDown()
+ protected function tearDown()
{
$files = [$this->cacheFile, "{$this->cacheFile}.meta"];
diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
index 3f54a1e68ef45..0c9cbc35f6659 100644
--- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
+++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Config\Tests\Util;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Util\XmlUtils;
class XmlUtilsTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadFile()
{
$fixtures = __DIR__.'/../Fixtures/Util/';
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index f39eb1ea4fca1..6e99c2b83d55b 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
@@ -40,18 +39,16 @@
class ApplicationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
private $colSize;
- private function doSetUp()
+ protected function setUp()
{
$this->colSize = getenv('COLUMNS');
}
- private function doTearDown()
+ protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
putenv('SHELL_VERBOSITY');
@@ -59,7 +56,7 @@ private function doTearDown()
unset($_SERVER['SHELL_VERBOSITY']);
}
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
require_once self::$fixturesPath.'/FooCommand.php';
diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
index ed6b1b3e5d838..148b29a6d3d48 100644
--- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\FormatterHelper;
@@ -27,11 +26,9 @@
class CommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../Fixtures/';
require_once self::$fixturesPath.'/TestCommand.php';
diff --git a/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php b/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php
index 15763253af42e..6a72706ee457f 100644
--- a/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Lock\Factory;
use Symfony\Component\Lock\Store\FlockStore;
@@ -20,11 +19,9 @@
class LockableTraitTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../Fixtures/';
require_once self::$fixturesPath.'/FooLockCommand.php';
diff --git a/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php b/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php
index 67625dc6c118d..50fe125a64b08 100644
--- a/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php
+++ b/src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Console\Tests\CommandLoader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Symfony\Component\DependencyInjection\ServiceLocator;
class ContainerCommandLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHas()
{
$loader = new ContainerCommandLoader(new ServiceLocator([
diff --git a/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php b/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php
index f0fd40637e6bf..a37ad18de1daa 100644
--- a/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php
+++ b/src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Console\Tests\CommandLoader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
class FactoryCommandLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHas()
{
$loader = new FactoryCommandLoader([
diff --git a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
index 8ed1b70e86078..1f8ae58e71c77 100644
--- a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
+++ b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
@@ -25,8 +24,6 @@
class AddConsoleCommandPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider visibilityProvider
*/
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php
index b170d8d00b2ca..d3020432efec7 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Console\Tests\Formatter;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Formatter\OutputFormatterStyleStack;
class OutputFormatterStyleStackTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testPush()
{
$stack = new OutputFormatterStyleStack();
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
index 2620ddbc86035..1240f7f340906 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Console\Tests\Formatter;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class OutputFormatterStyleTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$style = new OutputFormatterStyle('green', 'black', ['bold', 'underscore']);
diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
index 5c878759711f2..a0be9b8a6d94d 100644
--- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\StreamOutput;
@@ -22,17 +21,15 @@
*/
class ProgressBarTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $colSize;
- private function doSetUp()
+ protected function setUp()
{
$this->colSize = getenv('COLUMNS');
putenv('COLUMNS=120');
}
- private function doTearDown()
+ protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php
index df3a840927f45..6d803fc251efe 100644
--- a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\ProgressIndicator;
use Symfony\Component\Console\Output\StreamOutput;
@@ -12,8 +11,6 @@
*/
class ProgressIndicatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDefaultIndicator()
{
$bar = new ProgressIndicator($output = $this->getOutputStream());
diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
index 559f5e11d49bf..0c1d4d65e5a25 100644
--- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Console\Tests\Helper;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\HelperSet;
@@ -26,8 +25,6 @@
*/
class QuestionHelperTest extends AbstractQuestionHelperTest
{
- use ForwardCompatTestTrait;
-
public function testAskChoice()
{
$questionHelper = new QuestionHelper();
diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
index e464303782cda..a2d78621ddb6d 100644
--- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
@@ -2,7 +2,6 @@
namespace Symfony\Component\Console\Tests\Helper;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
@@ -15,8 +14,6 @@
*/
class SymfonyQuestionHelperTest extends AbstractQuestionHelperTest
{
- use ForwardCompatTestTrait;
-
public function testAskChoice()
{
$questionHelper = new SymfonyQuestionHelper();
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php b/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php
index 2b1c07fd5c841..5980192540c94 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\TableStyle;
class TableStyleTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSetPadTypeWithInvalidType()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
index c7241cb26d332..1693623c91b4f 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Helper\TableSeparator;
@@ -21,16 +20,14 @@
class TableTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $stream;
- private function doSetUp()
+ protected function setUp()
{
$this->stream = fopen('php://memory', 'r+');
}
- private function doTearDown()
+ protected function tearDown()
{
fclose($this->stream);
$this->stream = null;
@@ -117,11 +114,11 @@ public function renderProvider()
$books,
'compact',
<<<'TABLE'
- ISBN Title Author
- 99921-58-10-7 Divine Comedy Dante Alighieri
- 9971-5-0210-0 A Tale of Two Cities Charles Dickens
- 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
- 80-902734-1-6 And Then There Were None Agatha Christie
+ ISBN Title Author
+ 99921-58-10-7 Divine Comedy Dante Alighieri
+ 9971-5-0210-0 A Tale of Two Cities Charles Dickens
+ 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
+ 80-902734-1-6 And Then There Were None Agatha Christie
TABLE
],
@@ -130,14 +127,14 @@ public function renderProvider()
$books,
'borderless',
<<<'TABLE'
- =============== ========================== ==================
- ISBN Title Author
- =============== ========================== ==================
- 99921-58-10-7 Divine Comedy Dante Alighieri
- 9971-5-0210-0 A Tale of Two Cities Charles Dickens
- 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
- 80-902734-1-6 And Then There Were None Agatha Christie
- =============== ========================== ==================
+ =============== ========================== ==================
+ ISBN Title Author
+ =============== ========================== ==================
+ 99921-58-10-7 Divine Comedy Dante Alighieri
+ 9971-5-0210-0 A Tale of Two Cities Charles Dickens
+ 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
+ 80-902734-1-6 And Then There Were None Agatha Christie
+ =============== ========================== ==================
TABLE
],
diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
index 40f3e2fdc07b1..51cc6e5175396 100644
--- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
@@ -20,8 +19,6 @@
class ArgvInputTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$_SERVER['argv'] = ['cli.php', 'foo'];
diff --git a/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
index b46e48e27c7f0..5e10223dd39cd 100644
--- a/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
@@ -20,8 +19,6 @@
class ArrayInputTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetFirstArgument()
{
$input = new ArrayInput([]);
diff --git a/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php b/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
index f381c328b3c9a..1fbcf9fc93e6f 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\InputArgument;
class InputArgumentTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$argument = new InputArgument('foo');
diff --git a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
index c2e8361e0bfed..086d28a41fcaf 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
class InputDefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixtures;
protected $foo;
@@ -28,7 +25,7 @@ class InputDefinitionTest extends TestCase
protected $foo1;
protected $foo2;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixtures = __DIR__.'/../Fixtures/';
}
diff --git a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
index 6bdad84cbd903..f7dcbd18f2017 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\InputOption;
class InputOptionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$option = new InputOption('foo');
diff --git a/src/Symfony/Component/Console/Tests/Input/InputTest.php b/src/Symfony/Component/Console/Tests/Input/InputTest.php
index a387b0a420c37..060b750f473bf 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
@@ -20,8 +19,6 @@
class InputTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')]));
diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
index 8c8bc56be56c2..f1bbb61c5ff91 100644
--- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
+++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
@@ -14,7 +14,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
@@ -28,8 +27,6 @@
*/
class ConsoleLoggerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var DummyOutput
*/
diff --git a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
index b9c08db494a9f..d843fa4a4559c 100644
--- a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
+++ b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php
@@ -12,22 +12,19 @@
namespace Symfony\Component\Console\Tests\Output;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\StreamOutput;
class StreamOutputTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $stream;
- private function doSetUp()
+ protected function setUp()
{
$this->stream = fopen('php://memory', 'a', false);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->stream = null;
}
diff --git a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
index 323ef2dc08fae..88d00c8a9926b 100644
--- a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Style;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputInterface;
@@ -23,15 +22,13 @@
class SymfonyStyleTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var Command */
protected $command;
/** @var CommandTester */
protected $tester;
private $colSize;
- private function doSetUp()
+ protected function setUp()
{
$this->colSize = getenv('COLUMNS');
putenv('COLUMNS=121');
@@ -39,7 +36,7 @@ private function doSetUp()
$this->tester = new CommandTester($this->command);
}
- private function doTearDown()
+ protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
$this->command = null;
diff --git a/src/Symfony/Component/Console/Tests/TerminalTest.php b/src/Symfony/Component/Console/Tests/TerminalTest.php
index bf40393fb5de0..93b8c44a78158 100644
--- a/src/Symfony/Component/Console/Tests/TerminalTest.php
+++ b/src/Symfony/Component/Console/Tests/TerminalTest.php
@@ -12,23 +12,20 @@
namespace Symfony\Component\Console\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Terminal;
class TerminalTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $colSize;
private $lineSize;
- private function doSetUp()
+ protected function setUp()
{
$this->colSize = getenv('COLUMNS');
$this->lineSize = getenv('LINES');
}
- private function doTearDown()
+ protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
diff --git a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php
index 49d42314c2f88..74c3562001fca 100644
--- a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php
+++ b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Console\Tests\Tester;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Tester\ApplicationTester;
class ApplicationTesterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $application;
protected $tester;
- private function doSetUp()
+ protected function setUp()
{
$this->application = new Application();
$this->application->setAutoExit(false);
@@ -37,7 +34,7 @@ private function doSetUp()
$this->tester->run(['command' => 'foo', 'foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->application = null;
$this->tester = null;
diff --git a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
index 24a50c5a83aa0..e13dc1582900e 100644
--- a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
+++ b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Tests\Tester;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
@@ -25,12 +24,10 @@
class CommandTesterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $command;
protected $tester;
- private function doSetUp()
+ protected function setUp()
{
$this->command = new Command('foo');
$this->command->addArgument('command');
@@ -41,7 +38,7 @@ private function doSetUp()
$this->tester->execute(['foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->command = null;
$this->tester = null;
diff --git a/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php b/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php
index 8c96a80e59e5b..82e527c62e78b 100644
--- a/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\CssSelector\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\CssSelectorConverter;
class CssSelectorConverterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCssToXPath()
{
$converter = new CssSelectorConverter();
diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
index 8a83d661018e9..f63a15e0ab728 100644
--- a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\CssSelector\Tests\Parser;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\Node\SelectorNode;
@@ -21,8 +20,6 @@
class ParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @dataProvider getParserTestData */
public function testParser($source, $representation)
{
diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
index a94fa7be5f9be..fb47625a89ac5 100644
--- a/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\CssSelector\Tests\Parser;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\Parser\Token;
use Symfony\Component\CssSelector\Parser\TokenStream;
class TokenStreamTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetNext()
{
$stream = new TokenStream();
diff --git a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
index cd821635ac571..625096315dfcf 100644
--- a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
+++ b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\CssSelector\Tests\XPath;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\CssSelector\Node\ElementNode;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\Parser\Parser;
@@ -22,8 +21,6 @@
class TranslatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @dataProvider getXpathLiteralTestData */
public function testXpathLiteral($value, $literal)
{
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index 215f1bd4fbc81..9abbc33eb1b17 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Debug\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\DebugClassLoader;
use Symfony\Component\Debug\ErrorHandler;
class DebugClassLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var int Error reporting level before running tests
*/
@@ -27,7 +24,7 @@ class DebugClassLoaderTest extends TestCase
private $loader;
- private function doSetUp()
+ protected function setUp()
{
$this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader();
@@ -35,7 +32,7 @@ private function doSetUp()
DebugClassLoader::enable();
}
- private function doTearDown()
+ protected function tearDown()
{
DebugClassLoader::disable();
spl_autoload_unregister([$this->loader, 'loadClass']);
diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
index 6e8435198e9dc..3094d22d95d91 100644
--- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
@@ -14,7 +14,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LogLevel;
use Psr\Log\NullLogger;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\BufferingLogger;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\Exception\SilencedErrorContext;
@@ -29,8 +28,6 @@
*/
class ErrorHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRegister()
{
$handler = ErrorHandler::register();
diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
index eff43f8c66f76..18d04e47c9f5e 100644
--- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
+++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Debug\Tests\Exception;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -32,8 +31,6 @@
class FlattenExceptionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testStatusCode()
{
$flattened = FlattenException::create(new \RuntimeException(), 403);
diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
index b5e9a7e4ae07c..8a196649503c3 100644
--- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Debug\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\Exception\OutOfMemoryException;
use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
@@ -22,14 +21,12 @@
class ExceptionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
testHeader();
}
- private function doTearDown()
+ protected function tearDown()
{
testHeader();
}
diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
index b40b3fd496e35..9a56b3b4ec8fc 100644
--- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
@@ -13,16 +13,13 @@
use Composer\Autoload\ClassLoader as ComposerClassLoader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\DebugClassLoader;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
class ClassNotFoundFatalErrorHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
foreach (spl_autoload_functions() as $function) {
if (!\is_array($function)) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php
index 483bed80fe1d5..5091748392c5e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
class ChildDefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$def = new ChildDefinition('foo');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php
index 159342f6fd082..4e17778f8fb98 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class AutoAliasServicePassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcessWithMissingParameter()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
index 2cd26a950ea2a..84d396bebaedd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
@@ -34,8 +33,6 @@
*/
class AutowirePassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php
index a1a700337cb45..9554c23bb3109 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckArgumentsValidityPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,8 +20,6 @@
*/
class CheckArgumentsValidityPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php
index 86adf3d42933e..8d501368e470c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass;
@@ -22,8 +21,6 @@
class CheckCircularReferencesPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
index 26bb1851d4567..6caa38c7b49f5 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CheckDefinitionValidityPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcessDetectsSyntheticNonPublicDefinitions()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php
index faecec987f0bb..c4f331b18100d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,8 +20,6 @@
class CheckExceptionOnInvalidReferenceBehaviorPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
index 6ac8630b2a95c..85a8a40f13169 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class CheckReferenceValidityPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcessDetectsReferenceToAbstractDefinition()
{
$this->expectException('RuntimeException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php
index 528e883dc5148..273261976db77 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DefinitionErrorExceptionPassTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class DefinitionErrorExceptionPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testThrowsException()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
index 5b1862d97f135..810fbe48a573f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ExtensionCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -23,12 +22,10 @@
*/
class ExtensionCompilerPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $container;
private $pass;
- private function doSetUp()
+ protected function setUp()
{
$this->container = new ContainerBuilder();
$this->pass = new ExtensionCompilerPass();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
index b0aa67cf93ae8..d98db64064729 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
@@ -24,8 +23,6 @@
class InlineServiceDefinitionsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
index b4119253da53e..dc0a37d601387 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Resource\FileResource;
@@ -24,8 +23,6 @@
class MergeExtensionConfigurationPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testExpressionLanguageProviderForwarding()
{
$tmpProviders = [];
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php
index df72aa11369fb..2c42ba0ceb442 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
class RegisterEnvVarProcessorsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSimpleProcessor()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php
index 1dfcfad714631..a16bfc1690e78 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface as PsrContainerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass;
@@ -29,8 +28,6 @@
class RegisterServiceSubscribersPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testInvalidClass()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
index a924d2629f2c0..2f0a413ca930f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -22,8 +21,6 @@
class ReplaceAliasByActualDefinitionPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
index 089f4a78ebf27..85d6e02622f43 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
@@ -29,8 +28,6 @@
class ResolveBindingsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
index 1cb1139c7f419..27bb9157c8fc0 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
@@ -20,8 +19,6 @@
class ResolveChildDefinitionsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php
index e791ceae08cb0..0ab6303164688 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -20,8 +19,6 @@
class ResolveClassPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideValidClassId
*/
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php
index 8511172fb00ef..b87fb3db98483 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveFactoryClassPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -20,8 +19,6 @@
class ResolveFactoryClassPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
index c019683322c41..1996216aa6ec4 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
@@ -21,8 +20,6 @@
class ResolveInstanceofConditionalsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php
index 55fa2ab06de6d..a10d226f1c96f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -27,8 +26,6 @@
*/
class ResolveNamedArgumentsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
index 3e946932f44bd..5aa6471751f24 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class ResolveParameterPlaceHoldersPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $compilerPass;
private $container;
private $fooDefinition;
- private function doSetUp()
+ protected function setUp()
{
$this->compilerPass = new ResolveParameterPlaceHoldersPass();
$this->container = $this->createContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php
index 6c320ae821c05..2465bb7e37b6a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,8 +20,6 @@
class ResolveReferencesToAliasesPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php
index f30c96357910b..1de02d2577079 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -26,8 +25,6 @@
class ServiceLocatorTagPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testNoServices()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php
index 03ed02035eedc..153e0807ef862 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Config\AutowireServiceResource;
@@ -21,8 +20,6 @@
*/
class AutowireServiceResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var AutowireServiceResource
*/
@@ -31,7 +28,7 @@ class AutowireServiceResourceTest extends TestCase
private $class;
private $time;
- private function doSetUp()
+ protected function setUp()
{
$this->file = realpath(sys_get_temp_dir()).'/tmp.php';
$this->time = time();
@@ -104,7 +101,7 @@ public function testNotFreshIfClassNotFound()
$this->assertFalse($resource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the class no longer exists');
}
- private function doTearDown()
+ protected function tearDown()
{
if (!file_exists($this->file)) {
return;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
index 4b089936e749c..eb5fc5a99d2e1 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\ResourceCheckerInterface;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker;
@@ -20,8 +19,6 @@
class ContainerParametersResourceCheckerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var ContainerParametersResource */
private $resource;
@@ -31,7 +28,7 @@ class ContainerParametersResourceCheckerTest extends TestCase
/** @var ContainerInterface */
private $container;
- private function doSetUp()
+ protected function setUp()
{
$this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']);
$this->container = $this->getMockBuilder(ContainerInterface::class)->getMock();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php
index 392c84871c90e..e177ac16b80f7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php
@@ -12,17 +12,14 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
class ContainerParametersResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var ContainerParametersResource */
private $resource;
- private function doSetUp()
+ protected function setUp()
{
$this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']);
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index b42d60001df24..199179c9b4998 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -16,7 +16,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface as PsrContainerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\ComposerResource;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Config\Resource\FileResource;
@@ -46,8 +45,6 @@
class ContainerBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDefaultRegisteredDefinitions()
{
$builder = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
index 286a98b9d7dd7..ebc422ca9310b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
@@ -20,8 +19,6 @@
class ContainerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$sc = new Container();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
index 6afc5d9ae809d..fe132af484732 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
@@ -12,17 +12,14 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CrossCheckTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/Fixtures/';
diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php
index 093c5d0608d43..8d382f81f863f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
/**
@@ -20,8 +19,6 @@
*/
class DefinitionDecoratorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$def = new DefinitionDecorator('foo');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
index 6657761e000a7..1f1cd380f9386 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Definition;
class DefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$def = new Definition('stdClass');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
index 23f1cb8bb4d0f..ea11c7c533a3d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper;
@@ -20,11 +19,9 @@
class GraphvizDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../Fixtures/';
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index 118758ee0cbe5..1d3aa33978f4e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -14,7 +14,6 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
@@ -43,11 +42,9 @@
class PhpDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
index f9c545f01f647..e660c7e801547 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -22,11 +21,9 @@
class XmlDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php
index e94dcfb196573..49ee8e6f3002e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -25,11 +24,9 @@
class YamlDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
index a0190af93d72b..2830d46a7bc93 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
@@ -3,15 +3,12 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\EnvVarProcessor;
class EnvVarProcessorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const TEST_CONST = 'test';
/**
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
index cd01a897f3f9e..9f35b4a4193de 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\DependencyInjection\Tests\Extension;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
class ExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getResolvedEnabledFixtures
*/
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/Service2.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/Service2.php
index 44e7cacd2b70c..ba103fce0803b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/Service2.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/Service2.php
@@ -4,5 +4,4 @@
class Service2
{
-
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/Service5.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/Service5.php
index 691b427712e71..d2cff5b954305 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/Service5.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/Service5.php
@@ -4,5 +4,4 @@
class Service5
{
-
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/StubbedTranslator.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/StubbedTranslator.php
index 8e1c2a6ce5346..eed18426a7ff9 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/StubbedTranslator.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/StubbedTranslator.php
@@ -20,7 +20,6 @@ class StubbedTranslator
{
public function __construct(ContainerInterface $container)
{
-
}
public function addResource($format, $resource, $locale, $domain = null)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
index 59f7e9ad399a9..b4f969a0efa0a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -23,19 +22,17 @@
class DirectoryLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $fixturesPath;
private $container;
private $loader;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
- private function doSetUp()
+ protected function setUp()
{
$locator = new FileLocator(self::$fixturesPath);
$this->container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index 426b720f35d1e..7d002ff030931 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -14,7 +14,6 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface as PsrContainerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -37,11 +36,9 @@
class FileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
index 06cc8b2ebb6fa..6f02b9ff6193c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
class IniFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $container;
protected $loader;
- private function doSetUp()
+ protected function setUp()
{
$this->container = new ContainerBuilder();
$this->loader = new IniFileLoader($this->container, new FileLocator(realpath(__DIR__.'/../Fixtures/').'/ini'));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php
index 3200e344804a6..9167e18cedcab 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -24,14 +23,12 @@
class LoaderResolverTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $fixturesPath;
/** @var LoaderResolver */
private $resolver;
- private function doSetUp()
+ protected function setUp()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
index ab2fb11f69e5f..e1812305e791f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
@@ -21,8 +20,6 @@
class PhpFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator());
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index 6c33dba130b12..9fbeed91ff230 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Config\Resource\FileResource;
@@ -34,11 +33,9 @@
class XmlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
require_once self::$fixturesPath.'/includes/foo.php';
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index f149d7a558d4b..1d187848b3b39 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Config\Resource\FileResource;
@@ -34,11 +33,9 @@
class YamlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
require_once self::$fixturesPath.'/includes/foo.php';
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
index e0a978580e823..8c4a99f7de373 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
class EnvPlaceholderParameterBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetThrowsInvalidArgumentExceptionIfEnvNameContainsNonWordCharacters()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
index 532a5a014fef1..ed89c8e4e4253 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
class FrozenParameterBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$parameters = [
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php
index 31a1957c1388b..0a75b445b9e81 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -20,8 +19,6 @@
class ParameterBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$bag = new ParameterBag($parameters = [
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php
index a88a489bb11ff..52466af945459 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\DependencyInjection\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
class ServiceLocatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHas()
{
$locator = new ServiceLocator([
diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
index 843873c331e3e..26164dc545617 100644
--- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Crawler;
class CrawlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$crawler = new Crawler();
diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php
index 2e31be5fa528c..9b359d69785b3 100644
--- a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\DomCrawler\Tests\Field;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Field\FileFormField;
class FileFormFieldTest extends FormFieldTestCase
{
- use ForwardCompatTestTrait;
-
public function testInitialize()
{
$node = $this->createNode('input', '', ['type' => 'file']);
diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
index e218a6d863683..504a9bd4251d9 100644
--- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Form;
use Symfony\Component\DomCrawler\FormFieldRegistry;
class FormTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
// Ensure that the private helper class FormFieldRegistry is loaded
class_exists('Symfony\\Component\\DomCrawler\\Form');
diff --git a/src/Symfony/Component/DomCrawler/Tests/ImageTest.php b/src/Symfony/Component/DomCrawler/Tests/ImageTest.php
index 3308464d18fd8..0b258a4bbcf2b 100644
--- a/src/Symfony/Component/DomCrawler/Tests/ImageTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/ImageTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Image;
class ImageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructorWithANonImgTag()
{
$this->expectException('LogicException');
diff --git a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php
index 6f869fc64ac7c..8d82b6c3d31b8 100644
--- a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DomCrawler\Link;
class LinkTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructorWithANonATag()
{
$this->expectException('LogicException');
diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php
index 69badc9bc2cba..b920270da9d7d 100644
--- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php
+++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Dotenv\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\Dotenv\Exception\FormatException;
class DotenvTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getEnvDataWithFormatErrors
*/
diff --git a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
index 2974fd2bb5339..b157659dc0846 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
abstract class AbstractEventDispatcherTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/* Some pseudo events */
const preFoo = 'pre.foo';
const postFoo = 'post.foo';
@@ -34,13 +31,13 @@ abstract class AbstractEventDispatcherTest extends TestCase
private $listener;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = $this->createEventDispatcher();
$this->listener = new TestEventListener();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dispatcher = null;
$this->listener = null;
diff --git a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
index 847105b079f9c..34e28bcbb21fc 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\EventDispatcher\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -20,8 +19,6 @@
class RegisterListenersPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* Tests that event subscribers not implementing EventSubscriberInterface
* trigger an exception.
diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventTest.php
index 7ccb3b773c1ac..5be2ea09f9d2f 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/EventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/EventTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\Event;
/**
@@ -20,8 +19,6 @@
*/
class EventTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Component\EventDispatcher\Event
*/
@@ -31,7 +28,7 @@ class EventTest extends TestCase
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
- private function doSetUp()
+ protected function setUp()
{
$this->event = new Event();
}
@@ -40,7 +37,7 @@ private function doSetUp()
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
- private function doTearDown()
+ protected function tearDown()
{
$this->event = null;
}
diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
index fb9e1620a7c5f..0628d8518665d 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
@@ -20,8 +19,6 @@
*/
class GenericEventTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var GenericEvent
*/
@@ -32,7 +29,7 @@ class GenericEventTest extends TestCase
/**
* Prepares the environment before running a test.
*/
- private function doSetUp()
+ protected function setUp()
{
$this->subject = new \stdClass();
$this->event = new GenericEvent($this->subject, ['name' => 'Event']);
@@ -41,7 +38,7 @@ private function doSetUp()
/**
* Cleans up the environment after running a test.
*/
- private function doTearDown()
+ protected function tearDown()
{
$this->subject = null;
$this->event = null;
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
index a786ee2b9b332..c1ac749b9bc1f 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\EventDispatcher\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
@@ -21,8 +20,6 @@
*/
class ImmutableEventDispatcherTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -33,7 +30,7 @@ class ImmutableEventDispatcherTest extends TestCase
*/
private $dispatcher;
- private function doSetUp()
+ protected function setUp()
{
$this->innerDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
index 8d81c2b9d94d6..d7e23cb41abcc 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionFunctionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
/**
@@ -22,8 +21,6 @@
*/
class ExpressionFunctionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testFunctionDoesNotExist()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
index 348b37115794c..d6e46768bdd6b 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ParsedExpression;
@@ -20,8 +19,6 @@
class ExpressionLanguageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCachedParse()
{
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock();
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
index b26f925cf0f77..9ab6b1e843ce0 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\Lexer;
use Symfony\Component\ExpressionLanguage\Token;
use Symfony\Component\ExpressionLanguage\TokenStream;
class LexerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var Lexer
*/
private $lexer;
- private function doSetUp()
+ protected function setUp()
{
$this->lexer = new Lexer();
}
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php
index d5373636232ff..28e9ef5725043 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\Node\Node;
use Symfony\Component\ExpressionLanguage\ParsedExpression;
use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter;
@@ -22,8 +21,6 @@
*/
class ParserCacheAdapterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetItem()
{
$poolMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
index 8fcddeb606f66..84b30dc151cf4 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\ExpressionLanguage\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\Lexer;
use Symfony\Component\ExpressionLanguage\Node;
use Symfony\Component\ExpressionLanguage\Parser;
class ParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testParseWithInvalidName()
{
$this->expectException('Symfony\Component\ExpressionLanguage\SyntaxError');
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index e8dedf72ac5d1..1ed86fc65ea16 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Filesystem\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* Test class for Filesystem.
*/
class FilesystemTest extends FilesystemTestCase
{
- use ForwardCompatTestTrait;
-
public function testCopyCreatesNewFile()
{
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
index b3fd67cbe8fcc..eb6b35ddfd621 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Filesystem\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
class FilesystemTestCase extends TestCase
{
- use ForwardCompatTestTrait;
-
private $umask;
protected $longPathNamesWindows = [];
@@ -43,7 +40,7 @@ class FilesystemTestCase extends TestCase
*/
private static $symlinkOnWindows = null;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if ('\\' === \DIRECTORY_SEPARATOR) {
self::$linkOnWindows = true;
@@ -72,7 +69,7 @@ private static function doSetUpBeforeClass()
}
}
- private function doSetUp()
+ protected function setUp()
{
$this->umask = umask(0);
$this->filesystem = new Filesystem();
@@ -81,7 +78,7 @@ private function doSetUp()
$this->workspace = realpath($this->workspace);
}
- private function doTearDown()
+ protected function tearDown()
{
if (!empty($this->longPathNamesWindows)) {
foreach ($this->longPathNamesWindows as $path) {
diff --git a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php
index 5048d99849ff1..d130803d44cae 100644
--- a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Filesystem\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\LockHandler;
@@ -22,8 +21,6 @@
*/
class LockHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructWhenRepositoryDoesNotExist()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php
index 0f2f47caa37d7..6e580560686ee 100644
--- a/src/Symfony/Component/Finder/Tests/FinderTest.php
+++ b/src/Symfony/Component/Finder/Tests/FinderTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Finder\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Finder\Finder;
class FinderTest extends Iterator\RealIteratorTestCase
{
- use ForwardCompatTestTrait;
-
public function testCreate()
{
$this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
index 9c6e7db03f9cc..56d958cb605dd 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Finder\Tests\Iterator;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Finder\Iterator\CustomFilterIterator;
class CustomFilterIteratorTest extends IteratorTestCase
{
- use ForwardCompatTestTrait;
-
public function testWithInvalidFilter()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
index 281cbf1093b89..1a4d9ababaeb3 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
@@ -11,16 +11,13 @@
namespace Symfony\Component\Finder\Tests\Iterator;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
abstract class RealIteratorTestCase extends IteratorTestCase
{
- use ForwardCompatTestTrait;
-
protected static $tmpDir;
protected static $files;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
@@ -62,7 +59,7 @@ private static function doSetUpBeforeClass()
touch(self::toAbsolute('test.php'), strtotime('2005-10-15'));
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
$paths = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
index 0a3edfee30247..00d9e0fbd485e 100644
--- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormBuilder;
abstract class AbstractFormTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var EventDispatcherInterface
*/
@@ -36,14 +33,14 @@ abstract class AbstractFormTest extends TestCase
*/
protected $form;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->form = $this->createForm();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dispatcher = null;
$this->factory = null;
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index 1309e680396a0..4e01253e2e564 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormView;
@@ -19,13 +18,12 @@
abstract class AbstractLayoutTest extends FormIntegrationTestCase
{
- use ForwardCompatTestTrait;
use VersionAwareTest;
protected $csrfTokenManager;
protected $testableFeatures = [];
- private function doSetUp()
+ protected function setUp()
{
if (!\extension_loaded('intl')) {
$this->markTestSkipped('Extension intl is required.');
@@ -45,7 +43,7 @@ protected function getExtensions()
];
}
- private function doTearDown()
+ protected function tearDown()
{
$this->csrfTokenManager = null;
diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
index 36126dcb086c2..f2ee71b3424cd 100644
--- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Form;
@@ -27,8 +26,6 @@
*/
abstract class AbstractRequestHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var RequestHandlerInterface
*/
@@ -43,7 +40,7 @@ abstract class AbstractRequestHandlerTest extends TestCase
protected $serverParams;
- private function doSetUp()
+ protected function setUp()
{
$this->serverParams = $this->getMockBuilder('Symfony\Component\Form\Util\ServerParams')->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
$this->requestHandler = $this->getRequestHandler();
diff --git a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
index f012868c734d5..0cdda9243321a 100644
--- a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\Exception\InvalidArgumentException;
@@ -21,8 +20,6 @@
*/
class ButtonBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function getValidNames()
{
return [
diff --git a/src/Symfony/Component/Form/Tests/ButtonTest.php b/src/Symfony/Component/Form/Tests/ButtonTest.php
index 92430069954f9..d4ef819fff3d3 100644
--- a/src/Symfony/Component/Form/Tests/ButtonTest.php
+++ b/src/Symfony/Component/Form/Tests/ButtonTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\FormBuilder;
@@ -21,13 +20,11 @@
*/
class ButtonTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $dispatcher;
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php
index 3c5290cd86b76..aca967daba16a 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Bernhard Schussek
*/
abstract class AbstractChoiceListTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Component\Form\ChoiceList\ChoiceListInterface
*/
@@ -106,7 +103,7 @@ abstract class AbstractChoiceListTest extends TestCase
*/
protected $key4;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php
index c6a80f9b638aa..c71fd75bcf7f6 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
/**
@@ -19,11 +18,9 @@
*/
class ArrayChoiceListTest extends AbstractChoiceListTest
{
- use ForwardCompatTestTrait;
-
private $object;
- private function doSetUp()
+ protected function setUp()
{
$this->object = new \stdClass();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
index 53540651e5612..7277d49780d65 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator;
/**
@@ -20,8 +19,6 @@
*/
class CachingFactoryDecoratorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -32,7 +29,7 @@ class CachingFactoryDecoratorTest extends TestCase
*/
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->factory = new CachingFactoryDecorator($this->decoratedFactory);
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
index 76280d4c5df16..5a9884e2951b0 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory;
@@ -23,8 +22,6 @@
class DefaultChoiceListFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $obj1;
private $obj2;
@@ -87,7 +84,7 @@ public function getGroupAsObject($object)
: new DefaultChoiceListFactoryTest_Castable('Group 2');
}
- private function doSetUp()
+ protected function setUp()
{
$this->obj1 = (object) ['label' => 'A', 'index' => 'w', 'value' => 'a', 'preferred' => false, 'group' => 'Group 1', 'attr' => []];
$this->obj2 = (object) ['label' => 'B', 'index' => 'x', 'value' => 'b', 'preferred' => true, 'group' => 'Group 1', 'attr' => ['attr1' => 'value1']];
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
index 9e16699a7b733..42893696db622 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator;
use Symfony\Component\PropertyAccess\PropertyPath;
@@ -21,8 +20,6 @@
*/
class PropertyAccessDecoratorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -33,7 +30,7 @@ class PropertyAccessDecoratorTest extends TestCase
*/
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->factory = new PropertyAccessDecorator($this->decoratedFactory);
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
index d6cffc9447b71..6854c43ef733f 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
@@ -21,8 +20,6 @@
*/
class LazyChoiceListTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var LazyChoiceList
*/
@@ -40,7 +37,7 @@ class LazyChoiceListTest extends TestCase
private $value;
- private function doSetUp()
+ protected function setUp()
{
$this->loadedList = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
$this->loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
index ffde233264e0a..362783c91e8e6 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
@@ -21,8 +20,6 @@
*/
class CallbackChoiceLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader
*/
@@ -48,7 +45,7 @@ class CallbackChoiceLoaderTest extends TestCase
*/
private static $lazyChoiceList;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$loader = new CallbackChoiceLoader(function () {
return self::$choices;
@@ -94,7 +91,7 @@ public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall()
);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
self::$loader = null;
self::$value = null;
diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
index b36b45d9b5367..350cb82ecaeb3 100644
--- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Tester\CommandTester;
@@ -22,8 +21,6 @@
class DebugCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDebugDefaults()
{
$tester = $this->createCommandTester();
diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
index 516bd52d68717..8e1b45b9d0851 100644
--- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php
+++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
@@ -27,8 +26,6 @@
class CompoundFormTest extends AbstractFormTest
{
- use ForwardCompatTestTrait;
-
public function testValidIfAllChildrenAreValid()
{
$this->form->add($this->getBuilder('firstName')->getForm());
diff --git a/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php b/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php
index b8e8dd1b95afb..fb339f6b475ed 100644
--- a/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php
+++ b/src/Symfony/Component/Form/Tests/Console/Descriptor/JsonDescriptorTest.php
@@ -11,19 +11,16 @@
namespace Symfony\Component\Form\Tests\Console\Descriptor;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Console\Descriptor\JsonDescriptor;
class JsonDescriptorTest extends AbstractDescriptorTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
putenv('COLUMNS=121');
}
- private function doTearDown()
+ protected function tearDown()
{
putenv('COLUMNS');
}
diff --git a/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php b/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php
index c361874e8230f..053f7e4512341 100644
--- a/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php
+++ b/src/Symfony/Component/Form/Tests/Console/Descriptor/TextDescriptorTest.php
@@ -11,19 +11,16 @@
namespace Symfony\Component\Form\Tests\Console\Descriptor;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Console\Descriptor\TextDescriptor;
class TextDescriptorTest extends AbstractDescriptorTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
putenv('COLUMNS=121');
}
- private function doTearDown()
+ protected function tearDown()
{
putenv('COLUMNS');
}
diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php
index 4dba3e1737ce4..64393a049840a 100644
--- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php
+++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -28,8 +27,6 @@
*/
class FormPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDoNothingIfFormExtensionNotLoaded()
{
$container = $this->createContainerBuilder();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
index 80017a0ffb12a..da351295c381e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataMapper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
@@ -24,8 +23,6 @@
class PropertyPathMapperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PropertyPathMapper
*/
@@ -41,7 +38,7 @@ class PropertyPathMapperTest extends TestCase
*/
private $propertyAccessor;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$this->propertyAccessor = PropertyAccess::createPropertyAccessor();
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 e1e7ad0eeeab1..fbcec854b28fe 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
@@ -12,16 +12,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
class ArrayToPartsTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $transformer;
- private function doSetUp()
+ protected function setUp()
{
$this->transformer = new ArrayToPartsTransformer([
'first' => ['a', 'b', 'c'],
@@ -29,7 +26,7 @@ private function doSetUp()
]);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->transformer = null;
}
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 d3dc7e3a26471..5aa87d6004cc4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php
@@ -12,12 +12,9 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class BaseDateTimeTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructFailsIfInputTimezoneIsInvalid()
{
$this->expectException('Symfony\Component\Form\Exception\InvalidArgumentException');
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 02cc314e837d3..d0c57498140af 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
class BooleanToStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const TRUE_VALUE = '1';
/**
@@ -26,12 +23,12 @@ class BooleanToStringTransformerTest extends TestCase
*/
protected $transformer;
- private function doSetUp()
+ protected function setUp()
{
$this->transformer = new BooleanToStringTransformer(self::TRUE_VALUE);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->transformer = null;
}
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 ee007b40d1a89..bdb7bb8f16284 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer;
class ChoiceToValueTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $transformer;
protected $transformerWithNull;
- private function doSetUp()
+ protected function setUp()
{
$list = new ArrayChoiceList(['', false, 'X', true]);
$listWithNull = new ArrayChoiceList(['', false, 'X', null]);
@@ -32,7 +29,7 @@ private function doSetUp()
$this->transformerWithNull = new ChoiceToValueTransformer($listWithNull);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->transformer = null;
$this->transformerWithNull = null;
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 6f008ba187143..76f9d1a7e5a57 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer;
class ChoicesToValuesTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $transformer;
protected $transformerWithNull;
- private function doSetUp()
+ protected function setUp()
{
$list = new ArrayChoiceList(['', false, 'X']);
$listWithNull = new ArrayChoiceList(['', false, 'X', null]);
@@ -32,7 +29,7 @@ private function doSetUp()
$this->transformerWithNull = new ChoicesToValuesTransformer($listWithNull);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->transformer = null;
$this->transformerWithNull = null;
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php
index 99c6f57f9ad37..cb7ec7c67bf64 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToArrayTransformer;
@@ -21,8 +20,6 @@
*/
class DateIntervalToArrayTransformerTest extends DateIntervalTestCase
{
- use ForwardCompatTestTrait;
-
public function testTransform()
{
$transformer = new DateIntervalToArrayTransformer();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php
index 796ba0d3793d9..f3127349cb580 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToStringTransformer;
@@ -21,8 +20,6 @@
*/
class DateIntervalToStringTransformerTest extends DateIntervalTestCase
{
- use ForwardCompatTestTrait;
-
public function dataProviderISO()
{
$data = [
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 5460203fc6c4b..92b01dd29b564 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
class DateTimeToArrayTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testTransform()
{
$transformer = new DateTimeToArrayTransformer('UTC', 'UTC');
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 facbe9510e900..5fd6c69f5e11b 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
@@ -12,13 +12,11 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToHtml5LocalDateTimeTransformer;
use Symfony\Component\Form\Tests\Extension\Core\DataTransformer\Traits\DateTimeEqualsTrait;
class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
use DateTimeEqualsTrait;
public function transformProvider()
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 a13182ddeb43f..d4602b88fd66a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Form\Tests\Extension\Core\DataTransformer\Traits\DateTimeEqualsTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class DateTimeToLocalizedStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
use DateTimeEqualsTrait;
protected $dateTime;
protected $dateTimeWithoutSeconds;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -39,7 +36,7 @@ private function doSetUp()
$this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dateTime = null;
$this->dateTimeWithoutSeconds = null;
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 3a2d9ab8bbcaf..335d8d90a987e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
@@ -12,20 +12,17 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer;
use Symfony\Component\Form\Tests\Extension\Core\DataTransformer\Traits\DateTimeEqualsTrait;
class DateTimeToRfc3339TransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
use DateTimeEqualsTrait;
protected $dateTime;
protected $dateTimeWithoutSeconds;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -33,7 +30,7 @@ private function doSetUp()
$this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dateTime = null;
$this->dateTimeWithoutSeconds = null;
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 4158045ddb4c2..939c61847f2a2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
class DateTimeToStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function dataProvider()
{
$data = [
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 cc184dc278694..4462108cf8d1a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
class DateTimeToTimestampTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testTransform()
{
$transformer = new DateTimeToTimestampTransformer('UTC', 'UTC');
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 6bc0cd9a54f74..20897c717000c 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeZoneToStringTransformer;
class DateTimeZoneToStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSingle()
{
$transformer = new DateTimeZoneToStringTransformer();
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 33e5609510982..d8ccf84b95f2e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
@@ -12,23 +12,20 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class IntegerToLocalizedStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $defaultLocale;
- private function doSetUp()
+ protected function setUp()
{
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
- private function doTearDown()
+ protected function tearDown()
{
\Locale::setDefault($this->defaultLocale);
}
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 14a4aee7c1ea5..ee27e2d72eeea 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
@@ -12,22 +12,19 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class MoneyToLocalizedStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $previousLocale;
- private function doSetUp()
+ protected function setUp()
{
$this->previousLocale = setlocale(LC_ALL, '0');
}
- private function doTearDown()
+ protected function tearDown()
{
setlocale(LC_ALL, $this->previousLocale);
}
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 8be0c99e13aeb..30b93c66feb52 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -12,23 +12,20 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class NumberToLocalizedStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $defaultLocale;
- private function doSetUp()
+ protected function setUp()
{
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
- private function doTearDown()
+ protected function tearDown()
{
\Locale::setDefault($this->defaultLocale);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
index 06ef6cc736341..ba21faa6862c5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
@@ -12,23 +12,20 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;
class PercentToLocalizedStringTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $defaultLocale;
- private function doSetUp()
+ protected function setUp()
{
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
- private function doTearDown()
+ protected function tearDown()
{
\Locale::setDefault($this->defaultLocale);
}
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 c02eb3573e692..67355058a2bd4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;
class ValueToDuplicatesTransformerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $transformer;
- private function doSetUp()
+ protected function setUp()
{
$this->transformer = new ValueToDuplicatesTransformer(['a', 'b', 'c']);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->transformer = null;
}
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 67545d6f2910f..a1021d7122fc5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
@@ -12,22 +12,19 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener;
use Symfony\Component\Form\FormEvent;
abstract class MergeCollectionListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $form;
- private function doSetUp()
+ protected function setUp()
{
$this->form = $this->getForm('axes');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->form = null;
}
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 4c3ff17b4c989..85c65d84e2a1e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
@@ -24,12 +23,10 @@
class ResizeFormListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $factory;
private $form;
- private function doSetUp()
+ protected function setUp()
{
$this->factory = (new FormFactoryBuilder())->getFormFactory();
$this->form = $this->getBuilder()
@@ -38,7 +35,7 @@ private function doSetUp()
->getForm();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->factory = null;
$this->form = null;
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 01e08d09ff11c..90a78898ce2cd 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Stepan Anchugov
*/
class BirthdayTypeTest extends DateTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
public function testSetInvalidYearsOption()
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 7e47a74ed40e8..53a69c1f34f80 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Bernhard Schussek
*/
class ButtonTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
public function testCreateButtonInstances()
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 5b47bc4212ba3..b81ecb87671ab 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
class ChoiceTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
private $choices = [
@@ -63,7 +60,7 @@ class ChoiceTypeTest extends BaseTypeTest
],
];
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -76,7 +73,7 @@ private function doSetUp()
];
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
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 85c6e99495492..583a7c4f8b1c0 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Tests\Fixtures\Author;
use Symfony\Component\Form\Tests\Fixtures\AuthorType;
class CollectionTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CollectionType';
public function testContainsNoChildByDefault()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
index 641f355de7c04..96fce79f21d33 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class CountryTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CountryType';
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
index afbae0d7bf79e..ae8c960cc1502 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class CurrencyTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CurrencyType';
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireIntl($this, false);
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 c1d5726122187..e3f3b729d3ec7 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
@@ -11,16 +11,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormError;
class DateTimeTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType';
- private function doSetUp()
+ protected function setUp()
{
\Locale::setDefault('en');
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 a1c1c356509f9..91e6ff5f8eb12 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -11,28 +11,25 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormError;
use Symfony\Component\Intl\Util\IntlTestHelper;
class DateTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateType';
private $defaultTimezone;
private $defaultLocale;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
$this->defaultTimezone = date_default_timezone_get();
$this->defaultLocale = \Locale::getDefault();
}
- private function doTearDown()
+ protected function tearDown()
{
date_default_timezone_set($this->defaultTimezone);
\Locale::setDefault($this->defaultLocale);
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 7b1b7d05f7739..6700d94c32924 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\Tests\Fixtures\Author;
@@ -52,8 +51,6 @@ public function setReferenceCopy($reference)
class FormTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FormType';
public function testCreateFormInstances()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
index 7c3868990bc09..c5c7dd9161b7e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
@@ -11,16 +11,13 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class IntegerTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\IntegerType';
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index 08f9c57bdf5c8..60614a97177f7 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class LanguageTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LanguageType';
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
index 6aead799ccae8..59cdc13547547 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
use Symfony\Component\Intl\Util\IntlTestHelper;
class LocaleTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LocaleType';
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireIntl($this, false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
index 7dacb03a09803..34576ec6306ee 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class MoneyTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\MoneyType';
private $defaultLocale;
- private function doSetUp()
+ protected function setUp()
{
// we test against different locales, so we need the full
// implementation
@@ -33,7 +30,7 @@ private function doSetUp()
$this->defaultLocale = \Locale::getDefault();
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
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 c66ec0cc10ff6..9cc2893c662dc 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
class NumberTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\NumberType';
private $defaultLocale;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -33,7 +30,7 @@ private function doSetUp()
\Locale::setDefault('de_DE');
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
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 3d49ae83f8cc2..8b4666d6fa5f0 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
@@ -11,13 +11,10 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Form;
class RepeatedTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\RepeatedType';
/**
@@ -25,7 +22,7 @@ class RepeatedTypeTest extends BaseTypeTest
*/
protected $form;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
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 f1cd2d7f436e8..e89dd8d20c9e1 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormError;
class TimeTypeTest extends BaseTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TimeType';
public function testSubmitDateTime()
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 4ea231dc3aa0a..97fae69a7f596 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
@@ -11,12 +11,9 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class UrlTypeTest extends TextTypeTest
{
- use ForwardCompatTestTrait;
-
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\UrlType';
public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
index ff7be6b1f96a1..5876b092b9da0 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\Csrf\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener;
@@ -23,14 +22,12 @@
class CsrfValidationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $dispatcher;
protected $factory;
protected $tokenManager;
protected $form;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = (new FormFactoryBuilder())->getFormFactory();
@@ -40,7 +37,7 @@ private function doSetUp()
->getForm();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dispatcher = null;
$this->factory = null;
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
index d36fd38aad723..665b700479735 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Csrf\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\FormBuilderInterface;
@@ -31,8 +30,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
class FormTypeCsrfExtensionTest extends TypeTestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -43,7 +40,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
*/
protected $translator;
- private function doSetUp()
+ protected function setUp()
{
$this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
$this->translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock();
@@ -51,7 +48,7 @@ private function doSetUp()
parent::setUp();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->tokenManager = null;
$this->translator = null;
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
index cb834867f3d6d..6bdde2d92d33d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension;
class DataCollectorExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var DataCollectorExtension
*/
@@ -29,7 +26,7 @@ class DataCollectorExtensionTest extends TestCase
*/
private $dataCollector;
- private function doSetUp()
+ protected function setUp()
{
$this->dataCollector = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface')->getMock();
$this->extension = new DataCollectorExtension($this->dataCollector);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
index 8e2e579d66cea..83d44167d5cf4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\DataCollector\FormDataCollector;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
@@ -20,8 +19,6 @@
class FormDataCollectorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -67,7 +64,7 @@ class FormDataCollectorTest extends TestCase
*/
private $childView;
- private function doSetUp()
+ protected function setUp()
{
$this->dataExtractor = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface')->getMock();
$this->dataCollector = new FormDataCollector($this->dataExtractor);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
index 5d8faf7bd0d29..860a96abcddfa 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\DataCollector\FormDataExtractor;
@@ -28,7 +27,6 @@
*/
class FormDataExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
use VarDumperTestTrait;
/**
@@ -46,7 +44,7 @@ class FormDataExtractorTest extends TestCase
*/
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->dataExtractor = new FormDataExtractor();
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
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 f5d0750b37a48..35f38fc53aa4e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector\Type;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension;
class DataCollectorTypeExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var DataCollectorTypeExtension
*/
@@ -29,7 +26,7 @@ class DataCollectorTypeExtensionTest extends TestCase
*/
private $dataCollector;
- private function doSetUp()
+ protected function setUp()
{
$this->dataCollector = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface')->getMock();
$this->extension = new DataCollectorTypeExtension($this->dataCollector);
diff --git a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
index 1d1b10959b2ca..86ece9e537173 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension;
@@ -21,8 +20,6 @@
class DependencyInjectionExtensionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetTypeExtensions()
{
$typeExtension1 = new DummyExtension('test');
diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
index 4fba518b9533f..4679c6c75299d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\HttpFoundation;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
use Symfony\Component\Form\Tests\AbstractRequestHandlerTest;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@@ -22,8 +21,6 @@
*/
class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest
{
- use ForwardCompatTestTrait;
-
public function testRequestShouldNotBeNull()
{
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
index a36961ed47e09..8a8af9ed6809a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\CallbackTransformer;
@@ -39,8 +38,6 @@
*/
class FormValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var EventDispatcherInterface
*/
@@ -51,7 +48,7 @@ class FormValidatorTest extends ConstraintValidatorTestCase
*/
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = (new FormFactoryBuilder())->getFormFactory();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
index b1848ac9a4eaa..76bc07b2ee981 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
@@ -33,8 +32,6 @@
class ValidationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var EventDispatcherInterface
*/
@@ -61,7 +58,7 @@ class ValidationListenerTest extends TestCase
private $params;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$this->factory = (new FormFactoryBuilder())->getFormFactory();
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 6486b2f2f2fe4..81baf3dc8f53a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Test\FormInterface;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\Validator\Constraints\GroupSequence;
@@ -21,8 +20,6 @@
*/
abstract class BaseValidatorExtensionTest extends TypeTestCase
{
- use ForwardCompatTestTrait;
-
public function testValidationGroupNullByDefault()
{
$form = $this->createForm();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
index 3f657c3643fc2..878bbfad21bc5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\ValueGuess;
@@ -33,8 +32,6 @@
*/
class ValidatorTypeGuesserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const TEST_CLASS = 'Symfony\Component\Form\Tests\Extension\Validator\ValidatorTypeGuesserTest_TestClass';
const TEST_PROPERTY = 'property';
@@ -54,7 +51,7 @@ class ValidatorTypeGuesserTest extends TestCase
*/
private $metadataFactory;
- private function doSetUp()
+ protected function setUp()
{
$this->metadata = new ClassMetadata(self::TEST_CLASS);
$this->metadataFactory = new FakeMetadataFactory();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
index 7f7e9cd527637..2fa3e928926ee 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\CallbackTransformer;
@@ -32,8 +31,6 @@
*/
class ViolationMapperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const LEVEL_0 = 0;
const LEVEL_1 = 1;
const LEVEL_1B = 2;
@@ -64,7 +61,7 @@ class ViolationMapperTest extends TestCase
*/
private $params;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$this->mapper = new ViolationMapper();
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 889cc6bd8e7be..02e7523c29694 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath;
/**
@@ -20,8 +19,6 @@
*/
class ViolationPathTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function providePaths()
{
return [
diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
index 36b2777e4196a..79d7ec1c03e9c 100644
--- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
@@ -12,27 +12,24 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\SubmitButtonBuilder;
class FormBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $dispatcher;
private $factory;
private $builder;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->builder = new FormBuilder('name', null, $this->dispatcher, $this->factory);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dispatcher = null;
$this->factory = null;
diff --git a/src/Symfony/Component/Form/Tests/FormConfigTest.php b/src/Symfony/Component/Form/Tests/FormConfigTest.php
index db6c056f4a222..25ad79167c937 100644
--- a/src/Symfony/Component/Form/Tests/FormConfigTest.php
+++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormConfigBuilder;
/**
@@ -20,8 +19,6 @@
*/
class FormConfigTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function getHtml4Ids()
{
return [
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
index 12d5d3a6715b1..3e66ce8c38be6 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Form\Tests\Fixtures\FooType;
class FormFactoryBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $registry;
private $guesser;
private $type;
- private function doSetUp()
+ protected function setUp()
{
$factory = new \ReflectionClass('Symfony\Component\Form\FormFactory');
$this->registry = $factory->getProperty('registry');
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
index 9250ee4cf2aa2..a1cba0d2dec16 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\Form\Guess\Guess;
@@ -24,8 +23,6 @@
*/
class FormFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -51,7 +48,7 @@ class FormFactoryTest extends TestCase
*/
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->guesser1 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
$this->guesser2 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
index 21096b746d2f2..cdc1ab7799811 100644
--- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\Form\ResolvedFormType;
@@ -32,8 +31,6 @@
*/
class FormRegistryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var FormRegistry
*/
@@ -64,7 +61,7 @@ class FormRegistryTest extends TestCase
*/
private $extension2;
- private function doSetUp()
+ protected function setUp()
{
$this->resolvedTypeFactory = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeFactory')->getMock();
$this->guesser1 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/Guess/GuessTest.php b/src/Symfony/Component/Form/Tests/Guess/GuessTest.php
index 304eba3fa693c..cc469f1b86a1f 100644
--- a/src/Symfony/Component/Form/Tests/Guess/GuessTest.php
+++ b/src/Symfony/Component/Form/Tests/Guess/GuessTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Guess;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Guess\Guess;
class TestGuess extends Guess
@@ -21,8 +20,6 @@ class TestGuess extends Guess
class GuessTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetBestGuessReturnsGuessWithHighestConfidence()
{
$guess1 = new TestGuess(Guess::MEDIUM_CONFIDENCE);
diff --git a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
index 12230a803dac6..66f7a21f4a7cb 100644
--- a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\NativeRequestHandler;
/**
@@ -19,16 +18,14 @@
*/
class NativeRequestHandlerTest extends AbstractRequestHandlerTest
{
- use ForwardCompatTestTrait;
-
private static $serverBackup;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$serverBackup = $_SERVER;
}
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -41,7 +38,7 @@ private function doSetUp()
];
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
index b424f2fc5523e..ba078ad1fd119 100644
--- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigInterface;
use Symfony\Component\Form\FormTypeExtensionInterface;
@@ -25,8 +24,6 @@
*/
class ResolvedFormTypeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -72,7 +69,7 @@ class ResolvedFormTypeTest extends TestCase
*/
private $resolvedType;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
index d8877ec4b633c..c79ea103f29a1 100644
--- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php
+++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Form;
@@ -55,8 +54,6 @@ public function getIterator()
class SimpleFormTest extends AbstractFormTest
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideFormNames
*/
diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
index 649cb05adaeee..9d6f7ddf06b7d 100644
--- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
+++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests\Util;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Form\Util\OrderedHashMap;
/**
@@ -20,8 +19,6 @@
*/
class OrderedHashMapTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGet()
{
$map = new OrderedHashMap();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
index 9e27c7313507f..0bc150e8d2360 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\HttpFoundation\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\Stream;
use Symfony\Component\HttpFoundation\Request;
@@ -20,8 +19,6 @@
class BinaryFileResponseTest extends ResponseTestCase
{
- use ForwardCompatTestTrait;
-
public function testConstruction()
{
$file = __DIR__.'/../README.md';
@@ -357,7 +354,7 @@ protected function provideResponse()
return new BinaryFileResponse(__DIR__.'/../README.md', 200, ['Content-Type' => 'application/octet-stream']);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
$path = __DIR__.'/../Fixtures/to_delete';
if (file_exists($path)) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
index 2d69d9ace16c3..e382182b4d604 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Cookie;
/**
@@ -25,8 +24,6 @@
*/
class CookieTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function invalidNames()
{
return [
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php b/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
index e750f39e680f3..8a389329e47ce 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\HttpFoundation\ExpressionRequestMatcher;
use Symfony\Component\HttpFoundation\Request;
class ExpressionRequestMatcherTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testWhenNoExpressionIsSet()
{
$this->expectException('LogicException');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
index 1f2582145613e..b463aadf8c6d9 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\HttpFoundation\Tests\File;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
class FileTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $file;
public function testGetMimeTypeUsesMimeTypeGuessers()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
index 299fc7a24be3f..3960988a6a654 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\File\MimeType;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
@@ -21,8 +20,6 @@
*/
class MimeTypeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $path;
public function testGuessImageWithoutExtension()
@@ -82,7 +79,7 @@ public function testGuessWithNonReadablePath()
}
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
$path = __DIR__.'/../Fixtures/to_delete';
if (file_exists($path)) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
index 9b48da7a22d20..629211052c274 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\HttpFoundation\Tests\File;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class UploadedFileTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
if (!ini_get('file_uploads')) {
$this->markTestSkipped('file_uploads is disabled in php.ini');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
index 289c12bd3ef56..a3882bc865159 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\FileBag;
@@ -24,8 +23,6 @@
*/
class FileBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testFileMustBeAnArrayOrUploadedFile()
{
$this->expectException('InvalidArgumentException');
@@ -160,12 +157,12 @@ protected function createTempFile()
return tempnam(sys_get_temp_dir().'/form_test', 'FormTest');
}
- private function doSetUp()
+ protected function setUp()
{
mkdir(sys_get_temp_dir().'/form_test', 0777, true);
}
- private function doTearDown()
+ protected function tearDown()
{
foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) {
unlink($file);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
index 3eff56840969b..a5876f9e3a7c2 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\HeaderBag;
class HeaderBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$bag = new HeaderBag(['foo' => 'bar']);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
index 338da1d25cad9..d3b262e048526 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\IpUtils;
class IpUtilsTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getIpv4Data
*/
diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
index 2e2645dab6ded..fd045fb9c36f5 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\JsonResponse;
class JsonResponseTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
index 1e4b7a6ca629d..92f4876da4ff1 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\RedirectResponse;
class RedirectResponseTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGenerateMetaRedirect()
{
$response = new RedirectResponse('foo.bar');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index dad3f0bf2d897..aaefc03599842 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -20,9 +19,7 @@
class RequestTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doTearDown()
+ protected function tearDown()
{
Request::setTrustedProxies([], -1);
Request::setTrustedHosts([]);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
index e264710d16bd4..3d3e696c75c3b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @requires PHP 7.0
*/
class ResponseFunctionalTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $server;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
$spec = [
1 => ['file', '/dev/null', 'w'],
@@ -35,7 +32,7 @@ private static function doSetUpBeforeClass()
sleep(1);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
if (self::$server) {
proc_terminate(self::$server);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
index 17be3cb604e3e..d85f6e112fd12 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
@@ -21,8 +20,6 @@
*/
class ResponseHeaderBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAllPreserveCase()
{
$headers = [
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
index 7515a7a9e4dea..776f85cd0fe5c 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\HttpFoundation\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -20,8 +19,6 @@
*/
class ResponseTest extends ResponseTestCase
{
- use ForwardCompatTestTrait;
-
public function testCreate()
{
$response = Response::create('foo', 301, ['Foo' => 'bar']);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
index aef66da1d2651..3f2f7b3c8f341 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
/**
@@ -22,8 +21,6 @@
*/
class AttributeBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $array = [];
/**
@@ -31,7 +28,7 @@ class AttributeBagTest extends TestCase
*/
private $bag;
- private function doSetUp()
+ protected function setUp()
{
$this->array = [
'hello' => 'world',
@@ -52,7 +49,7 @@ private function doSetUp()
$this->bag->initialize($this->array);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->bag = null;
$this->array = [];
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
index a1f6bf5eb4b02..6b4bb17d696f2 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag;
/**
@@ -22,8 +21,6 @@
*/
class NamespacedAttributeBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $array = [];
/**
@@ -31,7 +28,7 @@ class NamespacedAttributeBagTest extends TestCase
*/
private $bag;
- private function doSetUp()
+ protected function setUp()
{
$this->array = [
'hello' => 'world',
@@ -52,7 +49,7 @@ private function doSetUp()
$this->bag->initialize($this->array);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->bag = null;
$this->array = [];
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
index 65b2058146a04..b4e2c3a5ad30a 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag;
/**
@@ -22,8 +21,6 @@
*/
class AutoExpireFlashBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag
*/
@@ -31,7 +28,7 @@ class AutoExpireFlashBagTest extends TestCase
protected $array = [];
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
$this->bag = new FlashBag();
@@ -39,7 +36,7 @@ private function doSetUp()
$this->bag->initialize($this->array);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->bag = null;
parent::tearDown();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php
index 427af6d6775bd..6d8619e078a12 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
/**
@@ -22,8 +21,6 @@
*/
class FlashBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface
*/
@@ -31,7 +28,7 @@ class FlashBagTest extends TestCase
protected $array = [];
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
$this->bag = new FlashBag();
@@ -39,7 +36,7 @@ private function doSetUp()
$this->bag->initialize($this->array);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->bag = null;
parent::tearDown();
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
index 51516e2f23c8a..acb129984edd1 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -28,8 +27,6 @@
*/
class SessionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface
*/
@@ -40,13 +37,13 @@ class SessionTest extends TestCase
*/
protected $session;
- private function doSetUp()
+ protected function setUp()
{
$this->storage = new MockArraySessionStorage();
$this->session = new Session($this->storage, new AttributeBag(), new FlashBag());
}
- private function doTearDown()
+ protected function tearDown()
{
$this->storage = null;
$this->session = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
index d83182be7ad5e..98bc67bcabb40 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @requires PHP 7.0
*/
class AbstractSessionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $server;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
$spec = [
1 => ['file', '/dev/null', 'w'],
@@ -35,7 +32,7 @@ private static function doSetUpBeforeClass()
sleep(1);
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
if (self::$server) {
proc_terminate(self::$server);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
index d2526868d578e..d7a324fc205bc 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler;
/**
@@ -22,8 +21,6 @@
*/
class MemcacheSessionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const PREFIX = 'prefix_';
const TTL = 1000;
@@ -34,7 +31,7 @@ class MemcacheSessionHandlerTest extends TestCase
protected $memcache;
- private function doSetUp()
+ protected function setUp()
{
if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
@@ -48,7 +45,7 @@ private function doSetUp()
);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->memcache = null;
$this->storage = null;
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 86ac574d2f9ca..c3deb7aed8fb5 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler;
/**
@@ -21,8 +20,6 @@
*/
class MemcachedSessionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const PREFIX = 'prefix_';
const TTL = 1000;
@@ -33,7 +30,7 @@ class MemcachedSessionHandlerTest extends TestCase
protected $memcached;
- private function doSetUp()
+ protected function setUp()
{
if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
@@ -52,7 +49,7 @@ private function doSetUp()
);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->memcached = null;
$this->storage = null;
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 8fd72a91f5b51..7bc84f8767f7b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;
/**
@@ -22,8 +21,6 @@
*/
class MongoDbSessionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -31,7 +28,7 @@ class MongoDbSessionHandlerTest extends TestCase
private $storage;
public $options;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
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 303ad302645a1..348714a2602d5 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
@@ -26,8 +25,6 @@
*/
class NativeFileSessionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstruct()
{
$storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler(sys_get_temp_dir()));
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 0571306ab6dc3..ff513b7efae0d 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
/**
@@ -21,11 +20,9 @@
*/
class PdoSessionHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $dbFile;
- private function doTearDown()
+ protected function tearDown()
{
// make sure the temporary database file is deleted when it has been created (even when a test fails)
if ($this->dbFile) {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php
index 02cea329251a6..2c4758b9137c0 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
/**
@@ -22,8 +21,6 @@
*/
class MetadataBagTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var MetadataBag
*/
@@ -31,7 +28,7 @@ class MetadataBagTest extends TestCase
protected $array = [];
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
$this->bag = new MetadataBag();
@@ -39,7 +36,7 @@ private function doSetUp()
$this->bag->initialize($this->array);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->array = [];
$this->bag = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
index 1285dbf1ad779..7e0d303b98d08 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
@@ -24,8 +23,6 @@
*/
class MockArraySessionStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var MockArraySessionStorage
*/
@@ -43,7 +40,7 @@ class MockArraySessionStorageTest extends TestCase
private $data;
- private function doSetUp()
+ protected function setUp()
{
$this->attributes = new AttributeBag();
$this->flashes = new FlashBag();
@@ -59,7 +56,7 @@ private function doSetUp()
$this->storage->setSessionData($this->data);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->data = null;
$this->flashes = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
index 9a5ef1ca85803..b316c83e66a5b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;
@@ -24,8 +23,6 @@
*/
class MockFileSessionStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var string
*/
@@ -36,13 +33,13 @@ class MockFileSessionStorageTest extends TestCase
*/
protected $storage;
- private function doSetUp()
+ protected function setUp()
{
$this->sessionDir = sys_get_temp_dir().'/sf2test';
$this->storage = $this->getStorage();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->sessionDir = null;
$this->storage = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 886a5f9c9de37..fa170d17d3b32 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
@@ -32,11 +31,9 @@
*/
class NativeSessionStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $savePath;
- private function doSetUp()
+ protected function setUp()
{
$this->iniSet('session.save_handler', 'files');
$this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
@@ -45,7 +42,7 @@ private function doSetUp()
}
}
- private function doTearDown()
+ protected function tearDown()
{
session_write_close();
array_map('unlink', glob($this->savePath.'/*'));
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
index c8a53f169e19f..752be618bc1ee 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
@@ -28,11 +27,9 @@
*/
class PhpBridgeSessionStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $savePath;
- private function doSetUp()
+ protected function setUp()
{
$this->iniSet('session.save_handler', 'files');
$this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
@@ -41,7 +38,7 @@ private function doSetUp()
}
}
- private function doTearDown()
+ protected function tearDown()
{
session_write_close();
array_map('unlink', glob($this->savePath.'/*'));
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 dcd30036457f8..ae40f2c29b0cd 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
@@ -23,19 +22,17 @@
*/
class AbstractProxyTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var AbstractProxy
*/
protected $proxy;
- private function doSetUp()
+ protected function setUp()
{
$this->proxy = $this->getMockForAbstractClass(AbstractProxy::class);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->proxy = null;
}
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 d6459e10d6f94..ec9029c7dac2e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
/**
@@ -25,8 +24,6 @@
*/
class SessionHandlerProxyTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var \PHPUnit\Framework\MockObject\Matcher
*/
@@ -37,13 +34,13 @@ class SessionHandlerProxyTest extends TestCase
*/
private $proxy;
- private function doSetUp()
+ protected function setUp()
{
$this->mock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
$this->proxy = new SessionHandlerProxy($this->mock);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->mock = null;
$this->proxy = null;
diff --git a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
index 96ab63d496bce..a084e917dcc0e 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
class StreamedResponseTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$response = new StreamedResponse(function () { echo 'foo'; }, 404, ['Content-Type' => 'text/plain']);
diff --git a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
index 73e95473742f6..a9ad235c3ae34 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Bundle;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
@@ -22,8 +21,6 @@
class BundleTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetContainerExtension()
{
$bundle = new ExtensionPresentBundle();
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
index b4852cd936f1e..a7093dfc9df90 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\HttpKernel\Tests\CacheClearer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer;
class ChainCacheClearerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $cacheDir;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$cacheDir = tempnam(sys_get_temp_dir(), 'sf2_cache_clearer_dir');
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$cacheDir);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
index 1f68e2c7f3ff0..2fbce41d1c08f 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/Psr6CacheClearerTest.php
@@ -13,13 +13,10 @@
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemPoolInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
class Psr6CacheClearerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testClearPoolsInjectedInConstructor()
{
$pool = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
index 3f40f70bc66c5..41fe28507c8f9 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\HttpKernel\Tests\CacheWarmer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
class CacheWarmerAggregateTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $cacheDir;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$cacheDir = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir');
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$cacheDir);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
index 8b11d90dfa7f5..400e484574066 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\HttpKernel\Tests\CacheWarmer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer;
class CacheWarmerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $cacheFile;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$cacheFile = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir');
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
@unlink(self::$cacheFile);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php b/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php
index cb9d67a329f84..a1bf52957219b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Config;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
/**
@@ -20,13 +19,11 @@
*/
class EnvParametersResourceTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $prefix = '__DUMMY_';
protected $initialEnv;
protected $resource;
- private function doSetUp()
+ protected function setUp()
{
$this->initialEnv = [
$this->prefix.'1' => 'foo',
@@ -40,7 +37,7 @@ private function doSetUp()
$this->resource = new EnvParametersResource($this->prefix);
}
- private function doTearDown()
+ protected function tearDown()
{
foreach ($_SERVER as $key => $value) {
if (0 === strpos($key, $this->prefix)) {
diff --git a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
index c1c0b58f9edea..72b38c672ada9 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\HttpKernel\Tests\Config;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Config\FileLocator;
class FileLocatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLocate()
{
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
index be3670f5f4971..a964aaeb5828b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Controller;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
@@ -28,12 +27,10 @@
class ArgumentResolverTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var ArgumentResolver */
private static $resolver;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
$factory = new ArgumentMetadataFactory();
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
index f10c806534b74..1f8ddb83143f4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
@@ -13,7 +13,6 @@
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpFoundation\Request;
@@ -21,8 +20,6 @@
class ContainerControllerResolverTest extends ControllerResolverTest
{
- use ForwardCompatTestTrait;
-
public function testGetControllerService()
{
$container = $this->createMockContainer();
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
index 6e48bf09abc8a..e34427a32e5c4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController;
@@ -21,8 +20,6 @@
class ControllerResolverTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetControllerWithoutControllerParameter()
{
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
index 5b5433ac9c657..1c0c4648a0f2a 100644
--- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
@@ -13,7 +13,6 @@
use Fake\ImportedAndFake;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory;
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\BasicTypesController;
@@ -22,14 +21,12 @@
class ArgumentMetadataFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ArgumentMetadataFactory
*/
private $factory;
- private function doSetUp()
+ protected function setUp()
{
$this->factory = new ArgumentMetadataFactory();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
index fb6894bbf4f6e..5ce4b1f76be06 100644
--- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\HttpKernel\Tests\ControllerMetadata;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
class ArgumentMetadataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testWithBcLayerWithDefault()
{
$argument = new ArgumentMetadata('foo', 'string', false, true, 'default value');
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php
index a46cc388b43c8..63dd62ce70392 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector;
class MemoryDataCollectorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCollect()
{
$collector = new MemoryDataCollector();
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
index 3be1ef8eefcb1..5fe92d60e0491 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector\Util;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
/**
@@ -20,14 +19,12 @@
*/
class ValueExporterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ValueExporter
*/
private $valueExporter;
- private function doSetUp()
+ protected function setUp()
{
$this->valueExporter = new ValueExporter();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
index 9b49bd2d995ea..1d521368e1dfa 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -23,8 +22,6 @@
class FragmentRendererPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* Tests that content rendering not implementing FragmentRendererInterface
* triggers an exception.
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
index b70d259e6e4ad..32cfcb8604a84 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@@ -26,8 +25,6 @@
class RegisterControllerArgumentLocatorsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testInvalidClass()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
index 5d4ce0b8c26d2..d3c6869320910 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -15,8 +14,6 @@
class ResettableServicePassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCompilerPass()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php
index a1c07a765a2ce..86f1abdb05292 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php
@@ -12,16 +12,13 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService;
use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService;
class ServicesResetterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
ResettableService::$counter = 0;
ClearableService::$counter = 0;
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
index 3e93a24845248..4ab0a8fb1ea62 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
use Symfony\Component\HttpKernel\KernelEvents;
@@ -24,19 +23,17 @@
*/
class AddRequestFormatsListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var AddRequestFormatsListener
*/
private $listener;
- private function doSetUp()
+ protected function setUp()
{
$this->listener = new AddRequestFormatsListener(['csv' => ['text/csv', 'text/plain']]);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->listener = null;
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
index ee4a6a32f6e4c..0fb32eece8cea 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\FragmentListener;
@@ -21,8 +20,6 @@
class FragmentListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testOnlyTriggeredOnFragmentRoute()
{
$request = Request::create('http://example.com/foo?_path=foo%3Dbar%26_controller%3Dfoo');
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
index 0c0948d9a8c34..5f96f7f7c660b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\LocaleListener;
@@ -20,11 +19,9 @@
class LocaleListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $requestStack;
- private function doSetUp()
+ protected function setUp()
{
$this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
index aa5f5ec2ccb7c..aeab68f3e9155 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -23,13 +22,11 @@
class ResponseListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $dispatcher;
private $kernel;
- private function doSetUp()
+ protected function setUp()
{
$this->dispatcher = new EventDispatcher();
$listener = new ResponseListener('UTF-8');
@@ -38,7 +35,7 @@ private function doSetUp()
$this->kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->dispatcher = null;
$this->kernel = null;
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
index f1012f986d755..60325d594cf88 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -30,11 +29,9 @@
class RouterListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $requestStack;
- private function doSetUp()
+ protected function setUp()
{
$this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
index ea321ad5ca5a5..7187c7d1f6251 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -32,8 +31,6 @@
*/
class TestSessionListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var TestSessionListener
*/
@@ -44,7 +41,7 @@ class TestSessionListenerTest extends TestCase
*/
private $session;
- private function doSetUp()
+ protected function setUp()
{
$this->listener = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener');
$this->session = $this->getSession();
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
index 038209ed10771..77c2c1c694529 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -21,13 +20,11 @@
class TranslatorListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $listener;
private $translator;
private $requestStack;
- private function doSetUp()
+ protected function setUp()
{
$this->translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock();
$this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
index b508a260b51f7..7d63cb45f06e0 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -22,9 +21,7 @@
class ValidateRequestListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doTearDown()
+ protected function tearDown()
{
Request::setTrustedProxies([], -1);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
index e7fd92f562744..d8ba8aed8ab5d 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;
@@ -21,8 +20,6 @@
class EsiFragmentRendererTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRenderFallbackToInlineStrategyIfEsiNotSupported()
{
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true));
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
index ff76ad51008e8..6da4e73e3fa44 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
@@ -22,11 +21,9 @@
*/
class FragmentHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $requestStack;
- private function doSetUp()
+ protected function setUp()
{
$this->requestStack = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
->disableOriginalConstructor()
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
index 8b5cafd66f2cb..43248f8e9c10b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
@@ -20,8 +19,6 @@
class HIncludeFragmentRendererTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRenderExceptionWhenControllerAndNoSigner()
{
$this->expectException('LogicException');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
index ac32c981ca6f9..0dfe8425fe90e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -26,8 +25,6 @@
class InlineFragmentRendererTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRender()
{
$strategy = new InlineFragmentRenderer($this->getKernel($this->returnValue(new Response('foo'))));
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
index dc4e59da83b6e..151adb0e97cb4 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
class RoutableFragmentRendererTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getGenerateFragmentUriData
*/
diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
index fbf69610fbb48..df30e67727226 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer;
@@ -21,8 +20,6 @@
class SsiFragmentRendererTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRenderFallbackToInlineStrategyIfSsiNotSupported()
{
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy(true));
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
index 0cc85a0d743b4..5ced7e5b8bb92 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Esi;
class EsiTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHasSurrogateEsiCapability()
{
$esi = new Esi();
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
index 831d3f8f2e757..1eb461744726e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpCache\Esi;
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
@@ -21,8 +20,6 @@
class HttpCacheTestCase extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $kernel;
protected $cache;
protected $caches;
@@ -38,7 +35,7 @@ class HttpCacheTestCase extends TestCase
*/
protected $store;
- private function doSetUp()
+ protected function setUp()
{
$this->kernel = null;
@@ -56,7 +53,7 @@ private function doSetUp()
$this->clearDirectory(sys_get_temp_dir().'/http_cache');
}
- private function doTearDown()
+ protected function tearDown()
{
if ($this->cache) {
$this->cache->getStore()->cleanup();
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
index 612dfc429e8f7..f50005540bd31 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Ssi;
class SsiTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHasSurrogateSsiCapability()
{
$ssi = new Ssi();
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
index a4c03abd62896..fc47ff2c88c56 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Store;
class StoreTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $request;
protected $response;
@@ -29,7 +26,7 @@ class StoreTest extends TestCase
*/
protected $store;
- private function doSetUp()
+ protected function setUp()
{
$this->request = Request::create('/');
$this->response = new Response('hello world', 200, []);
@@ -39,7 +36,7 @@ private function doSetUp()
$this->store = new Store(sys_get_temp_dir().'/http_cache');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->store = null;
$this->request = null;
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php
index 316b269f189e8..67b637bfe3d05 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\SubRequestHandler;
@@ -20,16 +19,14 @@
class SubRequestHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $globalState;
- private function doSetUp()
+ protected function setUp()
{
self::$globalState = $this->getGlobalState();
}
- private function doTearDown()
+ protected function tearDown()
{
Request::setTrustedProxies(self::$globalState[0], self::$globalState[1]);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
index 242dd8158dd8c..af81f021ede0c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -31,8 +30,6 @@
class HttpKernelTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
{
$this->expectException('RuntimeException');
diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
index 50c0c091b690d..a5a1919d54cc1 100644
--- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -32,9 +31,7 @@
class KernelTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
$fs = new Filesystem();
$fs->remove(__DIR__.'/Fixtures/cache');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
index dad38b8ae2724..7439ae1376deb 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
@@ -14,7 +14,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Log\Logger;
/**
@@ -23,8 +22,6 @@
*/
class LoggerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var LoggerInterface
*/
@@ -35,13 +32,13 @@ class LoggerTest extends TestCase
*/
private $tmpFile;
- private function doSetUp()
+ protected function setUp()
{
$this->tmpFile = tempnam(sys_get_temp_dir(), 'log');
$this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile);
}
- private function doTearDown()
+ protected function tearDown()
{
if (!@unlink($this->tmpFile)) {
file_put_contents($this->tmpFile, '');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
index 5303cb246c4da..1cc05e41ec854 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\HttpKernel\Tests\Profiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage;
use Symfony\Component\HttpKernel\Profiler\Profile;
class FileProfilerStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $tmpDir;
private $storage;
- private function doSetUp()
+ protected function setUp()
{
$this->tmpDir = sys_get_temp_dir().'/sf2_profiler_file_storage';
if (is_dir($this->tmpDir)) {
@@ -33,7 +30,7 @@ private function doSetUp()
$this->storage->purge();
}
- private function doTearDown()
+ protected function tearDown()
{
self::cleanDir();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php
index 8c1e51d92d970..8f12e013a4533 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Tests\Profiler;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
@@ -22,8 +21,6 @@
class ProfilerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $tmp;
private $storage;
@@ -85,7 +82,7 @@ public function testFindWorksWithStatusCode()
$this->assertCount(0, $profiler->find(null, null, null, null, null, null, '204'));
}
- private function doSetUp()
+ protected function setUp()
{
$this->tmp = tempnam(sys_get_temp_dir(), 'sf2_profiler');
if (file_exists($this->tmp)) {
@@ -96,7 +93,7 @@ private function doSetUp()
$this->storage->purge();
}
- private function doTearDown()
+ protected function tearDown()
{
if (null !== $this->storage) {
$this->storage->purge();
diff --git a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
index b0efe8ed32223..7f3f7b64b01d4 100644
--- a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
+++ b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Intl\Tests\Collator;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Collator\Collator;
use Symfony\Component\Intl\Globals\IntlGlobals;
class CollatorTest extends AbstractCollatorTest
{
- use ForwardCompatTestTrait;
-
public function testConstructorWithUnsupportedLocale()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
diff --git a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
index 662fad7645752..378463cac854e 100644
--- a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
+++ b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Collator\Verification;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\Collator\AbstractCollatorTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -23,9 +22,7 @@
*/
class CollatorTest extends AbstractCollatorTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireFullIntl($this, false);
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 f20da714b5dae..883b7ec6e3229 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Exception\ResourceBundleNotFoundException;
@@ -21,8 +20,6 @@
*/
class BundleEntryReaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const RES_DIR = '/res/dir';
/**
@@ -64,7 +61,7 @@ class BundleEntryReaderTest extends TestCase
'Foo' => 'Bar',
];
- private function doSetUp()
+ protected function setUp()
{
$this->readerImpl = $this->getMockBuilder('Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface')->getMock();
$this->reader = new BundleEntryReader($this->readerImpl);
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 08f2334d637d7..d25c27751bd3a 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader;
/**
@@ -21,14 +20,12 @@
*/
class IntlBundleReaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var IntlBundleReader
*/
private $reader;
- private function doSetUp()
+ protected function setUp()
{
$this->reader = new IntlBundleReader();
}
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 73697f0565f54..0b701cb92e0dc 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\JsonBundleReader;
/**
@@ -20,14 +19,12 @@
*/
class JsonBundleReaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var JsonBundleReader
*/
private $reader;
- private function doSetUp()
+ protected function setUp()
{
$this->reader = new JsonBundleReader();
}
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 300f860aa15a1..a2b35594a13d9 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\PhpBundleReader;
/**
@@ -20,14 +19,12 @@
*/
class PhpBundleReaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PhpBundleReader
*/
private $reader;
- private function doSetUp()
+ protected function setUp()
{
$this->reader = new PhpBundleReader();
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
index 1b99e5004b2cb..f56bc84385d8f 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Writer\JsonBundleWriter;
@@ -21,8 +20,6 @@
*/
class JsonBundleWriterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var JsonBundleWriter
*/
@@ -35,7 +32,7 @@ class JsonBundleWriterTest extends TestCase
*/
private $filesystem;
- private function doSetUp()
+ protected function setUp()
{
$this->writer = new JsonBundleWriter();
$this->directory = sys_get_temp_dir().'/JsonBundleWriterTest/'.mt_rand(1000, 9999);
@@ -44,7 +41,7 @@ private function doSetUp()
$this->filesystem->mkdir($this->directory);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php
index e2e12a7d710eb..8010f9574a027 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Writer\PhpBundleWriter;
@@ -21,8 +20,6 @@
*/
class PhpBundleWriterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PhpBundleWriter
*/
@@ -35,7 +32,7 @@ class PhpBundleWriterTest extends TestCase
*/
private $filesystem;
- private function doSetUp()
+ protected function setUp()
{
$this->writer = new PhpBundleWriter();
$this->directory = sys_get_temp_dir().'/PhpBundleWriterTest/'.mt_rand(1000, 9999);
@@ -44,7 +41,7 @@ private function doSetUp()
$this->filesystem->mkdir($this->directory);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php
index 369206db2b076..2c0e70e019acf 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Writer\TextBundleWriter;
@@ -23,8 +22,6 @@
*/
class TextBundleWriterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var TextBundleWriter
*/
@@ -37,7 +34,7 @@ class TextBundleWriterTest extends TestCase
*/
private $filesystem;
- private function doSetUp()
+ protected function setUp()
{
$this->writer = new TextBundleWriter();
$this->directory = sys_get_temp_dir().'/TextBundleWriterTest/'.mt_rand(1000, 9999);
@@ -46,7 +43,7 @@ private function doSetUp()
$this->filesystem->mkdir($this->directory);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
index a3ee95c8ff1bc..3b1f4957aa7ab 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\CurrencyDataProvider;
use Symfony\Component\Intl\Intl;
@@ -20,8 +19,6 @@
*/
abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
{
- use ForwardCompatTestTrait;
-
// The below arrays document the state of the ICU data bundled with this package.
protected static $currencies = [
@@ -593,7 +590,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php
index fb4d31ef3815a..562f8386d1c9e 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
use Symfony\Component\Intl\Locale;
@@ -22,8 +21,6 @@
*/
abstract class AbstractDataProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
// Include the locales statically so that the data providers are decoupled
// from the Intl class. Otherwise tests will fail if the intl extension is
// not loaded, because it is NOT possible to skip the execution of data
@@ -704,7 +701,7 @@ abstract class AbstractDataProviderTest extends TestCase
private static $rootLocales;
- private function doSetUp()
+ protected function setUp()
{
\Locale::setDefault('en');
Locale::setDefaultFallback('en');
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
index 2bbab217ab813..2c8ce876a8454 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\LanguageDataProvider;
use Symfony\Component\Intl\Intl;
@@ -20,8 +19,6 @@
*/
abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
{
- use ForwardCompatTestTrait;
-
// The below arrays document the state of the ICU data bundled with this package.
protected static $languages = [
@@ -835,7 +832,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
index 0f7e2924c54bc..88242a6f9bcb3 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\LocaleDataProvider;
use Symfony\Component\Intl\Intl;
@@ -20,14 +19,12 @@
*/
abstract class AbstractLocaleDataProviderTest extends AbstractDataProviderTest
{
- use ForwardCompatTestTrait;
-
/**
* @var LocaleDataProvider
*/
protected $dataProvider;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
index 170e7f3d19186..aeb922f9e3e5f 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\RegionDataProvider;
use Symfony\Component\Intl\Intl;
@@ -20,8 +19,6 @@
*/
abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
{
- use ForwardCompatTestTrait;
-
// The below arrays document the state of the ICU data bundled with this package.
protected static $territories = [
@@ -287,7 +284,7 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
index e1ff85b4f4374..8620fb2060fbc 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Data\Provider;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Provider\ScriptDataProvider;
use Symfony\Component\Intl\Intl;
@@ -21,8 +20,6 @@
*/
abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
{
- use ForwardCompatTestTrait;
-
// The below arrays document the state of the ICU data bundled with this package.
protected static $scripts = [
@@ -223,7 +220,7 @@ abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
*/
protected $dataProvider;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php
index b5841cef071f0..23f312b7bf16d 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Util;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Util\LocaleScanner;
@@ -21,8 +20,6 @@
*/
class LocaleScannerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $directory;
/**
@@ -35,7 +32,7 @@ class LocaleScannerTest extends TestCase
*/
private $scanner;
- private function doSetUp()
+ protected function setUp()
{
$this->directory = sys_get_temp_dir().'/LocaleScannerTest/'.mt_rand(1000, 9999);
$this->filesystem = new Filesystem();
@@ -59,7 +56,7 @@ private function doSetUp()
file_put_contents($this->directory.'/fr_alias.txt', 'fr_alias{"%%ALIAS"{"fr"}}');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->filesystem->remove($this->directory);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
index b990a94362545..0753adad97de7 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Data\Util;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Data\Util\RingBuffer;
/**
@@ -20,14 +19,12 @@
*/
class RingBufferTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var RingBuffer
*/
private $buffer;
- private function doSetUp()
+ protected function setUp()
{
$this->buffer = new RingBuffer(2);
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
index 3ac53b7a3cfd4..e472000974a6f 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\DateFormatter;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\Intl;
@@ -25,9 +24,7 @@
*/
abstract class AbstractIntlDateFormatterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
\Locale::setDefault('en');
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
index 26816dcdb8e6e..f6d02dcc0099b 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
@@ -11,14 +11,11 @@
namespace Symfony\Component\Intl\Tests\DateFormatter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
use Symfony\Component\Intl\Globals\IntlGlobals;
class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$formatter = new IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, 'y-M-d');
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
index a94e317be8af7..8d5912ca6c9e3 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\DateFormatter\Verification;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
use Symfony\Component\Intl\Tests\DateFormatter\AbstractIntlDateFormatterTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -24,9 +23,7 @@
*/
class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
index c6c2097349531..b5cd1c13c32ff 100644
--- a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
+++ b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Globals\Verification;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\Globals\AbstractIntlGlobalsTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -23,9 +22,7 @@
*/
class IntlGlobalsTest extends AbstractIntlGlobalsTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
index b3b50a14c5388..8d58293df6a05 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
@@ -11,12 +11,9 @@
namespace Symfony\Component\Intl\Tests\Locale;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class LocaleTest extends AbstractLocaleTest
{
- use ForwardCompatTestTrait;
-
public function testAcceptFromHttp()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
diff --git a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
index b09adb27a197e..13f2c4f5e285b 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Locale\Verification;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\Locale\AbstractLocaleTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -23,9 +22,7 @@
*/
class LocaleTest extends AbstractLocaleTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireFullIntl($this, false);
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index 34d4256f3d505..0d382341f5ab5 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -23,8 +22,6 @@
*/
abstract class AbstractNumberFormatterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider formatCurrencyWithDecimalStyleProvider
*/
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
index 8457364f38d15..ed596099554df 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
@@ -21,8 +20,6 @@
*/
class NumberFormatterTest extends AbstractNumberFormatterTest
{
- use ForwardCompatTestTrait;
-
public function testConstructorWithUnsupportedLocale()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
index 38dd258fa15e5..2e1e9e5bb60b4 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter\Verification;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Tests\NumberFormatter\AbstractNumberFormatterTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
@@ -21,9 +20,7 @@
*/
class NumberFormatterTest extends AbstractNumberFormatterTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
IntlTestHelper::requireFullIntl($this, '55.1');
diff --git a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
index 8c08b82fd58af..0932d6043380b 100644
--- a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
+++ b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Intl\Tests\Util;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Exception\RuntimeException;
use Symfony\Component\Intl\Util\GitRepository;
@@ -22,8 +21,6 @@
*/
class GitRepositoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $targetDir;
const REPO_URL = 'https://github.com/symfony/intl.git';
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php
index 173461357d9c5..f5c856f9d520a 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Ldap\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
use Symfony\Component\Ldap\Adapter\ExtLdap\Query;
@@ -24,8 +23,6 @@
*/
class AdapterTest extends LdapTestCase
{
- use ForwardCompatTestTrait;
-
public function testLdapEscape()
{
$ldap = new Adapter();
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
index 8c9b1575114e2..2c7d8f0569f08 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Ldap\Tests\Adapter\ExtLdap;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\ExtLdap\Connection;
use Symfony\Component\Ldap\Adapter\ExtLdap\EntryManager;
use Symfony\Component\Ldap\Entry;
class EntryManagerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetResources()
{
$this->expectException('Symfony\Component\Ldap\Exception\NotBoundException');
diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
index 089b83b40b9e7..9605932ee0353 100644
--- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
+++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Ldap\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
use Symfony\Component\Ldap\Entry;
@@ -23,12 +22,10 @@
*/
class LdapManagerTest extends LdapTestCase
{
- use ForwardCompatTestTrait;
-
/** @var Adapter */
private $adapter;
- private function doSetUp()
+ protected function setUp()
{
$this->adapter = new Adapter($this->getLdapConfig());
$this->adapter->getConnection()->bind('cn=admin,dc=symfony,dc=com', 'symfony');
diff --git a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
index 0fd34061d90e9..95373e92b14e7 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Ldap\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -23,14 +22,12 @@
*/
class LdapClientTest extends LdapTestCase
{
- use ForwardCompatTestTrait;
-
/** @var LdapClient */
private $client;
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $ldap;
- private function doSetUp()
+ protected function setUp()
{
$this->ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php
index ac8453fbd763f..1b893c28d955b 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Ldap\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\AdapterInterface;
use Symfony\Component\Ldap\Adapter\ConnectionInterface;
use Symfony\Component\Ldap\Exception\DriverNotFoundException;
@@ -20,15 +19,13 @@
class LdapTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $adapter;
/** @var Ldap */
private $ldap;
- private function doSetUp()
+ protected function setUp()
{
$this->adapter = $this->getMockBuilder(AdapterInterface::class)->getMock();
$this->ldap = new Ldap($this->adapter);
diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php
index 6b060bd088c3a..1d4a257bc068b 100644
--- a/src/Symfony/Component/Lock/Tests/LockTest.php
+++ b/src/Symfony/Component/Lock/Tests/LockTest.php
@@ -13,7 +13,6 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Lock;
@@ -24,8 +23,6 @@
*/
class LockTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAcquireNoBlocking()
{
$key = new Key(uniqid(__METHOD__, true));
diff --git a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php
index 1cc36eb5dc386..4b9c81bd8e8c2 100644
--- a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Store\RedisStore;
/**
@@ -19,7 +18,6 @@
*/
abstract class AbstractRedisStoreTest extends AbstractStoreTest
{
- use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;
/**
diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
index a9f6c3c3df514..c8645dcc9a47c 100644
--- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Store\CombinedStore;
@@ -25,7 +24,6 @@
*/
class CombinedStoreTest extends AbstractStoreTest
{
- use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;
/**
@@ -60,7 +58,7 @@ public function getStore()
/** @var CombinedStore */
private $store;
- private function doSetUp()
+ protected function setUp()
{
$this->strategy = $this->getMockBuilder(StrategyInterface::class)->getMock();
$this->store1 = $this->getMockBuilder(StoreInterface::class)->getMock();
diff --git a/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php
index 42f88390db891..769082ddf9332 100644
--- a/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Store\FlockStore;
@@ -20,7 +19,6 @@
*/
class FlockStoreTest extends AbstractStoreTest
{
- use ForwardCompatTestTrait;
use BlockingStoreTestTrait;
/**
diff --git a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
index 592d9c4f5d989..c474d9e0a8ee2 100644
--- a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Store\MemcachedStore;
/**
@@ -21,10 +20,9 @@
*/
class MemcachedStoreTest extends AbstractStoreTest
{
- use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
$memcached = new \Memcached();
$memcached->addServer(getenv('MEMCACHED_HOST'), 11211);
diff --git a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
index 1d5f50e179c17..ff0f01422dfa5 100644
--- a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
@@ -11,16 +11,13 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Jérémy Derussé
*/
class PredisStoreTest extends AbstractRedisStoreTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
$redis = new \Predis\Client('tcp://'.getenv('REDIS_HOST').':6379');
try {
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
index eae72f5fbaf6c..564d78be82d18 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Jérémy Derussé
@@ -20,9 +19,7 @@
*/
class RedisArrayStoreTest extends AbstractRedisStoreTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!class_exists('RedisArray')) {
self::markTestSkipped('The RedisArray class is required.');
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
index b495acfb775d7..32a197130bd21 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Jérémy Derussé
@@ -20,9 +19,7 @@
*/
class RedisClusterStoreTest extends AbstractRedisStoreTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
index e48734b43e043..893e42fbc8f9a 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
/**
* @author Jérémy Derussé
@@ -20,9 +19,7 @@
*/
class RedisStoreTest extends AbstractRedisStoreTest
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) {
$e = error_get_last();
diff --git a/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php b/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php
index da2a74e178dd6..8034cfe7cf900 100644
--- a/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php
+++ b/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Lock\Tests\Strategy;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Strategy\ConsensusStrategy;
/**
@@ -20,12 +19,10 @@
*/
class ConsensusStrategyTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var ConsensusStrategy */
private $strategy;
- private function doSetUp()
+ protected function setUp()
{
$this->strategy = new ConsensusStrategy();
}
diff --git a/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php b/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php
index 44d927d40ab17..a07b42ddf52fb 100644
--- a/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php
+++ b/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Lock\Tests\Strategy;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Strategy\UnanimousStrategy;
/**
@@ -20,12 +19,10 @@
*/
class UnanimousStrategyTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var UnanimousStrategy */
private $strategy;
- private function doSetUp()
+ protected function setUp()
{
$this->strategy = new UnanimousStrategy();
}
diff --git a/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php b/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
index 208fdba04d028..8d6e9f63f6370 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\OptionsResolver\Tests\Debug;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OptionsResolverIntrospectorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetDefault()
{
$resolver = new OptionsResolver();
diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
index c32a8b31e5a49..cbdaaf024abae 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
@@ -13,21 +13,18 @@
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OptionsResolverTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var OptionsResolver
*/
private $resolver;
- private function doSetUp()
+ protected function setUp()
{
$this->resolver = new OptionsResolver();
}
diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
index 39dde41f08518..a437f2bb6f771 100644
--- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
+++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\ExecutableFinder;
/**
@@ -20,11 +19,9 @@
*/
class ExecutableFinderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $path;
- private function doTearDown()
+ protected function tearDown()
{
if ($this->path) {
// Restore path if it was changed.
diff --git a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
index 2a2379694b091..1b09c0cac535b 100644
--- a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\ProcessBuilder;
/**
@@ -20,8 +19,6 @@
*/
class ProcessBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testInheritEnvironmentVars()
{
$proc = ProcessBuilder::create()
diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
index f9df9ff294a7f..18e35512498f9 100644
--- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\Exception\ProcessFailedException;
/**
@@ -20,8 +19,6 @@
*/
class ProcessFailedExceptionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* tests ProcessFailedException throws exception if the process was successful.
*/
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 4145924df4a32..520e7ec457315 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Process\Exception\LogicException;
use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Symfony\Component\Process\Exception\RuntimeException;
@@ -26,14 +25,12 @@
*/
class ProcessTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private static $phpBin;
private static $process;
private static $sigchild;
private static $notEnhancedSigchild = false;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
$phpBin = new PhpExecutableFinder();
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());
@@ -43,7 +40,7 @@ private static function doSetUpBeforeClass()
self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
}
- private function doTearDown()
+ protected function tearDown()
{
if (self::$process) {
self::$process->stop(0);
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
index 071f70d360bfd..3127d41cba368 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
@@ -12,20 +12,17 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessor;
abstract class PropertyAccessorArrayAccessTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PropertyAccessor
*/
protected $propertyAccessor;
- private function doSetUp()
+ protected function setUp()
{
$this->propertyAccessor = new PropertyAccessor();
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php
index 50660b8c46a85..63bd64225039a 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php
@@ -12,26 +12,23 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\PropertyAccessorBuilder;
class PropertyAccessorBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PropertyAccessorBuilder
*/
protected $builder;
- private function doSetUp()
+ protected function setUp()
{
$this->builder = new PropertyAccessorBuilder();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->builder = null;
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
index 97543cc91a20e..507ec97ed98c4 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
@@ -11,12 +11,9 @@
namespace Symfony\Component\PropertyAccess\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
class PropertyAccessorCollectionTest_Car
{
- use ForwardCompatTestTrait;
-
private $axes;
public function __construct($axes = null)
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
index 15e810b1b2d73..d7ee358e07a79 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
use Symfony\Component\PropertyAccess\PropertyAccessor;
@@ -29,14 +28,12 @@
class PropertyAccessorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PropertyAccessor
*/
private $propertyAccessor;
- private function doSetUp()
+ protected function setUp()
{
$this->propertyAccessor = new PropertyAccessor();
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
index e4ff364439543..ec518738499eb 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyAccess\PropertyPath;
use Symfony\Component\PropertyAccess\PropertyPathBuilder;
@@ -21,8 +20,6 @@
*/
class PropertyPathBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const PREFIX = 'old1[old2].old3[old4][old5].old6';
/**
@@ -30,7 +27,7 @@ class PropertyPathBuilderTest extends TestCase
*/
private $builder;
- private function doSetUp()
+ protected function setUp()
{
$this->builder = new PropertyPathBuilder(new PropertyPath(self::PREFIX));
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
index dbe63a258faf6..4fe450e3f24fb 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyAccess\PropertyPath;
class PropertyPathTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testToString()
{
$path = new PropertyPath('reference.traversable[index].property');
diff --git a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
index 2f9f596510cfc..f0897d71c7167 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\PropertyInfo\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
@@ -23,14 +22,12 @@
*/
class AbstractPropertyInfoExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PropertyInfoExtractor
*/
protected $propertyInfo;
- private function doSetUp()
+ protected function setUp()
{
$extractors = [new NullExtractor(), new DummyExtractor()];
$this->propertyInfo = new PropertyInfoExtractor($extractors, $extractors, $extractors, $extractors);
diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
index 4d7bb8d968e3a..f4f9e9dc77e29 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\PropertyInfo\Tests\PhpDocExtractor;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Type;
@@ -21,14 +20,12 @@
*/
class PhpDocExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PhpDocExtractor
*/
private $extractor;
- private function doSetUp()
+ protected function setUp()
{
$this->extractor = new PhpDocExtractor();
}
diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
index 715221dab4b21..0ed5390bb5882 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\PropertyInfo\Tests\Extractor;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\AdderRemoverDummy;
use Symfony\Component\PropertyInfo\Type;
@@ -22,14 +21,12 @@
*/
class ReflectionExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ReflectionExtractor
*/
private $extractor;
- private function doSetUp()
+ protected function setUp()
{
$this->extractor = new ReflectionExtractor();
}
diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php
index a8bce835c3b23..791398e3f2658 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\SerializerExtractor;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
@@ -23,14 +22,12 @@
*/
class SerializerExtractorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var SerializerExtractor
*/
private $extractor;
- private function doSetUp()
+ protected function setUp()
{
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$this->extractor = new SerializerExtractor($classMetadataFactory);
diff --git a/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php
index 359d06ccecbc7..d31a7bd51ddde 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\PropertyInfo\Tests;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyInfo\PropertyInfoCacheExtractor;
@@ -20,9 +19,7 @@
*/
class PropertyInfoCacheExtractorTest extends AbstractPropertyInfoExtractorTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
index ced72314504cf..30382bec8dbfd 100644
--- a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
+++ b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\PropertyInfo\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Type;
/**
@@ -20,8 +19,6 @@
*/
class TypeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstruct()
{
$type = new Type('object', true, 'ArrayObject', true, new Type('int'), new Type('string'));
diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
index 35b4ed6a66edf..08eed456aaa7a 100644
--- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Routing\Tests\Annotation;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Annotation\Route;
class RouteTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testInvalidRouteParameter()
{
$this->expectException('BadMethodCallException');
diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
index 5adafe2f2c664..d3ddb9f3b1838 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Routing\Tests\Generator\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
@@ -21,8 +20,6 @@
class PhpGeneratorDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var RouteCollection
*/
@@ -43,7 +40,7 @@ class PhpGeneratorDumperTest extends TestCase
*/
private $largeTestTmpFilepath;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -55,7 +52,7 @@ private function doSetUp()
@unlink($this->largeTestTmpFilepath);
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
index 802fbba39ec2f..de7c4f5ed964b 100644
--- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
+++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Routing\Tests\Generator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
@@ -21,8 +20,6 @@
class UrlGeneratorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAbsoluteUrlWithPort80()
{
$routes = $this->getRoutes('test', new Route('/testing'));
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
index 424d380054173..b13f23cf40615 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -11,17 +11,14 @@
namespace Symfony\Component\Routing\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Annotation\Route;
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
{
- use ForwardCompatTestTrait;
-
protected $loader;
private $reader;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
index e9e56043b28a6..df96a679e40f9 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
@@ -11,18 +11,15 @@
namespace Symfony\Component\Routing\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
{
- use ForwardCompatTestTrait;
-
protected $loader;
protected $reader;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
index ae43d9ba956ff..8af8e2e14ff2d 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
@@ -11,19 +11,16 @@
namespace Symfony\Component\Routing\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
{
- use ForwardCompatTestTrait;
-
protected $loader;
protected $reader;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php
index ce31fc3559631..2657751b38cda 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Routing\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
@@ -21,12 +20,10 @@
class DirectoryLoaderTest extends AbstractAnnotationLoaderTest
{
- use ForwardCompatTestTrait;
-
private $loader;
private $reader;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
index 9a00095661d75..64187744eb222 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Loader\ObjectRouteLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class ObjectRouteLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadCallsServiceAndReturnsCollection()
{
$loader = new ObjectRouteLoaderForTest();
diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
index b54d02053adcc..128bb54fb0315 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Loader\XmlFileLoader;
use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader;
class XmlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$loader = new XmlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
diff --git a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
index 7ca43a7582e94..2e3261a1ca676 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\YamlFileLoader;
class YamlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$loader = new YamlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php
index 10e9915480a8d..873b45a5a4eac 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Routing\Tests\Matcher;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
class DumpedUrlMatcherTest extends UrlMatcherTest
{
- use ForwardCompatTestTrait;
-
public function testSchemeRequirement()
{
$this->expectException('LogicException');
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index e7d4da255783e..7286010158a68 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -22,8 +21,6 @@
class PhpMatcherDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var string
*/
@@ -34,7 +31,7 @@ class PhpMatcherDumperTest extends TestCase
*/
private $dumpPath;
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -42,7 +39,7 @@ private function doSetUp()
$this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index 73662412c99bb..66b199ab06234 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Routing\Tests\Matcher;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class RedirectableUrlMatcherTest extends UrlMatcherTest
{
- use ForwardCompatTestTrait;
-
public function testMissingTrailingSlash()
{
$coll = new RouteCollection();
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
index d38994703081e..8a9731f98ae5c 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Routing\Tests\Matcher;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -22,8 +21,6 @@
class UrlMatcherTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testNoMethodSoAllowed()
{
$coll = new RouteCollection();
diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
index 3ce024751cb5a..f5042749e2ebb 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\YamlFileLoader;
@@ -22,8 +21,6 @@
class RouteCollectionBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testImport()
{
$resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
index 789dd438123cd..a460c6651cc65 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCompiler;
class RouteCompilerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideCompileData
*/
diff --git a/src/Symfony/Component/Routing/Tests/RouteTest.php b/src/Symfony/Component/Routing/Tests/RouteTest.php
index 73fc832fc86f1..53ae859df6110 100644
--- a/src/Symfony/Component/Routing/Tests/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Routing\Route;
class RouteTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$route = new Route('/{foo}', ['foo' => 'bar'], ['foo' => '\d+'], ['foo' => 'bar'], '{locale}.example.com');
diff --git a/src/Symfony/Component/Routing/Tests/RouterTest.php b/src/Symfony/Component/Routing/Tests/RouterTest.php
index 118cbabff3df9..fc5e633b0b920 100644
--- a/src/Symfony/Component/Routing/Tests/RouterTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouterTest.php
@@ -12,20 +12,17 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Router;
class RouterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $router = null;
private $loader = null;
- private function doSetUp()
+ protected function setUp()
{
$this->loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
$this->router = new Router($this->loader, 'routing.yml');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
index f155f1c4f38ac..edc1897914207 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Authentication;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
@@ -25,8 +24,6 @@
class AuthenticationProviderManagerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAuthenticateWithoutProviders()
{
$this->expectException('InvalidArgumentException');
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 613d28382d952..85ed848a79fdc 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider;
class AnonymousAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$provider = $this->getProvider('foo');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
index 576efb96eac33..d9f8a54a75453 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
class DaoAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
{
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationServiceException');
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 743b737d44ed6..18d4beb69be49 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -29,8 +28,6 @@
*/
class LdapBindAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testEmptyPasswordShouldThrowAnException()
{
$this->expectException('Symfony\Component\Security\Core\Exception\BadCredentialsException');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
index 7d37f93c7f315..485b68a4c1866 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
use Symfony\Component\Security\Core\Exception\LockedException;
class PreAuthenticatedAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$provider = $this->getProvider();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
index 77fba2281116e..418cd77df4fc1 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
use Symfony\Component\Security\Core\Exception\DisabledException;
use Symfony\Component\Security\Core\Role\Role;
class RememberMeAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$provider = $this->getProvider();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
index d0d5d26976885..5b2e9e4c0ddba 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider;
use Symfony\Component\Security\Core\Exception\DisabledException;
use Symfony\Component\Security\Core\Exception\LockedException;
@@ -20,8 +19,6 @@
class SimpleAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAuthenticateWhenPreChecksFails()
{
$this->expectException('Symfony\Component\Security\Core\Exception\DisabledException');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
index 5a00096dece74..ceea2e0c9d9c5 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
@@ -22,8 +21,6 @@
class UserAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSupports()
{
$provider = $this->getProvider();
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 62ace03633126..f5c7b98a28ad0 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\RememberMe;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider;
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
class InMemoryTokenProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCreateNewToken()
{
$provider = new InMemoryTokenProvider();
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 58035c519faa7..cd782b3ad412b 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Token;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Role\Role;
class RememberMeTokenTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$user = $this->getUser();
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 0b02858000364..420a97ace1fe1 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Token;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Role\Role;
class UsernamePasswordTokenTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$token = new UsernamePasswordToken('foo', 'bar', 'key');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
index f6566fa0e9b49..c4bff4d63bd7d 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Authorization;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
@@ -21,8 +20,6 @@
class AccessDecisionManagerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSetUnsupportedStrategy()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
index d666ce86848a4..1d4fa2a0ce109 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
@@ -12,20 +12,17 @@
namespace Symfony\Component\Security\Core\Tests\Authorization;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;
class AuthorizationCheckerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $authenticationManager;
private $accessDecisionManager;
private $authorizationChecker;
private $tokenStorage;
- private function doSetUp()
+ protected function setUp()
{
$this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
$this->accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
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 a6e5a6c08c917..50dc84e435a90 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\Security\Core\Tests\Authorization\Voter;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
class VoterTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $token;
- private function doSetUp()
+ protected function setUp()
{
$this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
index f15af4f547247..503a895eb32d3 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/Argon2iPasswordEncoderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder;
/**
@@ -20,11 +19,9 @@
*/
class Argon2iPasswordEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const PASSWORD = 'password';
- private function doSetUp()
+ protected function setUp()
{
if (!Argon2iPasswordEncoder::isSupported()) {
$this->markTestSkipped('Argon2i algorithm is not supported.');
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
index cd8394f101821..cc0cd9e8ebb22 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
/**
@@ -20,8 +19,6 @@
*/
class BCryptPasswordEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const PASSWORD = 'password';
const VALID_COST = '04';
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php
index cf517f6cee5ae..e03ec889c3783 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\BasePasswordEncoder;
class PasswordEncoder extends BasePasswordEncoder
@@ -28,8 +27,6 @@ public function isPasswordValid($encoded, $raw, $salt)
class BasePasswordEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testComparePassword()
{
$this->assertTrue($this->invokeComparePasswords('password', 'password'));
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
index 5fc489e426e07..0b2c36c72de4a 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
@@ -21,8 +20,6 @@
class EncoderFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetEncoderWithMessageDigestEncoder()
{
$factory = new EncoderFactory(['Symfony\Component\Security\Core\User\UserInterface' => [
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
index 50cd47bf0c8e6..d1061c4211c3b 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
class MessageDigestPasswordEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testIsPasswordValid()
{
$encoder = new MessageDigestPasswordEncoder('sha256', false, 1);
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
index 0795c4b5d68d1..37a1f2d3cf57b 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder;
class Pbkdf2PasswordEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testIsPasswordValid()
{
$encoder = new Pbkdf2PasswordEncoder('sha256', false, 1, 40);
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
index 1ef0e0c7788dd..3f6efccd49426 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Core\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
class PlaintextPasswordEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testIsPasswordValid()
{
$encoder = new PlaintextPasswordEncoder();
diff --git a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
index 6852273aef8f9..1592bcd2fe8e8 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\ChainUserProvider;
class ChainUserProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadUserByUsername()
{
$provider1 = $this->getProvider();
diff --git a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
index 6b78260b09be9..ce697e4ae933c 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Core\User\User;
class InMemoryUserProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructor()
{
$provider = $this->createProvider();
diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
index de31af718b3ab..cf1986b3e6fda 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -25,8 +24,6 @@
*/
class LdapUserProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadUserByUsernameFailsIfCantConnectToLdap()
{
$this->expectException('Symfony\Component\Security\Core\Exception\UsernameNotFoundException');
diff --git a/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
index cdff6e1f3e5ee..ea3ce07520e7a 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\User\UserChecker;
class UserCheckerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCheckPostAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
diff --git a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
index c7065eb6f17b7..577067b33dd79 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Core\Tests\User;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\User\User;
class UserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testConstructorException()
{
$this->expectException('InvalidArgumentException');
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 c10011ac24419..6b3e81d33748e 100644
--- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Core\Tests\Validator\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
@@ -24,8 +23,6 @@
*/
abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
const PASSWORD = 's3Cr3t';
const SALT = '^S4lt$';
@@ -49,7 +46,7 @@ protected function createValidator()
return new UserPasswordValidator($this->tokenStorage, $this->encoderFactory);
}
- private function doSetUp()
+ protected function setUp()
{
$user = $this->createUser();
$this->tokenStorage = $this->createTokenStorage($user);
diff --git a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
index 28998bbdee9d2..631c36a0db0ac 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Csrf\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Csrf\CsrfToken;
@@ -23,8 +22,6 @@
*/
class CsrfTokenManagerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getManagerGeneratorAndStorage
*/
@@ -213,12 +210,12 @@ private function getGeneratorAndStorage()
];
}
- private function doSetUp()
+ protected function setUp()
{
$_SERVER['HTTPS'] = 'on';
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php
index 039ccbfe6acc4..07f85c221432d 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Csrf\Tests\TokenGenerator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator;
/**
@@ -20,8 +19,6 @@
*/
class UriSafeTokenGeneratorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const ENTROPY = 1000;
/**
@@ -36,17 +33,17 @@ class UriSafeTokenGeneratorTest extends TestCase
*/
private $generator;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$bytes = base64_decode('aMf+Tct/RLn2WQ==');
}
- private function doSetUp()
+ protected function setUp()
{
$this->generator = new UriSafeTokenGenerator(self::ENTROPY);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->generator = null;
}
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
index 7574635dd45a1..05f30b45330f5 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Csrf\Tests\TokenStorage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage;
/**
@@ -23,8 +22,6 @@
*/
class NativeSessionTokenStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const SESSION_NAMESPACE = 'foobar';
/**
@@ -32,7 +29,7 @@ class NativeSessionTokenStorageTest extends TestCase
*/
private $storage;
- private function doSetUp()
+ protected function setUp()
{
$_SESSION = [];
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
index 4ad0e086405fe..915724c52ea3d 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Csrf\Tests\TokenStorage;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
@@ -22,8 +21,6 @@
*/
class SessionTokenStorageTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const SESSION_NAMESPACE = 'foobar';
/**
@@ -36,7 +33,7 @@ class SessionTokenStorageTest extends TestCase
*/
private $storage;
- private function doSetUp()
+ protected function setUp()
{
$this->session = new Session(new MockArraySessionStorage());
$this->storage = new SessionTokenStorage($this->session, self::SESSION_NAMESPACE);
diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
index 2a64e61286627..c3983287fc42b 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Guard\Tests\Authenticator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
@@ -24,8 +23,6 @@
*/
class FormLoginAuthenticatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $requestWithoutSession;
private $requestWithSession;
private $authenticator;
@@ -130,7 +127,7 @@ public function testStartWithSession()
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
- private function doSetUp()
+ protected function setUp()
{
$this->requestWithoutSession = new Request([], [], [], [], [], []);
$this->requestWithSession = new Request([], [], [], [], [], []);
diff --git a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
index 7344100ee02bb..6572696d48fca 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Guard\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -29,8 +28,6 @@
*/
class GuardAuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $authenticationManager;
private $guardAuthenticatorHandler;
private $event;
@@ -421,7 +418,7 @@ public function testReturnNullFromGetCredentialsTriggersForAbstractGuardAuthenti
$listener->handle($this->event);
}
- private function doSetUp()
+ protected function setUp()
{
$this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager')
->disableOriginalConstructor()
@@ -446,7 +443,7 @@ private function doSetUp()
$this->rememberMeServices = $this->getMockBuilder('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface')->getMock();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->authenticationManager = null;
$this->guardAuthenticatorHandler = null;
diff --git a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
index 4fc75933c70e4..3bf204ec7f5c0 100644
--- a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Guard\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@@ -23,8 +22,6 @@
class GuardAuthenticatorHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $tokenStorage;
private $dispatcher;
private $token;
@@ -159,7 +156,7 @@ public function testSessionStrategyIsNotCalledWhenStateless()
$handler->authenticateWithToken($this->token, $this->request, 'some_provider_key');
}
- private function doSetUp()
+ protected function setUp()
{
$this->tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
@@ -169,7 +166,7 @@ private function doSetUp()
$this->guardAuthenticator = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->tokenStorage = null;
$this->dispatcher = null;
diff --git a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
index fa77bf0a92a27..bc7c69b6b3d20 100644
--- a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Guard\Tests\Provider;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Guard\AuthenticatorInterface;
@@ -25,8 +24,6 @@
*/
class GuardAuthenticationProviderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $userProvider;
private $userChecker;
private $preAuthenticationToken;
@@ -230,7 +227,7 @@ public function testAuthenticateFailsOnNonOriginatingToken()
$provider->authenticate($token);
}
- private function doSetUp()
+ protected function setUp()
{
$this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
$this->userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
@@ -239,7 +236,7 @@ private function doSetUp()
->getMock();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->userProvider = null;
$this->userChecker = null;
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
index 348f5d2c93cdd..a71ad179a3551 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Authentication;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Security;
@@ -20,8 +19,6 @@
class DefaultAuthenticationFailureHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $httpKernel;
private $httpUtils;
private $logger;
@@ -29,7 +26,7 @@ class DefaultAuthenticationFailureHandlerTest extends TestCase
private $session;
private $exception;
- private function doSetUp()
+ protected function setUp()
{
$this->httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
$this->httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
index 4af479a5a5dd3..cd28c52d288e9 100644
--- a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@@ -22,8 +21,6 @@
class SimpleAuthenticationHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $successHandler;
private $failureHandler;
@@ -36,7 +33,7 @@ class SimpleAuthenticationHandlerTest extends TestCase
private $response;
- private function doSetUp()
+ protected function setUp()
{
$this->successHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface')->getMock();
$this->failureHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
index 8ed9fe541897c..c7f939e4c68e0 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Http\Firewall\AccessListener;
class AccessListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
{
$this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
index e5008d6638936..125d403a72147 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
@@ -22,8 +21,6 @@
class BasicAuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHandleWithValidUsernameAndPasswordServerParameters()
{
$request = new Request([], [], [], [], [], [
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
index 9c11fc558d693..25915f212a4c0 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -35,8 +34,6 @@
class ContextListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testItRequiresContextKey()
{
$this->expectException('InvalidArgumentException');
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php
index 229c9f2768157..185055efceb68 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Http\Firewall\DigestData;
/**
@@ -20,8 +19,6 @@
*/
class DigestDataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetResponse()
{
$digestAuth = new DigestData(
@@ -166,7 +163,7 @@ public function testIsNonceExpired()
$this->assertFalse($digestAuth->isNonceExpired());
}
- private function doSetUp()
+ protected function setUp()
{
class_exists('Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener', true);
}
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
index 9dd4ebb25009d..ad630c552eefb 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\Firewall\LogoutListener;
class LogoutListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testHandleUnmatchedPath()
{
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener();
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
index 8a1dbce9d8b38..4478a1a4d8b89 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Firewall\RememberMeListener;
@@ -20,8 +19,6 @@
class RememberMeListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage()
{
list($listener, $tokenStorage) = $this->getListener();
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
index 6328ddf52346c..02d1ba03ce441 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Firewall\RemoteUserAuthenticationListener;
class RemoteUserAuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetPreAuthenticatedData()
{
$serverVars = [
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
index 74b59615d6203..1584b66ecee44 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
@@ -21,8 +20,6 @@
class SimplePreAuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $authenticationManager;
private $dispatcher;
private $event;
@@ -96,7 +93,7 @@ public function testHandlecatchAuthenticationException()
$listener->handle($this->event);
}
- private function doSetUp()
+ protected function setUp()
{
$this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager')
->disableOriginalConstructor()
@@ -119,7 +116,7 @@ private function doSetUp()
$this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->authenticationManager = null;
$this->dispatcher = null;
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
index 48f36de2e0167..a67e8fb8cd1dd 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -26,8 +25,6 @@
class SwitchUserListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $tokenStorage;
private $userProvider;
@@ -40,7 +37,7 @@ class SwitchUserListenerTest extends TestCase
private $event;
- private function doSetUp()
+ protected function setUp()
{
$this->tokenStorage = new TokenStorage();
$this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
index 30feeb95b2e56..dc75a8efd75bd 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Tests\Http\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -27,8 +26,6 @@
class UsernamePasswordFormAuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getUsernameForLength
*/
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
index ad8d3cd9f7c44..58948ce53b04d 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Tests\Http\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -32,8 +31,6 @@
*/
class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var UsernamePasswordJsonAuthenticationListener
*/
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
index b82b616a637f7..9ada4b1b499d5 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Firewall\X509AuthenticationListener;
class X509AuthenticationListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider dataProviderGetPreAuthenticatedData
*/
diff --git a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
index 016a22655a40e..05d02b886e8ad 100644
--- a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@@ -22,8 +21,6 @@
class HttpUtilsTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCreateRedirectResponseWithPath()
{
$utils = new HttpUtils($this->getUrlGenerator());
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
index d51cc44833e8a..fe34eaa6e5da3 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Logout;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -22,13 +21,11 @@
class CsrfTokenClearingLogoutHandlerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $session;
private $csrfTokenStorage;
private $csrfTokenClearingLogoutHandler;
- private function doSetUp()
+ protected function setUp()
{
$this->session = new Session(new MockArraySessionStorage());
$this->csrfTokenStorage = new SessionTokenStorage($this->session, 'foo');
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
index 7665117e074b1..e64c734112d93 100644
--- a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\Logout;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
@@ -26,14 +25,12 @@
*/
class LogoutUrlGeneratorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var TokenStorage */
private $tokenStorage;
/** @var LogoutUrlGenerator */
private $generator;
- private function doSetUp()
+ protected function setUp()
{
$requestStack = $this->getMockBuilder(RequestStack::class)->getMock();
$request = $this->getMockBuilder(Request::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 0cf4654bcc6d2..75aa0c324bfd9 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\RememberMe;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
@@ -20,8 +19,6 @@
class AbstractRememberMeServicesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetRememberMeParameter()
{
$service = $this->getService(null, ['remember_me_parameter' => 'foo']);
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
index 3764afec426d3..599a7e81c303b 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Tests\RememberMe;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
@@ -25,9 +24,7 @@
class PersistentTokenBasedRememberMeServicesTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
try {
random_bytes(1);
diff --git a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
index 4ef0b80b06970..c4df17b53b049 100644
--- a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Security\Http\Tests\Session;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
class SessionAuthenticationStrategyTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSessionIsNotChanged()
{
$request = $this->getRequest();
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
index 203eb3c92b93b..3fad6d82f83c9 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Annotation;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Annotation\Groups;
/**
@@ -20,8 +19,6 @@
*/
class GroupsTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testEmptyGroupsParameter()
{
$this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
index 8cca874ecd2a5..2c421576d14b3 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Annotation;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/**
@@ -20,8 +19,6 @@
*/
class MaxDepthTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testNotSetMaxDepthParameter()
{
$this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
index d5e044504f584..65d7a65f5acdb 100644
--- a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
+++ b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
@@ -24,8 +23,6 @@
*/
class SerializerPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testThrowExceptionWhenNoNormalizers()
{
$this->expectException('RuntimeException');
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
index 659930c41e524..5bdbd282ef3a2 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\ChainDecoder;
class ChainDecoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const FORMAT_1 = 'format1';
const FORMAT_2 = 'format2';
const FORMAT_3 = 'format3';
@@ -27,7 +24,7 @@ class ChainDecoderTest extends TestCase
private $decoder1;
private $decoder2;
- private function doSetUp()
+ protected function setUp()
{
$this->decoder1 = $this
->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface')
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
index bfec205a273d1..9f674e030842d 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\ChainEncoder;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;
class ChainEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const FORMAT_1 = 'format1';
const FORMAT_2 = 'format2';
const FORMAT_3 = 'format3';
@@ -29,7 +26,7 @@ class ChainEncoderTest extends TestCase
private $encoder1;
private $encoder2;
- private function doSetUp()
+ protected function setUp()
{
$this->encoder1 = $this
->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface')
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php
index d6969d6f5dde6..7b5131cb533a6 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
/**
@@ -20,14 +19,12 @@
*/
class CsvEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var CsvEncoder
*/
private $encoder;
- private function doSetUp()
+ protected function setUp()
{
$this->encoder = new CsvEncoder();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
index f5d0dc5a3c963..649fb2ec0db2d 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
@@ -12,18 +12,15 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonDecode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
class JsonDecodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var \Symfony\Component\Serializer\Encoder\JsonDecode */
private $decode;
- private function doSetUp()
+ protected function setUp()
{
$this->decode = new JsonDecode();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
index 6c16e99c15b97..1a3d7c8675598 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
@@ -12,17 +12,14 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
class JsonEncodeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $encoder;
- private function doSetUp()
+ protected function setUp()
{
$this->encode = new JsonEncode();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
index 27e1a55b02e3c..191e8dc35d3ef 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer;
class JsonEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $encoder;
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->encoder = new JsonEncoder();
$this->serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]);
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
index 26ac844781079..a164d517da323 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -23,8 +22,6 @@
class XmlEncoderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var XmlEncoder
*/
@@ -32,7 +29,7 @@ class XmlEncoderTest extends TestCase
private $exampleDateTimeString = '2017-02-19T15:16:08+0300';
- private function doSetUp()
+ protected function setUp()
{
$this->encoder = new XmlEncoder();
$serializer = new Serializer([new CustomNormalizer()], ['xml' => new XmlEncoder()]);
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
index 8c5d61e2617ee..723dc9b0494f2 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
@@ -24,8 +23,6 @@
*/
class CacheMetadataFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetMetadataFor()
{
$metadata = new ClassMetadata(Dummy::class);
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
index ee07e929ee998..b2e5c69211227 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
@@ -23,14 +22,12 @@
*/
class AnnotationLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var AnnotationLoader
*/
private $loader;
- private function doSetUp()
+ protected function setUp()
{
$this->loader = new AnnotationLoader(new AnnotationReader());
}
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
index b142ac08eceb6..264f37fc42d97 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
@@ -22,8 +21,6 @@
*/
class XmlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var XmlFileLoader
*/
@@ -33,7 +30,7 @@ class XmlFileLoaderTest extends TestCase
*/
private $metadata;
- private function doSetUp()
+ protected function setUp()
{
$this->loader = new XmlFileLoader(__DIR__.'/../../Fixtures/serialization.xml');
$this->metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
index 00674e2423ee9..9eb29f25094fe 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
@@ -22,8 +21,6 @@
*/
class YamlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var YamlFileLoader
*/
@@ -33,7 +30,7 @@ class YamlFileLoaderTest extends TestCase
*/
private $metadata;
- private function doSetUp()
+ protected function setUp()
{
$this->loader = new YamlFileLoader(__DIR__.'/../../Fixtures/serialization.yml');
$this->metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
index b0991c17d018c..cce383075a6fe 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -26,8 +25,6 @@
*/
class AbstractNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var AbstractNormalizerDummy
*/
@@ -38,7 +35,7 @@ class AbstractNormalizerTest extends TestCase
*/
private $classMetadata;
- private function doSetUp()
+ protected function setUp()
{
$loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs([[]])->getMock();
$this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs([$loader])->getMock();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
index d76ac4c165b2b..8ce2c10558a7e 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
@@ -27,8 +26,6 @@
class AbstractObjectNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testDenormalize()
{
$normalizer = new AbstractObjectNormalizerDummy();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
index efe18b24f5368..132f3c0806350 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\SerializerInterface;
class ArrayDenormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ArrayDenormalizer
*/
@@ -30,7 +27,7 @@ class ArrayDenormalizerTest extends TestCase
*/
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')->getMock();
$this->denormalizer = new ArrayDenormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
index 3a20f800b0410..28fb73ece5bcd 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php
@@ -12,21 +12,18 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy;
class CustomNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var CustomNormalizer
*/
private $normalizer;
- private function doSetUp()
+ protected function setUp()
{
$this->normalizer = new CustomNormalizer();
$this->normalizer->setSerializer(new Serializer());
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
index 6f327657dabc1..290428980cf88 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
@@ -21,8 +20,6 @@
*/
class DataUriNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const TEST_GIF_DATA = 'data:image/gif;base64,R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=';
const TEST_TXT_DATA = 'data:text/plain,K%C3%A9vin%20Dunglas%0A';
const TEST_TXT_CONTENT = "Kévin Dunglas\n";
@@ -32,7 +29,7 @@ class DataUriNormalizerTest extends TestCase
*/
private $normalizer;
- private function doSetUp()
+ protected function setUp()
{
$this->normalizer = new DataUriNormalizer();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
index 2f4bee62c2149..efe34c6e9510e 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
/**
@@ -11,14 +10,12 @@
*/
class DateIntervalNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var DateIntervalNormalizer
*/
private $normalizer;
- private function doSetUp()
+ protected function setUp()
{
$this->normalizer = new DateIntervalNormalizer();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
index 0234cf27cc040..14b043b64b5a2 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
/**
@@ -20,14 +19,12 @@
*/
class DateTimeNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var DateTimeNormalizer
*/
private $normalizer;
- private function doSetUp()
+ protected function setUp()
{
$this->normalizer = new DateTimeNormalizer();
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
index 3ce06b659f80c..13a244e72eb1c 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;
@@ -28,8 +27,6 @@
class GetSetMethodNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var GetSetMethodNormalizer
*/
@@ -39,7 +36,7 @@ class GetSetMethodNormalizerTest extends TestCase
*/
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\SerializerNormalizer')->getMock();
$this->normalizer = new GetSetMethodNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
index 0532ef47c093b..c08394a2779fd 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\SerializerInterface;
@@ -23,8 +22,6 @@
*/
class JsonSerializableNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var JsonSerializableNormalizer
*/
@@ -35,7 +32,7 @@ class JsonSerializableNormalizerTest extends TestCase
*/
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->serializer = $this->getMockBuilder(JsonSerializerNormalizer::class)->getMock();
$this->normalizer = new JsonSerializableNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
index 2a27c1646ca00..765db4c82bbae 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
@@ -36,8 +35,6 @@
*/
class ObjectNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ObjectNormalizer
*/
@@ -47,7 +44,7 @@ class ObjectNormalizerTest extends TestCase
*/
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\ObjectSerializerNormalizer')->getMock();
$this->normalizer = new ObjectNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
index 3ed994caaf7fc..4b138fca7ba98 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
@@ -13,7 +13,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;
@@ -28,8 +27,6 @@
class PropertyNormalizerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var PropertyNormalizer
*/
@@ -39,7 +36,7 @@ class PropertyNormalizerTest extends TestCase
*/
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
$this->normalizer = new PropertyNormalizer();
diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php
index 03708ab048702..c4814e364f53e 100644
--- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
@@ -31,8 +30,6 @@
class SerializerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testInterface()
{
$serializer = new Serializer();
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
index 2fa7f563938b1..1b53694a63adf 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Stopwatch\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Stopwatch\StopwatchEvent;
/**
@@ -24,8 +23,6 @@
*/
class StopwatchEventTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const DELTA = 37;
public function testGetOrigin()
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
index 6a7ef1582c3d1..f85ccd0ec442d 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Stopwatch\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Stopwatch\Stopwatch;
/**
@@ -24,8 +23,6 @@
*/
class StopwatchTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const DELTA = 20;
public function testStart()
diff --git a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
index 07c3387d46bdb..30e6795a9b4aa 100644
--- a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Templating\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\DelegatingEngine;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\Templating\StreamingEngineInterface;
class DelegatingEngineTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRenderDelegatesToSupportedEngine()
{
$firstEngine = $this->getEngineMock('template.php', false);
diff --git a/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php
index a5a344bc73961..c81698bd89ca5 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php
@@ -12,19 +12,16 @@
namespace Symfony\Component\Templating\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\Loader\ChainLoader;
use Symfony\Component\Templating\Loader\FilesystemLoader;
use Symfony\Component\Templating\TemplateReference;
class ChainLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $loader1;
protected $loader2;
- private function doSetUp()
+ protected function setUp()
{
$fixturesPath = realpath(__DIR__.'/../Fixtures/');
$this->loader1 = new FilesystemLoader($fixturesPath.'/null/%name%');
diff --git a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
index e045e2473d79c..c6dcdefc95f51 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php
@@ -12,17 +12,14 @@
namespace Symfony\Component\Templating\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\Loader\FilesystemLoader;
use Symfony\Component\Templating\TemplateReference;
class FilesystemLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected static $fixturesPath;
- private static function doSetUpBeforeClass()
+ public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index 247f81e17d4f4..4bce834150fb4 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Templating\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\Helper\SlotsHelper;
use Symfony\Component\Templating\Loader\Loader;
use Symfony\Component\Templating\PhpEngine;
@@ -23,16 +22,14 @@
class PhpEngineTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $loader;
- private function doSetUp()
+ protected function setUp()
{
$this->loader = new ProjectTemplateLoader();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->loader = null;
}
diff --git a/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php b/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php
index 7088bad00450e..c67dc376c2364 100644
--- a/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php
+++ b/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php
@@ -12,22 +12,19 @@
namespace Symfony\Component\Templating\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Templating\TemplateNameParser;
use Symfony\Component\Templating\TemplateReference;
class TemplateNameParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $parser;
- private function doSetUp()
+ protected function setUp()
{
$this->parser = new TemplateNameParser();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->parser = null;
}
diff --git a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
index a941b66a5589b..f82b18fdd73c7 100644
--- a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
+++ b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Catalogue;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\MessageCatalogueInterface;
abstract class AbstractOperationTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetEmptyDomains()
{
$this->assertEquals(
diff --git a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
index d0da3340e2aa9..bd97a2445c0a5 100644
--- a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
+++ b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Translation\Tests\DataCollector;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\DataCollector\TranslationDataCollector;
use Symfony\Component\Translation\DataCollectorTranslator;
class TranslationDataCollectorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
if (!class_exists('Symfony\Component\HttpKernel\DataCollector\DataCollector')) {
$this->markTestSkipped('The "DataCollector" is not available');
diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
index b9996c8ed3e12..b5eff6cfcd9fd 100644
--- a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
+++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass;
class TranslationExtractorPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testProcess()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/Translation/Tests/IntervalTest.php b/src/Symfony/Component/Translation/Tests/IntervalTest.php
index cbeaea4250a5c..e49a30bf1148d 100644
--- a/src/Symfony/Component/Translation/Tests/IntervalTest.php
+++ b/src/Symfony/Component/Translation/Tests/IntervalTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\Interval;
class IntervalTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getTests
*/
diff --git a/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
index 13b76bf35b041..9537e1f1c473b 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\CsvFileLoader;
class CsvFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new CsvFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
index db845a8d82d5a..77db041f5d20c 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Translation\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
@@ -20,8 +19,6 @@
*/
class IcuDatFileLoaderTest extends LocalizedTestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadInvalidResource()
{
$this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
index 25d5082747ff1..99b2f90421977 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Translation\Tests\Loader;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Translation\Loader\IcuResFileLoader;
@@ -20,8 +19,6 @@
*/
class IcuResFileLoaderTest extends LocalizedTestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
// resource is build using genrb command
diff --git a/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
index 47ffc9b967c85..fd66e2015ae52 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\IniFileLoader;
class IniFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new IniFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
index 0d452e16dfac9..d264bb16b29d9 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\JsonFileLoader;
class JsonFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new JsonFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php b/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
index 98c1a2185a8c2..279e9fde5b667 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
abstract class LocalizedTestCase extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
if (!\extension_loaded('intl')) {
$this->markTestSkipped('Extension intl is required.');
diff --git a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
index f89584259fa4f..3fe3a9925b195 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\MoFileLoader;
class MoFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new MoFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
index d6e9712200c2c..d4da6452f6569 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\PhpFileLoader;
class PhpFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new PhpFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
index e55d6db89958e..72c4c6672315c 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\PoFileLoader;
class PoFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new PoFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
index 6e87b12d422fc..47462d6aab2c2 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\QtFileLoader;
class QtFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new QtFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
index 118fc4ea2af92..3dcff7b09fbda 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\XliffFileLoader;
class XliffFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new XliffFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
index d05d65d03079f..b46fff7470006 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Translation\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\Loader\YamlFileLoader;
class YamlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoad()
{
$loader = new YamlFileLoader();
diff --git a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
index 4b10620733f5f..b78dbf42ec5a0 100644
--- a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
+++ b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\MessageCatalogue;
class MessageCatalogueTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetLocale()
{
$catalogue = new MessageCatalogue('en');
diff --git a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php
index 71dcc6169a433..abb1d4847215c 100644
--- a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php
+++ b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\MessageSelector;
class MessageSelectorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getChooseTests
*/
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
index 33deb88482cb5..0213e22254782 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Loader\LoaderInterface;
@@ -21,17 +20,15 @@
class TranslatorCacheTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $tmpDir;
- private function doSetUp()
+ protected function setUp()
{
$this->tmpDir = sys_get_temp_dir().'/sf2_translation';
$this->deleteTmpDir();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->deleteTmpDir();
}
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php
index 6d6a946c14496..77af7de33efea 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php
@@ -12,15 +12,12 @@
namespace Symfony\Component\Translation\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Translator;
class TranslatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider getInvalidLocalesTests
*/
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintTest.php b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
index 9ebcd4e84c98b..6c481b00888ed 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
@@ -23,8 +22,6 @@
class ConstraintTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testSetProperties()
{
$constraint = new ConstraintA([
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
index 35cf81cf7dfbf..73d81cbfad9c4 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
@@ -12,22 +12,19 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
class ConstraintViolationListTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $list;
- private function doSetUp()
+ protected function setUp()
{
$this->list = new ConstraintViolationList();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->list = null;
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
index aefb874fe415a..00925ddfdfa1b 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -42,8 +41,6 @@ public function getValue()
*/
abstract class AbstractComparisonValidatorTestCase extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected static function addPhp5Dot5Comparisons(array $comparisons)
{
$result = $comparisons;
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
index 450248a6b336c..5893298711371 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Valid;
@@ -21,8 +20,6 @@
*/
class AllTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRejectNonConstraints()
{
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
index 09d756d465864..31fa81d4e73d0 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\AllValidator;
use Symfony\Component\Validator\Constraints\NotNull;
@@ -20,8 +19,6 @@
class AllValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new AllValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
index 61b72e03aab58..4e712b92ad363 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\CallbackValidator;
@@ -47,8 +46,6 @@ public static function validateStatic($object, ExecutionContextInterface $contex
class CallbackValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new CallbackValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
index 9aeff71cf8e54..f100f90621618 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\ChoiceValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -23,8 +22,6 @@ function choice_callback()
class ChoiceValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new ChoiceValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
index 477e8b38440f7..fef129cfa7494 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Optional;
@@ -24,8 +23,6 @@
*/
class CollectionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testRejectInvalidFieldsOption()
{
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
index 417949533dfc4..e0ccdba754b0b 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\CollectionValidator;
use Symfony\Component\Validator\Constraints\NotNull;
@@ -22,8 +21,6 @@
abstract class CollectionValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new CollectionValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
index 4e6c8917006c0..2d42807821bb3 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Composite;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
@@ -38,8 +37,6 @@ public function getDefaultOption()
*/
class CompositeTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testMergeNestedGroupsIfNoExplicitParentGroup()
{
$constraint = new ConcreteComposite([
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
index ac845aa5478d3..2aab3b18a6c06 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Count;
use Symfony\Component\Validator\Constraints\CountValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,8 +20,6 @@
*/
abstract class CountValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new CountValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
index 6b12d6362914b..429aef812f0d3 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraints\Country;
use Symfony\Component\Validator\Constraints\CountryValidator;
@@ -19,8 +18,6 @@
class CountryValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new CountryValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
index fec42407af127..7a619735369e7 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraints\Currency;
use Symfony\Component\Validator\Constraints\CurrencyValidator;
@@ -19,8 +18,6 @@
class CurrencyValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new CurrencyValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
index e1fa819f42cbd..55bfe4514385d 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\DateTime;
use Symfony\Component\Validator\Constraints\DateTimeValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class DateTimeValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new DateTimeValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
index 7956d3836387e..14edcbb2dff56 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\DateValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class DateValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new DateValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
index ef873d801e36f..344139a44f171 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Bridge\PhpUnit\DnsMock;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\EmailValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -22,8 +21,6 @@
*/
class EmailValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new EmailValidator(false);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
index 39e375b5e5e1a..dfeeeb774eec5 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
class FileTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @dataProvider provideValidSizes
*/
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
index 0d250be1d2f34..67b5a8c7b98b5 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\FileValidator;
@@ -19,8 +18,6 @@
abstract class FileValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected $path;
protected $file;
@@ -30,7 +27,7 @@ protected function createValidator()
return new FileValidator();
}
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
@@ -39,7 +36,7 @@ private function doSetUp()
fwrite($this->file, ' ', 1);
}
- private function doTearDown()
+ protected function tearDown()
{
parent::tearDown();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
index 461ef5e628f6a..174ba5d99c165 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\ImageValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,8 +20,6 @@
*/
class ImageValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected $context;
/**
@@ -42,7 +39,7 @@ protected function createValidator()
return new ImageValidator();
}
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
index 14d88afd55c6b..e1bfb2fccb66a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Ip;
use Symfony\Component\Validator\Constraints\IpValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class IpValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new IpValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
index ec8715ed7dd1a..4e12f0f23f287 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Isbn;
use Symfony\Component\Validator\Constraints\IsbnValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,8 +20,6 @@
*/
class IsbnValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new IsbnValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
index ecdc0a2e4fbc0..3df0d2ebb4a32 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Issn;
use Symfony\Component\Validator\Constraints\IssnValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,8 +20,6 @@
*/
class IssnValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new IssnValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
index 02970ff5fc714..f23fd13fcb692 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Validator\Constraints\Language;
use Symfony\Component\Validator\Constraints\LanguageValidator;
@@ -19,8 +18,6 @@
class LanguageValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new LanguageValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
index 31f63c02e5718..bf7cca3c63247 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\LengthValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class LengthValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new LengthValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
index 98569092230b2..0d15f375c43df 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Locale;
use Symfony\Component\Validator\Constraints\LocaleValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class LocaleValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new LocaleValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
index 0afb0358734a1..a90b90ff63b5a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Luhn;
use Symfony\Component\Validator\Constraints\LuhnValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class LuhnValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new LuhnValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
index 31f0432537f64..edfb65e7a9e7a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Regex;
use Symfony\Component\Validator\Constraints\RegexValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class RegexValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new RegexValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
index 6f3ed9db5c3f3..e32a34b231807 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Time;
use Symfony\Component\Validator\Constraints\TimeValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class TimeValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new TimeValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php
index 29d52c9182301..17334bea7925a 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php
@@ -11,15 +11,12 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Type;
use Symfony\Component\Validator\Constraints\TypeValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class TypeValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected static $file;
protected function createValidator()
@@ -175,7 +172,7 @@ protected function createFile()
return static::$file;
}
- private static function doTearDownAfterClass()
+ public static function tearDownAfterClass()
{
if (static::$file) {
fclose(static::$file);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
index d35623091c18a..e54a936685cd9 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Bridge\PhpUnit\DnsMock;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Url;
use Symfony\Component\Validator\Constraints\UrlValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -22,8 +21,6 @@
*/
class UrlValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new UrlValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
index d3ca7c214223d..21bb9e5064229 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Uuid;
use Symfony\Component\Validator\Constraints\UuidValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
@@ -21,8 +20,6 @@
*/
class UuidValidatorTest extends ConstraintValidatorTestCase
{
- use ForwardCompatTestTrait;
-
protected function createValidator()
{
return new UuidValidator();
diff --git a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
index 41b0fa8eaad99..adc292b213d88 100644
--- a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Blank as BlankConstraint;
@@ -21,8 +20,6 @@
class ContainerConstraintValidatorFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetInstanceCreatesValidator()
{
$factory = new ContainerConstraintValidatorFactory(new Container());
diff --git a/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php b/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
index 00407b3ab0f31..29fd4b38d151f 100644
--- a/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
+++ b/src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\DataCollector;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\DataCollector\ValidatorDataCollector;
@@ -21,8 +20,6 @@
class ValidatorDataCollectorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testCollectsValidatorCalls()
{
$originalValidator = $this->createMock(ValidatorInterface::class);
diff --git a/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php b/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
index 48943a3fb2654..9a2958364df17 100644
--- a/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
+++ b/src/Symfony/Component/Validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -22,8 +21,6 @@
class AddConstraintValidatorsPassTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testThatConstraintValidatorServicesAreProcessed()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php
index 171608755f52b..6296030fd7dff 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Validator\Tests\Mapping\Cache;
use Doctrine\Common\Cache\ArrayCache;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\Cache\DoctrineCache;
class DoctrineCacheTest extends AbstractCacheTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
$this->cache = new DoctrineCache(new ArrayCache());
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
index e704732fadd70..fcac5e232ae4e 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
@@ -2,7 +2,6 @@
namespace Symfony\Component\Validator\Tests\Mapping\Cache;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Validator\Mapping\Cache\Psr6Cache;
use Symfony\Component\Validator\Mapping\ClassMetadata;
@@ -12,9 +11,7 @@
*/
class Psr6CacheTest extends AbstractCacheTest
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
$this->cache = new Psr6Cache(new ArrayAdapter());
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
index e8929d9f81c51..73af5c1894053 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata;
@@ -22,8 +21,6 @@
class ClassMetadataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
const PROVIDERCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity';
@@ -31,12 +28,12 @@ class ClassMetadataTest extends TestCase
protected $metadata;
- private function doSetUp()
+ protected function setUp()
{
$this->metadata = new ClassMetadata(self::CLASSNAME);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->metadata = null;
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
index 9b844a28990e6..42477e9f8885b 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Validator\Tests\Mapping\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory;
class BlackHoleMetadataFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testGetMetadataForThrowsALogicException()
{
$this->expectException('LogicException');
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
index a1f66ce4ce66f..f3332b8ff9dd2 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Mapping\Factory;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
@@ -21,8 +20,6 @@
class LazyLoadingMetadataFactoryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const CLASS_NAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const PARENT_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
const INTERFACE_A_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceA';
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
index 7c78a0bb7243e..63d127c67aa13 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\GetterMetadata;
use Symfony\Component\Validator\Tests\Fixtures\Entity;
class GetterMetadataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
public function testInvalidPropertyName()
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php
index 80e1f5e7c417c..069ccd322929e 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php
@@ -12,23 +12,20 @@
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
class StaticMethodLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $errorLevel;
- private function doSetUp()
+ protected function setUp()
{
$this->errorLevel = error_reporting();
}
- private function doTearDown()
+ protected function tearDown()
{
error_reporting($this->errorLevel);
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
index f0a9c762f57ee..53c77ec338305 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Choice;
@@ -30,8 +29,6 @@
class XmlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadClassMetadataReturnsTrueIfSuccessful()
{
$loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml');
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
index d30a83d8b846e..f81868b5b825f 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Choice;
@@ -27,8 +26,6 @@
class YamlFileLoaderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testLoadClassMetadataReturnsFalseIfEmpty()
{
$loader = new YamlFileLoader(__DIR__.'/empty-mapping.yml');
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
index cab61e9225dd0..651ba9564254a 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\MemberMetadata;
use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint;
@@ -21,11 +20,9 @@
class MemberMetadataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $metadata;
- private function doSetUp()
+ protected function setUp()
{
$this->metadata = new TestMemberMetadata(
'Symfony\Component\Validator\Tests\Fixtures\Entity',
@@ -34,7 +31,7 @@ private function doSetUp()
);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->metadata = null;
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
index 3a85317385f03..7902625219ba9 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
@@ -12,14 +12,11 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Mapping\PropertyMetadata;
use Symfony\Component\Validator\Tests\Fixtures\Entity;
class PropertyMetadataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
index 85b81ebe52c8d..697be6edc63f7 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Validator\Tests\Validator;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Expression;
@@ -34,8 +33,6 @@
*/
abstract class AbstractTest extends AbstractValidatorTest
{
- use ForwardCompatTestTrait;
-
/**
* @var ValidatorInterface
*/
@@ -46,7 +43,7 @@ abstract class AbstractTest extends AbstractValidatorTest
*/
abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []);
- private function doSetUp()
+ protected function setUp()
{
parent::setUp();
diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
index 9d345b763ae7d..07e45f47eb2cb 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Validator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\Constraints\Valid;
@@ -29,8 +28,6 @@
*/
abstract class AbstractValidatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
const ENTITY_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
const REFERENCE_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Reference';
@@ -50,7 +47,7 @@ abstract class AbstractValidatorTest extends TestCase
*/
public $referenceMetadata;
- private function doSetUp()
+ protected function setUp()
{
$this->metadataFactory = new FakeMetadataFactory();
$this->metadata = new ClassMetadata(self::ENTITY_CLASS);
@@ -59,7 +56,7 @@ private function doSetUp()
$this->metadataFactory->addMetadata($this->referenceMetadata);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->metadataFactory = null;
$this->metadata = null;
diff --git a/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
index 2e76466b1c6b8..8acfa597c2849 100644
--- a/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Validator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
@@ -24,8 +23,6 @@
class TraceableValidatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testValidate()
{
$originalValidator = $this->createMock(ValidatorInterface::class);
diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
index b2ff01c66a944..16d81697e6585 100644
--- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
+++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
@@ -12,25 +12,22 @@
namespace Symfony\Component\Validator\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Validator\ValidatorBuilder;
use Symfony\Component\Validator\ValidatorBuilderInterface;
class ValidatorBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var ValidatorBuilderInterface
*/
protected $builder;
- private function doSetUp()
+ protected function setUp()
{
$this->builder = new ValidatorBuilder();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->builder = null;
}
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
index 2ac264d2a5760..ea83e77163d19 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ExceptionCaster;
use Symfony\Component\VarDumper\Caster\FrameStub;
@@ -22,7 +21,6 @@
class ExceptionCasterTest extends TestCase
{
- use ForwardCompatTestTrait;
use VarDumperTestTrait;
private function getTestException($msg, &$ref = null)
@@ -30,7 +28,7 @@ private function getTestException($msg, &$ref = null)
return new \Exception(''.$msg);
}
- private function doTearDown()
+ protected function tearDown()
{
ExceptionCaster::$srcContext = 1;
ExceptionCaster::$traceArgs = true;
@@ -46,14 +44,14 @@ public function testDefaultSettings()
#message: "foo"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 30
+ #line: 28
trace: {
- %s%eTests%eCaster%eExceptionCasterTest.php:30 {
+ %s%eTests%eCaster%eExceptionCasterTest.php:28 {
› {
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:42 { …}
+ %s%eTests%eCaster%eExceptionCasterTest.php:40 { …}
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testDefaultSettings() {}
%A
EODUMP;
@@ -68,12 +66,12 @@ public function testSeek()
$expectedDump = <<<'EODUMP'
{
- %s%eTests%eCaster%eExceptionCasterTest.php:30 {
+ %s%eTests%eCaster%eExceptionCasterTest.php:28 {
› {
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:67 { …}
+ %s%eTests%eCaster%eExceptionCasterTest.php:65 { …}
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testSeek() {}
%A
EODUMP;
@@ -91,14 +89,14 @@ public function testNoArgs()
#message: "1"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 30
+ #line: 28
trace: {
- %sExceptionCasterTest.php:30 {
+ %sExceptionCasterTest.php:28 {
› {
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:86 { …}
+ %s%eTests%eCaster%eExceptionCasterTest.php:84 { …}
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testNoArgs() {}
%A
EODUMP;
@@ -116,9 +114,9 @@ public function testNoSrcContext()
#message: "1"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 30
+ #line: 28
trace: {
- %s%eTests%eCaster%eExceptionCasterTest.php:30
+ %s%eTests%eCaster%eExceptionCasterTest.php:28
%s%eTests%eCaster%eExceptionCasterTest.php:%d
%A
EODUMP;
@@ -148,10 +146,10 @@ public function testHtmlDump()
#code: 0
#file: "%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php"
- #line: 30
+ #line: 28trace: {%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php:30
+Stack level %d.">%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php:28
…%d
}
}
@@ -223,7 +221,7 @@ public function testExcludeVerbosity()
#message: "foo"
#code: 0
#file: "%sExceptionCasterTest.php"
- #line: 30
+ #line: 28
}
EODUMP;
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php
index fff7dd3219655..1d7b3f62787a2 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
@@ -20,19 +19,18 @@
*/
class XmlReaderCasterTest extends TestCase
{
- use ForwardCompatTestTrait;
use VarDumperTestTrait;
/** @var \XmlReader */
private $reader;
- private function doSetUp()
+ protected function setUp()
{
$this->reader = new \XmlReader();
$this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml');
}
- private function doTearDown()
+ protected function tearDown()
{
$this->reader->close();
}
diff --git a/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php b/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php
index 24af145a510d6..d4b6c24c1163f 100644
--- a/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\VarDumper\Tests\Cloner;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Cloner\Data;
@@ -20,8 +19,6 @@
class DataTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testBasicData()
{
$values = [1 => 123, 4.5, 'abc', null, false];
diff --git a/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php b/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php
index b2e5c70c4ad64..fb4bbd96f2107 100644
--- a/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php
+++ b/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php
@@ -13,19 +13,16 @@
use Fig\Link\Link;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\WebLink\HttpHeaderSerializer;
class HttpHeaderSerializerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/**
* @var HttpHeaderSerializer
*/
private $serializer;
- private function doSetUp()
+ protected function setUp()
{
$this->serializer = new HttpHeaderSerializer();
}
diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php
index 817b8fce401eb..7e96c8875e74f 100644
--- a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php
+++ b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php
@@ -3,14 +3,11 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\DefinitionBuilder;
use Symfony\Component\Workflow\Transition;
class DefinitionBuilderTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAddPlaceInvalidName()
{
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
index e334adde8350a..185d4fd6c9ef4 100644
--- a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php
@@ -3,14 +3,11 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Transition;
class DefinitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testAddPlaces()
{
$places = range('a', 'e');
diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
index d2f09d1143c0c..116f8000775b1 100644
--- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
@@ -3,19 +3,17 @@
namespace Symfony\Component\Workflow\Tests\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
class GraphvizDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
private $dumper;
- private function doSetUp()
+ protected function setUp()
{
$this->dumper = new GraphvizDumper();
}
diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php
index 7e29d7deffbf8..473d31ecf5895 100644
--- a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php
@@ -3,19 +3,17 @@
namespace Symfony\Component\Workflow\Tests\Dumper;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Dumper\StateMachineGraphvizDumper;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
class StateMachineGraphvizDumperTest extends TestCase
{
- use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
private $dumper;
- private function doSetUp()
+ protected function setUp()
{
$this->dumper = new StateMachineGraphvizDumper();
}
diff --git a/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php b/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php
index 57add5342e2b3..d27c63e5275c7 100644
--- a/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php
+++ b/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Workflow\Tests\EventListener;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -19,14 +18,12 @@
class GuardListenerTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $authenticationChecker;
private $validator;
private $listener;
private $configuration;
- private function doSetUp()
+ protected function setUp()
{
$this->configuration = [
'test_is_granted' => 'is_granted("something")',
@@ -47,7 +44,7 @@ private function doSetUp()
$this->listener = new GuardListener($this->configuration, $expressionLanguage, $tokenStorage, $this->authenticationChecker, $trustResolver, null, $this->validator);
}
- private function doTearDown()
+ protected function tearDown()
{
$this->authenticationChecker = null;
$this->validator = null;
diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
index 3032dccd15927..df58b299e5462 100644
--- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php
+++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
@@ -13,11 +12,9 @@
class RegistryTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $registry;
- private function doSetUp()
+ protected function setUp()
{
$this->registry = new Registry();
@@ -26,7 +23,7 @@ private function doSetUp()
$this->registry->add(new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow3'), $this->createSupportStrategy(Subject2::class));
}
- private function doTearDown()
+ protected function tearDown()
{
$this->registry = null;
}
diff --git a/src/Symfony/Component/Workflow/Tests/TransitionTest.php b/src/Symfony/Component/Workflow/Tests/TransitionTest.php
index f349cca8b9b6a..009f19acfad29 100644
--- a/src/Symfony/Component/Workflow/Tests/TransitionTest.php
+++ b/src/Symfony/Component/Workflow/Tests/TransitionTest.php
@@ -3,13 +3,10 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Transition;
class TransitionTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testValidateName()
{
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
diff --git a/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
index 23c70f39da203..76c62089d39f4 100644
--- a/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Validator/StateMachineValidatorTest.php
@@ -3,15 +3,12 @@
namespace Symfony\Component\Workflow\Tests\Validator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\Validator\StateMachineValidator;
class StateMachineValidatorTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testWithMultipleTransitionWithSameNameShareInput()
{
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
diff --git a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
index e6fc8f442e1db..3a9da2866414b 100644
--- a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
+++ b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Workflow\Tests\Validator;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
use Symfony\Component\Workflow\Transition;
@@ -11,7 +10,6 @@
class WorkflowValidatorTest extends TestCase
{
- use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
public function testSinglePlaceWorkflowValidatorAndComplexWorkflow()
diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
index 21d5ed2026cec..6a1d092a0760c 100644
--- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
+++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
@@ -3,7 +3,6 @@
namespace Symfony\Component\Workflow\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Event\Event;
@@ -16,7 +15,6 @@
class WorkflowTest extends TestCase
{
- use ForwardCompatTestTrait;
use WorkflowBuilderTrait;
public function testGetMarkingWithInvalidStoreReturn()
diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
index c9ec8109bd505..0697de418bb02 100644
--- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Yaml\Tests\Command;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
@@ -25,8 +24,6 @@
*/
class LintCommandTest extends TestCase
{
- use ForwardCompatTestTrait;
-
private $files;
public function testLintCorrectFile()
@@ -116,13 +113,13 @@ protected function createCommandTester()
return new CommandTester($command);
}
- private function doSetUp()
+ protected function setUp()
{
$this->files = [];
@mkdir(sys_get_temp_dir().'/framework-yml-lint-test');
}
- private function doTearDown()
+ protected function tearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php
index e3ecfa1a7b953..4646c0c38b7f8 100644
--- a/src/Symfony/Component/Yaml/Tests/DumperTest.php
+++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
@@ -20,8 +19,6 @@
class DumperTest extends TestCase
{
- use ForwardCompatTestTrait;
-
protected $parser;
protected $dumper;
protected $path;
@@ -41,14 +38,14 @@ class DumperTest extends TestCase
],
];
- private function doSetUp()
+ protected function setUp()
{
$this->parser = new Parser();
$this->dumper = new Dumper();
$this->path = __DIR__.'/Fixtures';
}
- private function doTearDown()
+ protected function tearDown()
{
$this->parser = null;
$this->dumper = null;
diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php
index 851398c44c601..c6db784a8fe67 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -12,16 +12,13 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Inline;
use Symfony\Component\Yaml\Yaml;
class InlineTest extends TestCase
{
- use ForwardCompatTestTrait;
-
- private function doSetUp()
+ protected function setUp()
{
Inline::initialize(0, 0);
}
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index a2bd72e70066b..9a0766ebac615 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -12,24 +12,21 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Component\Yaml\Yaml;
class ParserTest extends TestCase
{
- use ForwardCompatTestTrait;
-
/** @var Parser */
protected $parser;
- private function doSetUp()
+ protected function setUp()
{
$this->parser = new Parser();
}
- private function doTearDown()
+ protected function tearDown()
{
$this->parser = null;
diff --git a/src/Symfony/Component/Yaml/Tests/YamlTest.php b/src/Symfony/Component/Yaml/Tests/YamlTest.php
index 158d581d6691d..7be1266497f0e 100644
--- a/src/Symfony/Component/Yaml/Tests/YamlTest.php
+++ b/src/Symfony/Component/Yaml/Tests/YamlTest.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Yaml\Yaml;
class YamlTest extends TestCase
{
- use ForwardCompatTestTrait;
-
public function testParseAndDump()
{
$data = ['lorem' => 'ipsum', 'dolor' => 'sit'];
From 3b3582eeaff2890004fc77c985176f7ae6cd70be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Sat, 3 Aug 2019 23:41:59 +0200
Subject: [PATCH 039/147] Fix path to phpunit binary
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 8ccbc40da30aa..89fbf93a4228e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -299,7 +299,7 @@ install:
tfold src/Symfony/Component/Console.tty $PHPUNIT src/Symfony/Component/Console --group tty
if [[ $PHP = ${MIN_PHP%.*} ]]; then
export PHP=$MIN_PHP
- echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"
+ echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8-0/phpunit --colors=always src/Symfony/Component/Process/"
fi
fi
}
From f1cb5559c9c69dbe0676e509ba45f54902facdd7 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Sun, 4 Aug 2019 00:08:43 +0200
Subject: [PATCH 040/147] cs fix
---
.../Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php | 1 -
.../Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php | 1 -
.../Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php | 1 -
.../Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php | 1 -
src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php | 1 -
.../Component/Cache/Tests/Simple/RedisClusterCacheTest.php | 1 -
src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 1 -
.../Component/Finder/Tests/Iterator/RealIteratorTestCase.php | 1 -
.../Form/Tests/Extension/Core/Type/BirthdayTypeTest.php | 1 -
.../Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php | 1 -
.../Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php | 1 -
src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php | 1 -
src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php | 1 -
src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php | 1 -
src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php | 1 -
src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php | 1 -
.../PropertyAccess/Tests/PropertyAccessorCollectionTest.php | 1 -
17 files changed, 17 deletions(-)
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
index b083703eea114..cd0dfb7a59090 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-
class PredisClusterAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
index a06477342bbcc..5b09919e28544 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-
class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
index 77d3eadc8af67..bd9def326dd32 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-
class RedisArrayAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
index 0df9b00331202..9c339d2dd769f 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-
class RedisClusterAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
index 4b60da4c62b95..ec5e4c06e2fc4 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
-
class RedisArrayCacheTest extends AbstractRedisCacheTest
{
public static function setUpBeforeClass()
diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
index de0f936589662..6b7f8039d721b 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Cache\Tests\Simple;
-
class RedisClusterCacheTest extends AbstractRedisCacheTest
{
public static function setUpBeforeClass()
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index 1ed86fc65ea16..9b8d1a716a9ae 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Filesystem\Tests;
-
/**
* Test class for Filesystem.
*/
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
index 1a4d9ababaeb3..70048a5ea6982 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Finder\Tests\Iterator;
-
abstract class RealIteratorTestCase extends IteratorTestCase
{
protected static $tmpDir;
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 90a78898ce2cd..8fef1d154b491 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-
/**
* @author Stepan Anchugov
*/
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 53a69c1f34f80..9ed86fe459af5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-
/**
* @author Bernhard Schussek
*/
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 97fae69a7f596..74c4efb82f509 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
-
class UrlTypeTest extends TextTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\UrlType';
diff --git a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
index 8d58293df6a05..7cf527946be5f 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Intl\Tests\Locale;
-
class LocaleTest extends AbstractLocaleTest
{
public function testAcceptFromHttp()
diff --git a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
index ff0f01422dfa5..aa3984b521d87 100644
--- a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-
/**
* @author Jérémy Derussé
*/
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
index 564d78be82d18..6f50dcefa61e2 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-
/**
* @author Jérémy Derussé
*
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
index 32a197130bd21..d6d72fb58e877 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-
/**
* @author Jérémy Derussé
*
diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
index 893e42fbc8f9a..fd35ab4f2f661 100644
--- a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Lock\Tests\Store;
-
/**
* @author Jérémy Derussé
*
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
index 507ec97ed98c4..34173b4e5e9af 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\PropertyAccess\Tests;
-
class PropertyAccessorCollectionTest_Car
{
private $axes;
From bfd5d4e3624041d3d62e9fa86d9704e7bdb7dd0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Sun, 4 Aug 2019 00:21:34 +0200
Subject: [PATCH 041/147] Fix tests on console
---
.../Console/Tests/ApplicationTest.php | 1 +
.../Console/Tests/Helper/TableTest.php | 26 +++++++++----------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 6e99c2b83d55b..15ecf8e821616 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -171,6 +171,7 @@ public function testRegisterAmbiguous()
};
$application = new Application();
+ $application->setAutoExit(false);
$application
->register('test-foo')
->setAliases(['test'])
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
index 1693623c91b4f..571cf0a6c43f4 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
@@ -114,11 +114,11 @@ public function renderProvider()
$books,
'compact',
<<<'TABLE'
- ISBN Title Author
- 99921-58-10-7 Divine Comedy Dante Alighieri
- 9971-5-0210-0 A Tale of Two Cities Charles Dickens
- 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
- 80-902734-1-6 And Then There Were None Agatha Christie
+ ISBN Title Author
+ 99921-58-10-7 Divine Comedy Dante Alighieri
+ 9971-5-0210-0 A Tale of Two Cities Charles Dickens
+ 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
+ 80-902734-1-6 And Then There Were None Agatha Christie
TABLE
],
@@ -127,14 +127,14 @@ public function renderProvider()
$books,
'borderless',
<<<'TABLE'
- =============== ========================== ==================
- ISBN Title Author
- =============== ========================== ==================
- 99921-58-10-7 Divine Comedy Dante Alighieri
- 9971-5-0210-0 A Tale of Two Cities Charles Dickens
- 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
- 80-902734-1-6 And Then There Were None Agatha Christie
- =============== ========================== ==================
+ =============== ========================== ==================
+ ISBN Title Author
+ =============== ========================== ==================
+ 99921-58-10-7 Divine Comedy Dante Alighieri
+ 9971-5-0210-0 A Tale of Two Cities Charles Dickens
+ 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
+ 80-902734-1-6 And Then There Were None Agatha Christie
+ =============== ========================== ==================
TABLE
],
From 8863f0675d9db3ed366d487f165204bd0fba66a4 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Sun, 4 Aug 2019 04:46:49 +0200
Subject: [PATCH 042/147] [Routing] added a warning about the
getRouteCollection() method
---
src/Symfony/Component/Routing/RouterInterface.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/Symfony/Component/Routing/RouterInterface.php b/src/Symfony/Component/Routing/RouterInterface.php
index a10ae34e07451..8a3e33dc22436 100644
--- a/src/Symfony/Component/Routing/RouterInterface.php
+++ b/src/Symfony/Component/Routing/RouterInterface.php
@@ -26,6 +26,9 @@ interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface
/**
* Gets the RouteCollection instance associated with this Router.
*
+ * WARNING: This method should never be used at runtime as it is SLOW.
+ * You might use it in a cache warmer though.
+ *
* @return RouteCollection A RouteCollection instance
*/
public function getRouteCollection();
From 724f1f524f99c6679dbbc15b4720087099ad2371 Mon Sep 17 00:00:00 2001
From: Roland Franssen
Date: Sun, 4 Aug 2019 08:07:53 +0200
Subject: [PATCH 043/147] [Intl] Order alpha2 to alpha3 mapping
---
.../Data/Generator/LanguageDataGenerator.php | 2 +
.../Intl/Resources/data/languages/meta.json | 42 +++++++++----------
.../AbstractLanguageDataProviderTest.php | 38 ++++++++---------
3 files changed, 42 insertions(+), 40 deletions(-)
diff --git a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
index e8695e19319d5..3198d7b164db5 100644
--- a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
+++ b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
@@ -193,6 +193,8 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $me
}
}
+ asort($alpha2ToAlpha3);
+
return $alpha2ToAlpha3;
}
}
diff --git a/src/Symfony/Component/Intl/Resources/data/languages/meta.json b/src/Symfony/Component/Intl/Resources/data/languages/meta.json
index c2eba4aa1a92f..7c03bf0c64891 100644
--- a/src/Symfony/Component/Intl/Resources/data/languages/meta.json
+++ b/src/Symfony/Component/Intl/Resources/data/languages/meta.json
@@ -626,14 +626,11 @@
"Alpha2ToAlpha3": {
"aa": "aar",
"ab": "abk",
- "dz": "dzo",
"af": "afr",
"ak": "aka",
- "sq": "sqi",
"am": "amh",
"ar": "ara",
"an": "arg",
- "hy": "hye",
"as": "asm",
"av": "ava",
"ae": "ave",
@@ -641,7 +638,6 @@
"az": "aze",
"ba": "bak",
"bm": "bam",
- "eu": "eus",
"be": "bel",
"bn": "ben",
"bi": "bis",
@@ -649,12 +645,10 @@
"bs": "bos",
"br": "bre",
"bg": "bul",
- "my": "mya",
"ca": "cat",
"cs": "ces",
"ch": "cha",
"ce": "che",
- "zh": "zho",
"cu": "chu",
"cv": "chv",
"kw": "cor",
@@ -664,13 +658,12 @@
"da": "dan",
"de": "deu",
"dv": "div",
- "mn": "mon",
- "nl": "nld",
- "et": "est",
+ "dz": "dzo",
"el": "ell",
"en": "eng",
"eo": "epo",
- "ik": "ipk",
+ "et": "est",
+ "eu": "eus",
"ee": "ewe",
"fo": "fao",
"fa": "fas",
@@ -679,8 +672,6 @@
"fr": "fra",
"fy": "fry",
"ff": "ful",
- "om": "orm",
- "ka": "kat",
"gd": "gla",
"ga": "gle",
"gl": "glg",
@@ -695,31 +686,34 @@
"ho": "hmo",
"hr": "hrv",
"hu": "hun",
+ "hy": "hye",
"ig": "ibo",
- "is": "isl",
"io": "ido",
"ii": "iii",
"iu": "iku",
"ie": "ile",
"ia": "ina",
"id": "ind",
+ "ik": "ipk",
+ "is": "isl",
"it": "ita",
"jv": "jav",
"ja": "jpn",
"kl": "kal",
"kn": "kan",
"ks": "kas",
+ "ka": "kat",
"kr": "kau",
"kk": "kaz",
"km": "khm",
"ki": "kik",
"rw": "kin",
"ky": "kir",
- "ku": "kur",
- "kg": "kon",
"kv": "kom",
+ "kg": "kon",
"ko": "kor",
"kj": "kua",
+ "ku": "kur",
"lo": "lao",
"la": "lat",
"lv": "lav",
@@ -729,40 +723,43 @@
"lb": "ltz",
"lu": "lub",
"lg": "lug",
- "mk": "mkd",
"mh": "mah",
"ml": "mal",
- "mi": "mri",
"mr": "mar",
- "ms": "msa",
+ "mk": "mkd",
"mg": "mlg",
"mt": "mlt",
- "ro": "ron",
+ "mn": "mon",
+ "mi": "mri",
+ "ms": "msa",
+ "my": "mya",
"na": "nau",
"nv": "nav",
"nr": "nbl",
"nd": "nde",
"ng": "ndo",
"ne": "nep",
+ "nl": "nld",
"nn": "nno",
"nb": "nob",
"ny": "nya",
"oc": "oci",
"oj": "oji",
"or": "ori",
+ "om": "orm",
"os": "oss",
"pa": "pan",
- "ps": "pus",
"pi": "pli",
"pl": "pol",
"pt": "por",
+ "ps": "pus",
"qu": "que",
"rm": "roh",
+ "ro": "ron",
"rn": "run",
"ru": "rus",
"sg": "sag",
"sa": "san",
- "sr": "srp",
"si": "sin",
"sk": "slk",
"sl": "slv",
@@ -773,7 +770,9 @@
"so": "som",
"st": "sot",
"es": "spa",
+ "sq": "sqi",
"sc": "srd",
+ "sr": "srp",
"ss": "ssw",
"su": "sun",
"sw": "swa",
@@ -803,6 +802,7 @@
"yi": "yid",
"yo": "yor",
"za": "zha",
+ "zh": "zho",
"zu": "zul"
}
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
index 2c8ce876a8454..917f6f0dd1e6f 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
@@ -649,11 +649,9 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'ab' => 'abk',
'af' => 'afr',
'ak' => 'aka',
- 'sq' => 'sqi',
'am' => 'amh',
'ar' => 'ara',
'an' => 'arg',
- 'hy' => 'hye',
'as' => 'asm',
'av' => 'ava',
'ae' => 'ave',
@@ -661,7 +659,6 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'az' => 'aze',
'ba' => 'bak',
'bm' => 'bam',
- 'eu' => 'eus',
'be' => 'bel',
'bn' => 'ben',
'bi' => 'bis',
@@ -669,12 +666,10 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'bs' => 'bos',
'br' => 'bre',
'bg' => 'bul',
- 'my' => 'mya',
'ca' => 'cat',
'cs' => 'ces',
'ch' => 'cha',
'ce' => 'che',
- 'zh' => 'zho',
'cu' => 'chu',
'cv' => 'chv',
'kw' => 'cor',
@@ -684,13 +679,12 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'da' => 'dan',
'de' => 'deu',
'dv' => 'div',
- 'nl' => 'nld',
'dz' => 'dzo',
- 'et' => 'est',
'el' => 'ell',
'en' => 'eng',
'eo' => 'epo',
- 'ik' => 'ipk',
+ 'et' => 'est',
+ 'eu' => 'eus',
'ee' => 'ewe',
'fo' => 'fao',
'fa' => 'fas',
@@ -699,8 +693,6 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'fr' => 'fra',
'fy' => 'fry',
'ff' => 'ful',
- 'om' => 'orm',
- 'ka' => 'kat',
'gd' => 'gla',
'ga' => 'gle',
'gl' => 'glg',
@@ -715,32 +707,34 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'ho' => 'hmo',
'hr' => 'hrv',
'hu' => 'hun',
+ 'hy' => 'hye',
'ig' => 'ibo',
- 'is' => 'isl',
'io' => 'ido',
'ii' => 'iii',
'iu' => 'iku',
'ie' => 'ile',
'ia' => 'ina',
'id' => 'ind',
+ 'ik' => 'ipk',
+ 'is' => 'isl',
'it' => 'ita',
'jv' => 'jav',
'ja' => 'jpn',
'kl' => 'kal',
'kn' => 'kan',
'ks' => 'kas',
+ 'ka' => 'kat',
'kr' => 'kau',
'kk' => 'kaz',
- 'mn' => 'mon',
'km' => 'khm',
'ki' => 'kik',
'rw' => 'kin',
'ky' => 'kir',
- 'ku' => 'kur',
- 'kg' => 'kon',
'kv' => 'kom',
+ 'kg' => 'kon',
'ko' => 'kor',
'kj' => 'kua',
+ 'ku' => 'kur',
'lo' => 'lao',
'la' => 'lat',
'lv' => 'lav',
@@ -750,32 +744,36 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'lb' => 'ltz',
'lu' => 'lub',
'lg' => 'lug',
- 'mk' => 'mkd',
'mh' => 'mah',
'ml' => 'mal',
- 'mi' => 'mri',
'mr' => 'mar',
- 'ms' => 'msa',
+ 'mk' => 'mkd',
'mg' => 'mlg',
'mt' => 'mlt',
+ 'mn' => 'mon',
+ 'mi' => 'mri',
+ 'ms' => 'msa',
+ 'my' => 'mya',
'na' => 'nau',
'nv' => 'nav',
'nr' => 'nbl',
'nd' => 'nde',
'ng' => 'ndo',
'ne' => 'nep',
+ 'nl' => 'nld',
'nn' => 'nno',
'nb' => 'nob',
'ny' => 'nya',
'oc' => 'oci',
'oj' => 'oji',
'or' => 'ori',
+ 'om' => 'orm',
'os' => 'oss',
'pa' => 'pan',
- 'ps' => 'pus',
'pi' => 'pli',
'pl' => 'pol',
'pt' => 'por',
+ 'ps' => 'pus',
'qu' => 'que',
'rm' => 'roh',
'ro' => 'ron',
@@ -783,7 +781,6 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'ru' => 'rus',
'sg' => 'sag',
'sa' => 'san',
- 'sr' => 'srp',
'si' => 'sin',
'sk' => 'slk',
'sl' => 'slv',
@@ -794,7 +791,9 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'so' => 'som',
'st' => 'sot',
'es' => 'spa',
+ 'sq' => 'sqi',
'sc' => 'srd',
+ 'sr' => 'srp',
'ss' => 'ssw',
'su' => 'sun',
'sw' => 'swa',
@@ -824,6 +823,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
'yi' => 'yid',
'yo' => 'yor',
'za' => 'zha',
+ 'zh' => 'zho',
'zu' => 'zul',
];
From d098c1153980f477b1a639ba3025d84b37b30987 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Sun, 4 Aug 2019 11:16:42 +0200
Subject: [PATCH 044/147] Remove calls to deprecated function assertAttributeX
---
.../EventDispatcher/Tests/GenericEventTest.php | 8 ++++----
.../Storage/Handler/PdoSessionHandlerTest.php | 18 +++++++++---------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
index 0628d8518665d..f0f0d71f29a01 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
@@ -61,14 +61,14 @@ public function testGetArguments()
public function testSetArguments()
{
$result = $this->event->setArguments(['foo' => 'bar']);
- $this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event);
+ $this->assertSame(['foo' => 'bar'], $this->event->getArguments());
$this->assertSame($this->event, $result);
}
public function testSetArgument()
{
$result = $this->event->setArgument('foo2', 'bar2');
- $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
+ $this->assertSame(['name' => 'Event', 'foo2' => 'bar2'], $this->event->getArguments());
$this->assertEquals($this->event, $result);
}
@@ -97,13 +97,13 @@ public function testOffsetGet()
public function testOffsetSet()
{
$this->event['foo2'] = 'bar2';
- $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
+ $this->assertSame(['name' => 'Event', 'foo2' => 'bar2'], $this->event->getArguments());
}
public function testOffsetUnset()
{
unset($this->event['name']);
- $this->assertAttributeSame([], 'arguments', $this->event);
+ $this->assertSame([], $this->event->getArguments());
}
public function testOffsetIsset()
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 ff513b7efae0d..123b605d28600 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -324,15 +324,15 @@ public function testGetConnectionConnectsIfNeeded()
public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null)
{
$storage = new PdoSessionHandler($url);
-
- $this->assertAttributeEquals($expectedDsn, 'dsn', $storage);
-
- if (null !== $expectedUser) {
- $this->assertAttributeEquals($expectedUser, 'username', $storage);
- }
-
- if (null !== $expectedPassword) {
- $this->assertAttributeEquals($expectedPassword, 'password', $storage);
+ $reflection = new \ReflectionClass(PdoSessionHandler::class);
+
+ foreach (['dsn' => $expectedDsn, 'username' => $expectedUser, 'password' => $expectedPassword] as $property => $expectedValue) {
+ if (!isset($expectedValue)) {
+ continue;
+ }
+ $property = $reflection->getProperty($property);
+ $property->setAccessible(true);
+ $this->assertSame($expectedValue, $property->getValue($storage));
}
}
From 226bdd18fb2e4735b59a6e15ca2b2572e342d001 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Sun, 4 Aug 2019 18:55:16 +0200
Subject: [PATCH 045/147] Use PHPunit assertion
---
.php_cs.dist | 2 +-
.../Filesystem/Tests/FilesystemTest.php | 36 +++++++++----------
.../Handler/NativeFileSessionHandlerTest.php | 2 +-
src/Symfony/Component/Intl/Tests/IntlTest.php | 2 +-
.../Intl/Tests/Util/GitRepositoryTest.php | 2 +-
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/.php_cs.dist b/.php_cs.dist
index 960f153ae603d..e288ca8bc4847 100644
--- a/.php_cs.dist
+++ b/.php_cs.dist
@@ -9,7 +9,7 @@ return PhpCsFixer\Config::create()
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHPUnit75Migration:risky' => true,
- 'php_unit_dedicate_assert' => ['target' => '3.5'],
+ 'php_unit_dedicate_assert' => ['target' => '5.6'],
'phpdoc_no_empty_return' => false, // triggers almost always false positive
'array_syntax' => ['syntax' => 'short'],
'fopen_flags' => false,
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index 9b8d1a716a9ae..a5b7f6dceb51f 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -153,7 +153,7 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
$this->filesystem->copy($sourceFilePath, $targetFilePath);
- $this->assertTrue(is_dir($targetFileDirectory));
+ $this->assertDirectoryExists($targetFileDirectory);
$this->assertFileExists($targetFilePath);
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
@@ -185,7 +185,7 @@ public function testMkdirCreatesDirectoriesRecursively()
$this->filesystem->mkdir($directory);
- $this->assertTrue(is_dir($directory));
+ $this->assertDirectoryExists($directory);
}
public function testMkdirCreatesDirectoriesFromArray()
@@ -197,9 +197,9 @@ public function testMkdirCreatesDirectoriesFromArray()
$this->filesystem->mkdir($directories);
- $this->assertTrue(is_dir($basePath.'1'));
- $this->assertTrue(is_dir($basePath.'2'));
- $this->assertTrue(is_dir($basePath.'3'));
+ $this->assertDirectoryExists($basePath.'1');
+ $this->assertDirectoryExists($basePath.'2');
+ $this->assertDirectoryExists($basePath.'3');
}
public function testMkdirCreatesDirectoriesFromTraversableObject()
@@ -211,9 +211,9 @@ public function testMkdirCreatesDirectoriesFromTraversableObject()
$this->filesystem->mkdir($directories);
- $this->assertTrue(is_dir($basePath.'1'));
- $this->assertTrue(is_dir($basePath.'2'));
- $this->assertTrue(is_dir($basePath.'3'));
+ $this->assertDirectoryExists($basePath.'1');
+ $this->assertDirectoryExists($basePath.'2');
+ $this->assertDirectoryExists($basePath.'3');
}
public function testMkdirCreatesDirectoriesFails()
@@ -347,7 +347,7 @@ public function testRemoveCleansInvalidLinks()
// create symlink to dir using trailing forward slash
$this->filesystem->symlink($basePath.'dir/', $basePath.'dir-link');
- $this->assertTrue(is_dir($basePath.'dir-link'));
+ $this->assertDirectoryExists($basePath.'dir-link');
// create symlink to nonexistent dir
rmdir($basePath.'dir');
@@ -825,7 +825,7 @@ public function testRemoveSymlink()
$this->assertFalse(is_link($link));
$this->assertFalse(is_file($link));
- $this->assertFalse(is_dir($link));
+ $this->assertDirectoryNotExists($link);
}
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
@@ -1170,8 +1170,8 @@ public function testMirrorCopiesFilesAndDirectoriesRecursively()
$this->filesystem->mirror($sourcePath, $targetPath);
- $this->assertTrue(is_dir($targetPath));
- $this->assertTrue(is_dir($targetPath.'directory'));
+ $this->assertDirectoryExists($targetPath);
+ $this->assertDirectoryExists($targetPath.'directory');
$this->assertFileEquals($file1, $targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1');
$this->assertFileEquals($file2, $targetPath.'file2');
@@ -1204,7 +1204,7 @@ public function testMirrorCreatesEmptyDirectory()
$this->filesystem->mirror($sourcePath, $targetPath);
- $this->assertTrue(is_dir($targetPath));
+ $this->assertDirectoryExists($targetPath);
$this->filesystem->remove($sourcePath);
}
@@ -1223,7 +1223,7 @@ public function testMirrorCopiesLinks()
$this->filesystem->mirror($sourcePath, $targetPath);
- $this->assertTrue(is_dir($targetPath));
+ $this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'file1', $targetPath.'link1');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
}
@@ -1243,7 +1243,7 @@ public function testMirrorCopiesLinkedDirectoryContents()
$this->filesystem->mirror($sourcePath, $targetPath);
- $this->assertTrue(is_dir($targetPath));
+ $this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
}
@@ -1267,7 +1267,7 @@ public function testMirrorCopiesRelativeLinkedContents()
$this->filesystem->mirror($sourcePath, $targetPath);
- $this->assertTrue(is_dir($targetPath));
+ $this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
$this->assertEquals('\\' === \DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.\DIRECTORY_SEPARATOR.'link1'));
@@ -1290,7 +1290,7 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithoutDeleteOptio
chdir($oldPath);
- $this->assertTrue(is_dir($targetPath));
+ $this->assertDirectoryExists($targetPath);
$this->assertFileExists($targetPath.'source');
$this->assertFileExists($targetPath.'target');
}
@@ -1315,7 +1315,7 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption()
chdir($oldPath);
- $this->assertTrue(is_dir($targetPath));
+ $this->assertDirectoryExists($targetPath);
$this->assertFileExists($targetPath.'source');
$this->assertFileNotExists($targetPath.'target');
}
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 348714a2602d5..9daf1a0eeee7a 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
@@ -43,7 +43,7 @@ public function testConstructSavePath($savePath, $expectedSavePath, $path)
{
$handler = new NativeFileSessionHandler($savePath);
$this->assertEquals($expectedSavePath, ini_get('session.save_path'));
- $this->assertTrue(is_dir(realpath($path)));
+ $this->assertDirectoryExists(realpath($path));
rmdir($path);
}
diff --git a/src/Symfony/Component/Intl/Tests/IntlTest.php b/src/Symfony/Component/Intl/Tests/IntlTest.php
index de722baf948f3..d45a1ded5c304 100644
--- a/src/Symfony/Component/Intl/Tests/IntlTest.php
+++ b/src/Symfony/Component/Intl/Tests/IntlTest.php
@@ -61,7 +61,7 @@ public function testGetIcuStubVersionReadsTheVersionOfBundledStubs()
public function testGetDataDirectoryReturnsThePathToIcuData()
{
- $this->assertTrue(is_dir(Intl::getDataDirectory()));
+ $this->assertDirectoryExists(Intl::getDataDirectory());
}
/**
diff --git a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
index 0932d6043380b..0d98392ac2d92 100644
--- a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
+++ b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php
@@ -51,7 +51,7 @@ public function testItClonesTheRepository()
$git = GitRepository::download(self::REPO_URL, $this->targetDir);
$this->assertInstanceOf(GitRepository::class, $git);
- $this->assertTrue(is_dir($this->targetDir.'/.git'));
+ $this->assertDirectoryExists($this->targetDir.'/.git');
$this->assertSame($this->targetDir, $git->getPath());
$this->assertSame(self::REPO_URL, $git->getUrl());
$this->assertRegExp('#^[0-9a-z]{40}$#', $git->getLastCommitHash());
From ceaa1b33d04013716388825c6f7e99781cd8751c Mon Sep 17 00:00:00 2001
From: Roland Franssen
Date: Wed, 31 Jul 2019 19:45:44 +0200
Subject: [PATCH 046/147] [FrameworkBundle] Detect indirect env vars in routing
---
.../Bundle/FrameworkBundle/Routing/Router.php | 4 ++--
.../Tests/Routing/RouterTest.php | 21 +++++++++++++++++--
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
index a846536a40a3d..ebb5e145c4b1a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
@@ -147,7 +147,7 @@ private function resolve($value)
return '%%';
}
- if (preg_match('/^env\(\w+\)$/', $match[1])) {
+ if (preg_match('/^env\((?:\w++:)*+\w++\)$/', $match[1])) {
throw new RuntimeException(sprintf('Using "%%%s%%" is not allowed in routing configuration.', $match[1]));
}
@@ -156,7 +156,7 @@ private function resolve($value)
if (\is_string($resolved) || is_numeric($resolved)) {
$this->collectedParameters[$match[1]] = $resolved;
- return (string) $resolved;
+ return (string) $this->resolve($resolved);
}
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved)));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
index 9fe45527cffe8..024e7e6dd75bd 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
@@ -14,6 +14,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
+use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
@@ -122,13 +123,13 @@ public function testPatternPlaceholders()
$routes->add('foo', new Route('/before/%parameter.foo%/after/%%escaped%%'));
$sc = $this->getServiceContainer($routes);
- $sc->setParameter('parameter.foo', 'foo');
+ $sc->setParameter('parameter.foo', 'foo-%%escaped%%');
$router = new Router($sc, 'foo');
$route = $router->getRouteCollection()->get('foo');
$this->assertEquals(
- '/before/foo/after/%escaped%',
+ '/before/foo-%escaped%/after/%escaped%',
$route->getPath()
);
}
@@ -147,6 +148,22 @@ public function testEnvPlaceholders()
$router->getRouteCollection();
}
+ public function testIndirectEnvPlaceholders()
+ {
+ $routes = new RouteCollection();
+
+ $routes->add('foo', new Route('/%foo%'));
+
+ $router = new Router($container = $this->getServiceContainer($routes), 'foo');
+ $container->setParameter('foo', 'foo-%bar%');
+ $container->setParameter('bar', '%env(string:FOO)%');
+
+ $this->expectException(RuntimeException::class);
+ $this->expectExceptionMessage('Using "%env(string:FOO)%" is not allowed in routing configuration.');
+
+ $router->getRouteCollection();
+ }
+
public function testHostPlaceholders()
{
$routes = new RouteCollection();
From 0c9539fdb47fbd13f2657231b3ac87aa965240c3 Mon Sep 17 00:00:00 2001
From: karser
Date: Fri, 2 Aug 2019 22:29:48 +0300
Subject: [PATCH 047/147] [PhpUnitBridge] fixed PHPUnit 8.3 compatibility:
method handleError was renamed to __invoke
---
.../PhpUnit/DeprecationErrorHandler.php | 40 ++++++++++++++-----
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
index fc60cbd4365be..8b355c31ffc59 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
@@ -11,6 +11,9 @@
namespace Symfony\Bridge\PhpUnit;
+use PHPUnit\Framework\TestResult;
+use PHPUnit\Util\ErrorHandler;
+
/**
* Catch deprecation notices and print a summary report at the end of the test suite.
*
@@ -23,6 +26,7 @@ class DeprecationErrorHandler
const MODE_DISABLED = 'disabled';
private static $isRegistered = false;
+ private static $isAtLeastPhpUnit83;
/**
* Registers and configures the deprecation handler.
@@ -44,6 +48,7 @@ public static function register($mode = 0)
}
$UtilPrefix = class_exists('PHPUnit_Util_ErrorHandler') ? 'PHPUnit_Util_' : 'PHPUnit\Util\\';
+ self::$isAtLeastPhpUnit83 = method_exists('PHPUnit\Util\ErrorHandler', '__invoke');
$getMode = function () use ($mode) {
static $memoizedMode = false;
@@ -106,9 +111,7 @@ public static function register($mode = 0)
);
$deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) {
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) {
- $ErrorHandler = $UtilPrefix.'ErrorHandler';
-
- return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
+ return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
}
$trace = debug_backtrace();
@@ -183,7 +186,7 @@ public static function register($mode = 0)
if (null !== $oldErrorHandler) {
restore_error_handler();
- if (array($UtilPrefix.'ErrorHandler', 'handleError') === $oldErrorHandler) {
+ if ($oldErrorHandler instanceof ErrorHandler || array($UtilPrefix.'ErrorHandler', 'handleError') === $oldErrorHandler) {
restore_error_handler();
self::register($mode);
}
@@ -285,12 +288,8 @@ public static function collectDeprecations($outputFile)
if ($previousErrorHandler) {
return $previousErrorHandler($type, $msg, $file, $line, $context);
}
- static $autoload = true;
- $ErrorHandler = class_exists('PHPUnit_Util_ErrorHandler', $autoload) ? 'PHPUnit_Util_ErrorHandler' : 'PHPUnit\Util\ErrorHandler';
- $autoload = false;
-
- return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
+ return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
}
$deprecations[] = array(error_reporting(), $msg, $file);
});
@@ -300,6 +299,29 @@ public static function collectDeprecations($outputFile)
});
}
+ /**
+ * @internal
+ */
+ public static function getPhpUnitErrorHandler()
+ {
+ if (!self::$isAtLeastPhpUnit83) {
+ return (class_exists('PHPUnit_Util_ErrorHandler', false) ? 'PHPUnit_Util_' : 'PHPUnit\Util\\').'ErrorHandler::handleError';
+ }
+
+ foreach (debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
+ if (isset($frame['object']) && $frame['object'] instanceof TestResult) {
+ return new ErrorHandler(
+ $frame['object']->getConvertDeprecationsToExceptions(),
+ $frame['object']->getConvertErrorsToExceptions(),
+ $frame['object']->getConvertNoticesToExceptions(),
+ $frame['object']->getConvertWarningsToExceptions()
+ );
+ }
+ }
+
+ return function () { return false; };
+ }
+
/**
* Returns true if STDOUT is defined and supports colorization.
*
From b1e160c41e62aec2c496092505763e09e0bc8f15 Mon Sep 17 00:00:00 2001
From: Pierre du Plessis
Date: Mon, 5 Aug 2019 12:19:56 +0200
Subject: [PATCH 048/147] Support DateTimeInterface in
IntlDateFormatter::format
---
.../Component/Intl/DateFormatter/IntlDateFormatter.php | 6 +++---
.../DateFormatter/AbstractIntlDateFormatterTest.php | 9 +++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
index 0f19310f22bff..197a2e3db06f1 100644
--- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
@@ -176,7 +176,7 @@ public static function create($locale, $datetype, $timetype, $timezone = null, $
/**
* Format the date/time value (timestamp) as a string.
*
- * @param int|\DateTime $timestamp The timestamp to format
+ * @param int|\DateTimeInterface $timestamp The timestamp to format
*
* @return string|bool The formatted value or false if formatting failed
*
@@ -195,7 +195,7 @@ public function format($timestamp)
// behave like the intl extension
$argumentError = null;
- if (!\is_int($timestamp) && !$timestamp instanceof \DateTime) {
+ if (!\is_int($timestamp) && !$timestamp instanceof \DateTimeInterface) {
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
}
@@ -207,7 +207,7 @@ public function format($timestamp)
return false;
}
- if ($timestamp instanceof \DateTime) {
+ if ($timestamp instanceof \DateTimeInterface) {
$timestamp = $timestamp->getTimestamp();
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
index e472000974a6f..682380bf54157 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -76,6 +76,7 @@ public function testFormat($pattern, $timestamp, $expected)
public function formatProvider()
{
$dateTime = new \DateTime('@0');
+ $dateTimeImmutable = new \DateTimeImmutable('@0');
$formatData = [
/* general */
@@ -250,6 +251,12 @@ public function formatProvider()
$formatData[] = ['h:mm a', $dateTime, '12:00 AM'];
$formatData[] = ['yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM'];
+ /* general, DateTimeImmutable */
+ $formatData[] = ['y-M-d', $dateTimeImmutable, '1970-1-1'];
+ $formatData[] = ["EEE, MMM d, ''yy", $dateTimeImmutable, "Thu, Jan 1, '70"];
+ $formatData[] = ['h:mm a', $dateTimeImmutable, '12:00 AM'];
+ $formatData[] = ['yyyyy.MMMM.dd hh:mm aaa', $dateTimeImmutable, '01970.January.01 12:00 AM'];
+
if (IcuVersion::compare(Intl::getIcuVersion(), '59.1', '>=', 1)) {
// Before ICU 59.1 GMT was used instead of UTC
$formatData[] = ["yyyy.MM.dd 'at' HH:mm:ss zzz", 0, '1970.01.01 at 00:00:00 UTC'];
@@ -272,6 +279,8 @@ public function testFormatUtcAndGmtAreSplit()
$this->assertSame('1970.01.01 at 00:00:00 GMT', $gmtFormatter->format(new \DateTime('@0')));
$this->assertSame('1970.01.01 at 00:00:00 UTC', $utcFormatter->format(new \DateTime('@0')));
+ $this->assertSame('1970.01.01 at 00:00:00 GMT', $gmtFormatter->format(new \DateTimeImmutable('@0')));
+ $this->assertSame('1970.01.01 at 00:00:00 UTC', $utcFormatter->format(new \DateTimeImmutable('@0')));
}
/**
From 4cd60d61cc116eb5087805215d9b4a204499bfea Mon Sep 17 00:00:00 2001
From: Tobias Schultze
Date: Mon, 5 Aug 2019 14:35:29 +0200
Subject: [PATCH 049/147] [Form] remove leftover int child phpdoc
---
src/Symfony/Component/Form/Button.php | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php
index ed1106b467a21..50acb8db0c6e8 100644
--- a/src/Symfony/Component/Form/Button.php
+++ b/src/Symfony/Component/Form/Button.php
@@ -38,8 +38,6 @@ class Button implements \IteratorAggregate, FormInterface
/**
* Creates a new button from a form configuration.
- *
- * @param FormConfigInterface $config The button's configuration
*/
public function __construct(FormConfigInterface $config)
{
@@ -128,10 +126,6 @@ public function getParent()
*
* This method should not be invoked.
*
- * @param int|string|FormInterface $child
- * @param null $type
- * @param array $options
- *
* @throws BadMethodCallException
*/
public function add($child, $type = null, array $options = [])
From 797ea2e4e21af932671da04f1fad7268bede3296 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Mon, 5 Aug 2019 10:06:54 +0200
Subject: [PATCH 050/147] Use namespaced Phpunit classes
---
.travis.yml | 1 +
.../ResolveInstanceofConditionalsPassTest.php | 4 +--
...ContainerParametersResourceCheckerTest.php | 7 +++---
.../Tests/Resources/TranslationFilesTest.php | 6 +----
...mptyControllerArgumentLocatorsPassTest.php | 2 +-
.../AbstractNumberFormatterTest.php | 25 +++----------------
.../Tests/Resources/TranslationFilesTest.php | 6 +----
.../Tests/Resources/TranslationFilesTest.php | 6 +----
.../Component/Yaml/Tests/ParserTest.php | 4 ---
9 files changed, 15 insertions(+), 46 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1e9ea20b62dea..fc3ff15d0f297 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -209,6 +209,7 @@ install:
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
+ rm -rf .phpunit
fi
- |
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
index 1996216aa6ec4..83be84bd0c37c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
@@ -201,7 +201,7 @@ public function testBadInterfaceForAutomaticInstanceofIsOk()
public function testProcessThrowsExceptionForAutoconfiguredCalls()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
- $this->expectExceptionMessage('Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines method calls but these are not supported and should be removed.');
+ $this->expectExceptionMessageRegExp('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines method calls but these are not supported and should be removed\./');
$container = new ContainerBuilder();
$container->registerForAutoconfiguration(parent::class)
->addMethodCall('setFoo');
@@ -212,7 +212,7 @@ public function testProcessThrowsExceptionForAutoconfiguredCalls()
public function testProcessThrowsExceptionForArguments()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
- $this->expectExceptionMessage('Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines arguments but these are not supported and should be removed.');
+ $this->expectExceptionMessageRegExp('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines arguments but these are not supported and should be removed\./');
$container = new ContainerBuilder();
$container->registerForAutoconfiguration(parent::class)
->addArgument('bar');
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
index eb5fc5a99d2e1..51af451c160c6 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\ResourceCheckerInterface;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
@@ -52,15 +53,15 @@ public function testIsFresh(callable $mockContainer, $expected)
public function isFreshProvider()
{
- yield 'not fresh on missing parameter' => [function (\PHPUnit_Framework_MockObject_MockObject $container) {
+ yield 'not fresh on missing parameter' => [function (MockObject $container) {
$container->method('hasParameter')->with('locales')->willReturn(false);
}, false];
- yield 'not fresh on different value' => [function (\PHPUnit_Framework_MockObject_MockObject $container) {
+ yield 'not fresh on different value' => [function (MockObject $container) {
$container->method('getParameter')->with('locales')->willReturn(['nl', 'es']);
}, false];
- yield 'fresh on every identical parameters' => [function (\PHPUnit_Framework_MockObject_MockObject $container) {
+ yield 'fresh on every identical parameters' => [function (MockObject $container) {
$container->expects($this->exactly(2))->method('hasParameter')->willReturn(true);
$container->expects($this->exactly(2))->method('getParameter')
->withConsecutive(
diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
index d0bc82e759659..49e69ef190268 100644
--- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
@@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase
*/
public function testTranslationFileIsValid($filePath)
{
- if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
- } else {
- \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
- }
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
$this->addToAssertionCount(1);
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php
index 713ab5441abaa..84d73515603ef 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php
@@ -26,7 +26,7 @@ public function testProcess()
$resolver = $container->register('argument_resolver.service')->addArgument([]);
$container->register('stdClass', 'stdClass');
- $container->register(parent::class, 'stdClass');
+ $container->register(TestCase::class, 'stdClass');
$container->register('c1', RemoveTestController1::class)->addTag('controller.service_arguments');
$container->register('c2', RemoveTestController2::class)->addTag('controller.service_arguments')
->addMethodCall('setTestCase', [new Reference('c1')]);
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index 0d382341f5ab5..464a0aac0c7c5 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter;
+use PHPUnit\Framework\Error\Warning;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
@@ -323,13 +324,7 @@ public function formatTypeDoubleWithCurrencyStyleProvider()
*/
public function testFormatTypeCurrency($formatter, $value)
{
- $exceptionCode = 'PHPUnit\Framework\Error\Warning';
-
- if (class_exists('PHPUnit_Framework_Error_Warning')) {
- $exceptionCode = 'PHPUnit_Framework_Error_Warning';
- }
-
- $this->expectException($exceptionCode);
+ $this->expectException(Warning::class);
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
}
@@ -706,13 +701,7 @@ public function parseProvider()
public function testParseTypeDefault()
{
- $exceptionCode = 'PHPUnit\Framework\Error\Warning';
-
- if (class_exists('PHPUnit_Framework_Error_Warning')) {
- $exceptionCode = 'PHPUnit_Framework_Error_Warning';
- }
-
- $this->expectException($exceptionCode);
+ $this->expectException(Warning::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
@@ -832,13 +821,7 @@ public function parseTypeDoubleProvider()
public function testParseTypeCurrency()
{
- $exceptionCode = 'PHPUnit\Framework\Error\Warning';
-
- if (class_exists('PHPUnit_Framework_Error_Warning')) {
- $exceptionCode = 'PHPUnit_Framework_Error_Warning';
- }
-
- $this->expectException($exceptionCode);
+ $this->expectException(Warning::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);
diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
index f4e0d9e6e8f90..bc21d272fc39c 100644
--- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
@@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase
*/
public function testTranslationFileIsValid($filePath)
{
- if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
- } else {
- \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
- }
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
$this->addToAssertionCount(1);
}
diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
index 64b3f78934f1d..56ff24d2fd4bc 100644
--- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
@@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase
*/
public function testTranslationFileIsValid($filePath)
{
- if (class_exists('PHPUnit_Util_XML')) {
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
- } else {
- \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
- }
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
$this->addToAssertionCount(1);
}
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index 8cc95d7bfe57a..a806723025f1b 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -45,10 +45,6 @@ public function testSpecifications($expected, $yaml, $comment, $deprecated)
if (E_USER_DEPRECATED !== $type) {
restore_error_handler();
- if (class_exists('PHPUnit_Util_ErrorHandler')) {
- return \call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', \func_get_args());
- }
-
return \call_user_func_array('PHPUnit\Util\ErrorHandler::handleError', \func_get_args());
}
From b1312781e2c4cc8a81c19f23a795081ca15fddbf Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Mon, 5 Aug 2019 15:40:23 +0200
Subject: [PATCH 051/147] Minor fixes
---
src/Symfony/Component/Finder/Tests/FinderTest.php | 6 +-----
src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php | 2 ++
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php
index 6e580560686ee..442186d2be207 100644
--- a/src/Symfony/Component/Finder/Tests/FinderTest.php
+++ b/src/Symfony/Component/Finder/Tests/FinderTest.php
@@ -703,11 +703,7 @@ public function testAccessDeniedException()
} catch (\Exception $e) {
$expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
- $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
- }
-
- if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
- $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
+ $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
}
$this->assertInstanceOf($expectedExceptionClass, $e);
diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
index de09f1803da85..10d78b244a67b 100644
--- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
+++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
@@ -82,6 +82,8 @@ abstract class AbstractCloner implements ClonerInterface
'Symfony\Component\Debug\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
+ 'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
+ 'PHPUnit\Framework\MockObject\Stub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
From 92bd9ec4b76abf8a90fbe0d226adbc7e5191c53d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Mon, 5 Aug 2019 16:11:35 +0200
Subject: [PATCH 052/147] Use Phpunit FQDN in tests comments
---
.../ChoiceList/DoctrineChoiceLoaderTest.php | 11 +++++-----
.../Tests/Form/Type/EntityTypeTest.php | 3 ++-
.../AnnotationsCacheWarmerTest.php | 3 ++-
.../Tests/Command/CachePruneCommandTest.php | 5 +++--
.../Cache/Tests/Adapter/ChainAdapterTest.php | 7 ++++---
.../Tests/Adapter/TagAwareAdapterTest.php | 7 ++++---
.../Cache/Tests/Simple/ChainCacheTest.php | 7 ++++---
.../ContainerAwareEventDispatcher.php | 3 ++-
.../Tests/ImmutableEventDispatcherTest.php | 3 ++-
.../Component/Form/Tests/AbstractFormTest.php | 7 ++++---
.../Factory/CachingFactoryDecoratorTest.php | 3 ++-
.../Factory/PropertyAccessDecoratorTest.php | 3 ++-
.../Tests/ChoiceList/LazyChoiceListTest.php | 5 +++--
.../Csrf/Type/FormTypeCsrfExtensionTest.php | 5 +++--
.../DataCollectorExtensionTest.php | 3 ++-
.../DataCollector/FormDataCollectorTest.php | 9 ++++----
.../DataCollector/FormDataExtractorTest.php | 5 +++--
.../Type/DataCollectorTypeExtensionTest.php | 3 ++-
.../Component/Form/Tests/FormFactoryTest.php | 9 ++++----
.../Component/Form/Tests/FormRegistryTest.php | 7 ++++---
.../Form/Tests/ResolvedFormTypeTest.php | 21 ++++++++++---------
.../Handler/MongoDbSessionHandlerTest.php | 3 ++-
.../Bundle/Reader/BundleEntryReaderTest.php | 3 ++-
.../Component/Ldap/Tests/LdapClientTest.php | 3 ++-
src/Symfony/Component/Ldap/Tests/LdapTest.php | 3 ++-
.../Lock/Tests/Store/CombinedStoreTest.php | 7 ++++---
.../Tests/Encoder/XmlEncoderTest.php | 3 ++-
.../Normalizer/AbstractNormalizerTest.php | 3 ++-
.../Normalizer/ArrayDenormalizerTest.php | 3 ++-
.../JsonSerializableNormalizerTest.php | 3 ++-
.../Translation/Tests/TranslatorCacheTest.php | 3 ++-
31 files changed, 97 insertions(+), 66 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
index 325ef31e2b933..05657d6e523b3 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
@@ -14,6 +14,7 @@
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\Mapping\ClassMetadata;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
@@ -27,17 +28,17 @@
class DoctrineChoiceLoaderTest extends TestCase
{
/**
- * @var ChoiceListFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ChoiceListFactoryInterface|MockObject
*/
private $factory;
/**
- * @var ObjectManager|\PHPUnit_Framework_MockObject_MockObject
+ * @var ObjectManager|MockObject
*/
private $om;
/**
- * @var ObjectRepository|\PHPUnit_Framework_MockObject_MockObject
+ * @var ObjectRepository|MockObject
*/
private $repository;
@@ -47,12 +48,12 @@ class DoctrineChoiceLoaderTest extends TestCase
private $class;
/**
- * @var IdReader|\PHPUnit_Framework_MockObject_MockObject
+ * @var IdReader|MockObject
*/
private $idReader;
/**
- * @var EntityLoaderInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var EntityLoaderInterface|MockObject
*/
private $objectLoader;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index d6ef1f41d575a..1feabd1a451ca 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -16,6 +16,7 @@
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\SchemaTool;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -53,7 +54,7 @@ class EntityTypeTest extends BaseTypeTest
private $em;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry
+ * @var MockObject|ManagerRegistry
*/
private $emRegistry;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
index 9cc3bfa2d2f91..9a5b40ee36e97 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
@@ -5,6 +5,7 @@
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Annotations\Reader;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -86,7 +87,7 @@ public function testAnnotationsCacheWarmerWithDebugEnabled()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|Reader
+ * @return MockObject|Reader
*/
private function getReadOnlyReader()
{
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php
index 3a603122e0e2e..7ce554b3ed50b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -55,7 +56,7 @@ private function getEmptyRewindableGenerator()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|KernelInterface
+ * @return MockObject|KernelInterface
*/
private function getKernel()
{
@@ -81,7 +82,7 @@ private function getKernel()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableInterface
+ * @return MockObject|PruneableInterface
*/
private function getPruneableInterfaceMock()
{
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
index 5da7fa40174d5..5e48930dd1f93 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ChainAdapter;
@@ -65,7 +66,7 @@ public function testPrune()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
+ * @return MockObject|PruneableCacheInterface
*/
private function getPruneableMock()
{
@@ -82,7 +83,7 @@ private function getPruneableMock()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
+ * @return MockObject|PruneableCacheInterface
*/
private function getFailingPruneableMock()
{
@@ -99,7 +100,7 @@ private function getFailingPruneableMock()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|AdapterInterface
+ * @return MockObject|AdapterInterface
*/
private function getNonPruneableMock()
{
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
index a28624402a40f..5bd2ffc287651 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Adapter;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
@@ -160,7 +161,7 @@ public function testPrune()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
+ * @return MockObject|PruneableCacheInterface
*/
private function getPruneableMock()
{
@@ -177,7 +178,7 @@ private function getPruneableMock()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
+ * @return MockObject|PruneableCacheInterface
*/
private function getFailingPruneableMock()
{
@@ -194,7 +195,7 @@ private function getFailingPruneableMock()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|AdapterInterface
+ * @return MockObject|AdapterInterface
*/
private function getNonPruneableMock()
{
diff --git a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
index bb469fad5bd97..f216bc1f3c38a 100644
--- a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
+++ b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Tests\Simple;
+use PHPUnit\Framework\MockObject\MockObject;
use Psr\SimpleCache\CacheInterface;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Simple\ArrayCache;
@@ -63,7 +64,7 @@ public function testPrune()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
+ * @return MockObject|PruneableCacheInterface
*/
private function getPruneableMock()
{
@@ -80,7 +81,7 @@ private function getPruneableMock()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
+ * @return MockObject|PruneableCacheInterface
*/
private function getFailingPruneableMock()
{
@@ -97,7 +98,7 @@ private function getFailingPruneableMock()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|CacheInterface
+ * @return MockObject|CacheInterface
*/
private function getNonPruneableMock()
{
diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
index aeafd9ec29b44..1b33e1cab3f4e 100644
--- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\EventDispatcher;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -42,7 +43,7 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
$class = \get_class($this);
- if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) {
+ if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) {
$class = get_parent_class($class);
}
if (__CLASS__ !== $class) {
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
index c1ac749b9bc1f..03e0f4e45434a 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\EventDispatcher\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
@@ -21,7 +22,7 @@
class ImmutableEventDispatcherTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $innerDispatcher;
diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
index 00d9e0fbd485e..4dc84e84e28ac 100644
--- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -66,7 +67,7 @@ protected function getBuilder($name = 'name', EventDispatcherInterface $dispatch
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return MockObject
*/
protected function getDataMapper()
{
@@ -74,7 +75,7 @@ protected function getDataMapper()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return MockObject
*/
protected function getDataTransformer()
{
@@ -82,7 +83,7 @@ protected function getDataTransformer()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return MockObject
*/
protected function getFormValidator()
{
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
index 7277d49780d65..b194d65eeea27 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator;
@@ -20,7 +21,7 @@
class CachingFactoryDecoratorTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $decoratedFactory;
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
index 42893696db622..725a09df08a67 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator;
use Symfony\Component\PropertyAccess\PropertyPath;
@@ -21,7 +22,7 @@
class PropertyAccessDecoratorTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $decoratedFactory;
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
index 6854c43ef733f..5888038370b59 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\ChoiceList;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
@@ -26,12 +27,12 @@ class LazyChoiceListTest extends TestCase
private $list;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $loadedList;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $loader;
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
index 665b700479735..232fd52b46614 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Csrf\Type;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\FormBuilderInterface;
@@ -31,12 +32,12 @@ public function buildForm(FormBuilderInterface $builder, array $options)
class FormTypeCsrfExtensionTest extends TypeTestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
protected $tokenManager;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
protected $translator;
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
index 6bdde2d92d33d..d125d463cb504 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension;
@@ -22,7 +23,7 @@ class DataCollectorExtensionTest extends TestCase
private $extension;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dataCollector;
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
index 83d44167d5cf4..16aea8dfc4d5c 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\DataCollector\FormDataCollector;
use Symfony\Component\Form\Form;
@@ -20,7 +21,7 @@
class FormDataCollectorTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dataExtractor;
@@ -30,17 +31,17 @@ class FormDataCollectorTest extends TestCase
private $dataCollector;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dispatcher;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $factory;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dataMapper;
diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
index 860a96abcddfa..7ae1636ca1cb0 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
@@ -35,12 +36,12 @@ class FormDataExtractorTest extends TestCase
private $dataExtractor;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dispatcher;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $factory;
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 35f38fc53aa4e..75f3264da3a95 100644
--- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\DataCollector\Type;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension;
@@ -22,7 +23,7 @@ class DataCollectorTypeExtensionTest extends TestCase
private $extension;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dataCollector;
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
index a1cba0d2dec16..ddd5b4bb72e4a 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormTypeGuesserChain;
@@ -24,22 +25,22 @@
class FormFactoryTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $guesser1;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $guesser2;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $registry;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $builder;
diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
index cdc1ab7799811..d027a564408b6 100644
--- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\FormTypeGuesserChain;
@@ -37,17 +38,17 @@ class FormRegistryTest extends TestCase
private $registry;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|ResolvedFormTypeFactoryInterface
+ * @var MockObject|ResolvedFormTypeFactoryInterface
*/
private $resolvedTypeFactory;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $guesser1;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $guesser2;
diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
index ba078ad1fd119..19b15e0c9fae9 100644
--- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigInterface;
@@ -25,37 +26,37 @@
class ResolvedFormTypeTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dispatcher;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $factory;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $dataMapper;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeInterface
+ * @var MockObject|FormTypeInterface
*/
private $parentType;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeInterface
+ * @var MockObject|FormTypeInterface
*/
private $type;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeExtensionInterface
+ * @var MockObject|FormTypeExtensionInterface
*/
private $extension1;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeExtensionInterface
+ * @var MockObject|FormTypeExtensionInterface
*/
private $extension2;
@@ -359,7 +360,7 @@ public function provideTypeClassBlockPrefixTuples()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return MockObject
*/
private function getMockFormType($typeClass = 'Symfony\Component\Form\AbstractType')
{
@@ -367,7 +368,7 @@ private function getMockFormType($typeClass = 'Symfony\Component\Form\AbstractTy
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return MockObject
*/
private function getMockFormTypeExtension()
{
@@ -375,7 +376,7 @@ private function getMockFormTypeExtension()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return MockObject
*/
private function getMockFormFactory()
{
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 7bc84f8767f7b..f0f43d05b4dc9 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;
@@ -22,7 +23,7 @@
class MongoDbSessionHandlerTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $mongo;
private $storage;
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 883b7ec6e3229..faabdde9311bb 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Exception\ResourceBundleNotFoundException;
@@ -28,7 +29,7 @@ class BundleEntryReaderTest extends TestCase
private $reader;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
private $readerImpl;
diff --git a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
index 95373e92b14e7..07338d3e76426 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Ldap\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
@@ -24,7 +25,7 @@ class LdapClientTest extends LdapTestCase
{
/** @var LdapClient */
private $client;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var MockObject */
private $ldap;
protected function setUp()
diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php
index 1b893c28d955b..42826ab521354 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapTest.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Ldap\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Ldap\Adapter\AdapterInterface;
use Symfony\Component\Ldap\Adapter\ConnectionInterface;
@@ -19,7 +20,7 @@
class LdapTest extends TestCase
{
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var MockObject */
private $adapter;
/** @var Ldap */
diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
index c8645dcc9a47c..7344e000af94a 100644
--- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Store\CombinedStore;
@@ -49,11 +50,11 @@ public function getStore()
return new CombinedStore([new RedisStore($redis)], new UnanimousStrategy());
}
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var MockObject */
private $strategy;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var MockObject */
private $store1;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var MockObject */
private $store2;
/** @var CombinedStore */
private $store;
diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
index a164d517da323..4f83bf3a58790 100644
--- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Serializer\Tests\Encoder;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
@@ -691,7 +692,7 @@ private function createXmlEncoderWithDateTimeNormalizer()
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|NormalizerInterface
+ * @return MockObject|NormalizerInterface
*/
private function createMockDateTimeNormalizer()
{
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
index cce383075a6fe..b9af165a5eac4 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php
@@ -2,6 +2,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
@@ -31,7 +32,7 @@ class AbstractNormalizerTest extends TestCase
private $normalizer;
/**
- * @var ClassMetadataFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ClassMetadataFactoryInterface|MockObject
*/
private $classMetadata;
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
index 132f3c0806350..27bd361d3acb3 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\SerializerInterface;
@@ -23,7 +24,7 @@ class ArrayDenormalizerTest extends TestCase
private $denormalizer;
/**
- * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var SerializerInterface|MockObject
*/
private $serializer;
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
index 520ddc1c4cdaf..a46a4cf995f1e 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -28,7 +29,7 @@ class JsonSerializableNormalizerTest extends TestCase
private $normalizer;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject|SerializerInterface
+ * @var MockObject|SerializerInterface
*/
private $serializer;
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
index 0213e22254782..6b23a9f1e9e2c 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Translation\Tests;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
use Symfony\Component\Translation\Loader\ArrayLoader;
@@ -95,7 +96,7 @@ public function testCatalogueIsReloadedWhenResourcesAreNoLongerFresh()
$catalogue = new MessageCatalogue($locale, []);
$catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded
- /** @var LoaderInterface|\PHPUnit_Framework_MockObject_MockObject $loader */
+ /** @var LoaderInterface|MockObject $loader */
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
$loader
->expects($this->exactly(2))
From 360711ce4e3b83251e7fe9dac958dc4f4246c0b6 Mon Sep 17 00:00:00 2001
From: Valentin Udaltsov
Date: Mon, 5 Aug 2019 13:00:54 +0300
Subject: [PATCH 053/147] [Form] Fix inconsistencies
---
.../Component/Form/ChoiceList/ArrayChoiceList.php | 14 +++++++-------
.../Factory/ChoiceListFactoryInterface.php | 8 ++------
.../Component/Form/ChoiceList/View/ChoiceView.php | 8 ++++----
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
index e7ebc7200bd6c..94c9422eeccae 100644
--- a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
+++ b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
@@ -172,13 +172,13 @@ public function getValuesForChoices(array $choices)
/**
* Flattens an array into the given output variables.
*
- * @param array $choices The array to flatten
- * @param callable $value The callable for generating choice values
- * @param array $choicesByValues The flattened choices indexed by the
- * corresponding values
- * @param array $keysByValues The original keys indexed by the
- * corresponding values
- * @param array $structuredValues The values indexed by the original keys
+ * @param array $choices The array to flatten
+ * @param callable $value The callable for generating choice values
+ * @param array|null $choicesByValues The flattened choices indexed by the
+ * corresponding values
+ * @param array|null $keysByValues The original keys indexed by the
+ * corresponding values
+ * @param array|null $structuredValues The values indexed by the original keys
*
* @internal
*/
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
index 41a22586cc3b0..ac6c3bcfa34d1 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
@@ -32,8 +32,7 @@ interface ChoiceListFactoryInterface
* Null may be passed when the choice list contains the empty value.
*
* @param iterable $choices The choices
- * @param callable|null $value The callable generating the choice
- * values
+ * @param callable|null $value The callable generating the choice values
*
* @return ChoiceListInterface The choice list
*/
@@ -46,9 +45,7 @@ public function createListFromChoices($choices, $value = null);
* The callable receives the choice as only argument.
* Null may be passed when the choice list contains the empty value.
*
- * @param ChoiceLoaderInterface $loader The choice loader
- * @param callable|null $value The callable generating the choice
- * values
+ * @param callable|null $value The callable generating the choice values
*
* @return ChoiceListInterface The choice list
*/
@@ -80,7 +77,6 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
* match the keys of the choices. The values should be arrays of HTML
* attributes that should be added to the respective choice.
*
- * @param ChoiceListInterface $list The choice list
* @param array|callable|null $preferredChoices The preferred choices
* @param callable|null $label The callable generating the
* choice labels
diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php
index 83326a7ac1288..9eb2f7c3cb8b8 100644
--- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php
+++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php
@@ -30,10 +30,10 @@ class ChoiceView
/**
* Creates a new choice view.
*
- * @param mixed $data The original choice
- * @param string $value The view representation of the choice
- * @param string $label The label displayed to humans
- * @param array $attr Additional attributes for the HTML tag
+ * @param mixed $data The original choice
+ * @param string $value The view representation of the choice
+ * @param string|false $label The label displayed to humans; pass false to discard the label
+ * @param array $attr Additional attributes for the HTML tag
*/
public function __construct($data, $value, $label, array $attr = [])
{
From 3a0a901fdb49961020795f5cebc17c05d975ba10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Mon, 5 Aug 2019 23:18:16 +0200
Subject: [PATCH 054/147] Use assertEqualsWithDelta when required
---
.../Component/HttpFoundation/Tests/CookieTest.php | 2 +-
.../NumberFormatter/AbstractNumberFormatterTest.php | 2 +-
.../Component/Stopwatch/Tests/StopwatchEventTest.php | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
index e382182b4d604..38c195df36a11 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
@@ -119,7 +119,7 @@ public function testGetExpiresTimeWithStringValue()
$cookie = new Cookie('foo', 'bar', $value);
$expire = strtotime($value);
- $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date', 1);
+ $this->assertEqualsWithDelta($expire, $cookie->getExpiresTime(), 1, '->getExpiresTime() returns the expire date');
}
public function testGetDomain()
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index 464a0aac0c7c5..9e8499eba963f 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -806,7 +806,7 @@ public function testParseTypeDouble($value, $expectedValue)
{
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
- $this->assertEquals($expectedValue, $parsedValue, '', 0.001);
+ $this->assertEqualsWithDelta($expectedValue, $parsedValue, 0.001);
}
public function parseTypeDoubleProvider()
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
index 1b53694a63adf..86a02b153591f 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
@@ -73,7 +73,7 @@ public function testDuration()
$event->start();
usleep(200000);
$event->stop();
- $this->assertEquals(200, $event->getDuration(), '', self::DELTA);
+ $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
$event = new StopwatchEvent(microtime(true) * 1000);
$event->start();
@@ -83,7 +83,7 @@ public function testDuration()
$event->start();
usleep(100000);
$event->stop();
- $this->assertEquals(200, $event->getDuration(), '', self::DELTA);
+ $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
}
public function testDurationBeforeStop()
@@ -91,7 +91,7 @@ public function testDurationBeforeStop()
$event = new StopwatchEvent(microtime(true) * 1000);
$event->start();
usleep(200000);
- $this->assertEquals(200, $event->getDuration(), '', self::DELTA);
+ $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
$event = new StopwatchEvent(microtime(true) * 1000);
$event->start();
@@ -100,7 +100,7 @@ public function testDurationBeforeStop()
usleep(50000);
$event->start();
usleep(100000);
- $this->assertEquals(100, $event->getDuration(), '', self::DELTA);
+ $this->assertEqualsWithDelta(100, $event->getDuration(), self::DELTA);
}
public function testStopWithoutStart()
@@ -132,7 +132,7 @@ public function testEnsureStopped()
$event->start();
usleep(100000);
$event->ensureStopped();
- $this->assertEquals(300, $event->getDuration(), '', self::DELTA);
+ $this->assertEqualsWithDelta(300, $event->getDuration(), self::DELTA);
}
public function testStartTime()
@@ -149,7 +149,7 @@ public function testStartTime()
$event->start();
usleep(100000);
$event->stop();
- $this->assertEquals(0, $event->getStartTime(), '', self::DELTA);
+ $this->assertEqualsWithDelta(0, $event->getStartTime(), self::DELTA);
}
public function testInvalidOriginThrowsAnException()
From f842e59685cc46a793873907e529c88fa21e2e3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Mon, 5 Aug 2019 23:28:51 +0200
Subject: [PATCH 055/147] Use assert assertContainsEquals when needed
---
.../Compiler/MergeExtensionConfigurationPassTest.php | 2 +-
.../Tests/Extension/Core/Type/CountryTypeTest.php | 10 +++++-----
.../Tests/Extension/Core/Type/CurrencyTypeTest.php | 6 +++---
.../Tests/Extension/Core/Type/LanguageTypeTest.php | 12 ++++++------
.../Tests/Extension/Core/Type/LocaleTypeTest.php | 6 +++---
.../Tests/Extension/Core/Type/TimezoneTypeTest.php | 6 +++---
.../Provider/UserAuthenticationProviderTest.php | 4 ++--
7 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
index dc0a37d601387..13692657bac71 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
@@ -85,7 +85,7 @@ public function testExtensionConfigurationIsTrackedByDefault()
$pass = new MergeExtensionConfigurationPass();
$pass->process($container);
- $this->assertContains(new FileResource(__FILE__), $container->getResources(), '', false, false);
+ $this->assertContainsEquals(new FileResource(__FILE__), $container->getResources());
}
public function testOverriddenEnvsAreMerged()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
index 96fce79f21d33..730cb72f89b49 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
@@ -32,11 +32,11 @@ public function testCountriesAreSelectable()
->createView()->vars['choices'];
// Don't check objects for identity
- $this->assertContains(new ChoiceView('DE', 'DE', 'Germany'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('US', 'US', 'United States'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('FR', 'FR', 'France'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('MY', 'MY', 'Malaysia'), $choices, '', false, false);
+ $this->assertContainsEquals(new ChoiceView('DE', 'DE', 'Germany'), $choices);
+ $this->assertContainsEquals(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices);
+ $this->assertContainsEquals(new ChoiceView('US', 'US', 'United States'), $choices);
+ $this->assertContainsEquals(new ChoiceView('FR', 'FR', 'France'), $choices);
+ $this->assertContainsEquals(new ChoiceView('MY', 'MY', 'Malaysia'), $choices);
}
public function testUnknownCountryIsNotIncluded()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
index ae8c960cc1502..c33865e69384c 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
@@ -31,9 +31,9 @@ public function testCurrenciesAreSelectable()
$choices = $this->factory->create(static::TESTED_TYPE)
->createView()->vars['choices'];
- $this->assertContains(new ChoiceView('EUR', 'EUR', 'Euro'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('USD', 'USD', 'US Dollar'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices, '', false, false);
+ $this->assertContainsEquals(new ChoiceView('EUR', 'EUR', 'Euro'), $choices);
+ $this->assertContainsEquals(new ChoiceView('USD', 'USD', 'US Dollar'), $choices);
+ $this->assertContainsEquals(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices);
}
public function testSubmitNull($expected = null, $norm = null, $view = null)
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index 60614a97177f7..3495f443cc5bf 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -31,11 +31,11 @@ public function testCountriesAreSelectable()
$choices = $this->factory->create(static::TESTED_TYPE)
->createView()->vars['choices'];
- $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('en_US', 'en_US', 'American English'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('fr', 'fr', 'French'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('my', 'my', 'Burmese'), $choices, '', false, false);
+ $this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices);
+ $this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices);
+ $this->assertContainsEquals(new ChoiceView('en_US', 'en_US', 'American English'), $choices);
+ $this->assertContainsEquals(new ChoiceView('fr', 'fr', 'French'), $choices);
+ $this->assertContainsEquals(new ChoiceView('my', 'my', 'Burmese'), $choices);
}
public function testMultipleLanguagesIsNotIncluded()
@@ -43,7 +43,7 @@ public function testMultipleLanguagesIsNotIncluded()
$choices = $this->factory->create(static::TESTED_TYPE, 'language')
->createView()->vars['choices'];
- $this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false);
+ $this->assertNotContainsEquals(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices);
}
public function testSubmitNull($expected = null, $norm = null, $view = null)
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
index 59cdc13547547..fa557854b11f3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
@@ -31,9 +31,9 @@ public function testLocalesAreSelectable()
$choices = $this->factory->create(static::TESTED_TYPE)
->createView()->vars['choices'];
- $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices, '', false, false);
- $this->assertContains(new ChoiceView('zh_Hant_HK', 'zh_Hant_HK', 'Chinese (Traditional, Hong Kong SAR China)'), $choices, '', false, false);
+ $this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices);
+ $this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices);
+ $this->assertContainsEquals(new ChoiceView('zh_Hant_HK', 'zh_Hant_HK', 'Chinese (Traditional, Hong Kong SAR China)'), $choices);
}
public function testSubmitNull($expected = null, $norm = null, $view = null)
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
index 672dd1dc0fed0..c6f634f17ef85 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
@@ -23,10 +23,10 @@ public function testTimezonesAreSelectable()
->createView()->vars['choices'];
$this->assertArrayHasKey('Africa', $choices);
- $this->assertContains(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Kinshasa'), $choices['Africa'], '', false, false);
+ $this->assertContainsEquals(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Kinshasa'), $choices['Africa']);
$this->assertArrayHasKey('America', $choices);
- $this->assertContains(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America'], '', false, false);
+ $this->assertContainsEquals(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America']);
}
public function testSubmitNull($expected = null, $norm = null, $view = null)
@@ -70,6 +70,6 @@ public function testFilterByRegions()
$choices = $this->factory->create(static::TESTED_TYPE, null, ['regions' => \DateTimeZone::EUROPE])
->createView()->vars['choices'];
- $this->assertContains(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Amsterdam'), $choices, '', false, false);
+ $this->assertContainsEquals(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Amsterdam'), $choices);
}
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
index ceea2e0c9d9c5..9329e2441adb2 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
@@ -208,8 +208,8 @@ public function testAuthenticateWithPreservingRoleSwitchUserRole()
$this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $authToken);
$this->assertSame($user, $authToken->getUser());
- $this->assertContains(new Role('ROLE_FOO'), $authToken->getRoles(), '', false, false);
- $this->assertContains($switchUserRole, $authToken->getRoles(), '', false, false);
+ $this->assertContainsEquals(new Role('ROLE_FOO'), $authToken->getRoles());
+ $this->assertContainsEquals($switchUserRole, $authToken->getRoles());
$this->assertEquals('foo', $authToken->getCredentials());
$this->assertEquals(['foo' => 'bar'], $authToken->getAttributes(), '->authenticate() copies token attributes');
}
From 058ef39bae122a23b0537d84d42a495a504abd8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Tue, 6 Aug 2019 00:37:40 +0200
Subject: [PATCH 056/147] Use assertStringContainsString when needed
---
.../Tests/Handler/ConsoleHandlerTest.php | 8 ++---
.../PhpUnit/Tests/CoverageListenerTest.php | 12 +++----
.../Twig/Tests/Command/DebugCommandTest.php | 6 ++--
.../Twig/Tests/Command/LintCommandTest.php | 2 +-
.../Tests/Command/RouterDebugCommandTest.php | 4 +--
.../Tests/Command/RouterMatchCommandTest.php | 6 ++--
.../Command/TranslationDebugCommandTest.php | 2 +-
.../Command/TranslationUpdateCommandTest.php | 2 +-
.../Tests/Command/YamlLintCommandTest.php | 6 ++--
.../Tests/Console/ApplicationTest.php | 10 +++---
.../Controller/ControllerNameParserTest.php | 4 +--
.../Tests/Controller/ControllerTraitTest.php | 24 +++++++-------
.../FrameworkExtensionTest.php | 6 ++--
.../Functional/CachePoolClearCommandTest.php | 18 +++++------
.../Functional/ConfigDebugCommandTest.php | 10 +++---
.../ConfigDumpReferenceCommandTest.php | 6 ++--
.../Functional/ContainerDebugCommandTest.php | 10 +++---
.../Functional/DebugAutowiringCommandTest.php | 10 +++---
.../Tests/Functional/SessionTest.php | 32 +++++++++----------
.../Templating/Loader/TemplateLocatorTest.php | 2 +-
.../Tests/Functional/CsrfFormLoginTest.php | 16 +++++-----
.../Tests/Functional/FormLoginTest.php | 16 +++++-----
.../UserPasswordEncoderCommandTest.php | 30 ++++++++---------
.../Functional/NoTemplatingEntryTest.php | 2 +-
.../Tests/Fixtures/Resource/.hiddenFile | 0
.../Config/Tests/Util/XmlUtilsTest.php | 8 ++---
.../Console/Tests/ApplicationTest.php | 28 ++++++++--------
.../Console/Tests/Command/CommandTest.php | 10 +++---
.../Console/Tests/Command/HelpCommandTest.php | 24 +++++++-------
.../Formatter/OutputFormatterStyleTest.php | 4 +--
.../Console/Tests/Helper/HelperSetTest.php | 2 +-
.../Tests/Helper/QuestionHelperTest.php | 4 +--
.../Helper/SymfonyQuestionHelperTest.php | 2 +-
.../Tests/Exception/FlattenExceptionTest.php | 6 ++--
.../Debug/Tests/ExceptionHandlerTest.php | 14 ++++----
.../Tests/Loader/XmlFileLoaderTest.php | 4 +--
.../EnvPlaceholderParameterBagTest.php | 4 +--
.../Form/Tests/AbstractDivLayoutTest.php | 4 +--
.../Form/Tests/AbstractLayoutTest.php | 10 +++---
.../Form/Tests/AbstractTableLayoutTest.php | 4 +--
.../Form/Tests/Command/DebugCommandTest.php | 6 ++--
.../Tests/BinaryFileResponseTest.php | 2 +-
.../HttpFoundation/Tests/RequestTest.php | 6 ++--
.../HttpFoundation/Tests/ResponseTest.php | 4 +--
.../EventListener/RouterListenerTest.php | 2 +-
.../HttpKernel/Tests/UriSignerTest.php | 6 ++--
.../Process/Tests/PhpProcessTest.php | 4 +--
.../Process/Tests/ProcessBuilderTest.php | 2 +-
.../Yaml/Tests/Command/LintCommandTest.php | 2 +-
.../Component/Yaml/Tests/InlineTest.php | 2 +-
.../Component/Yaml/Tests/ParserTest.php | 2 +-
51 files changed, 205 insertions(+), 205 deletions(-)
delete mode 100644 src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile
diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
index 45a32dea84da4..6cb65f753014f 100644
--- a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
+++ b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
@@ -197,12 +197,12 @@ public function testLogsFromListeners()
$event = new ConsoleCommandEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output);
$dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
- $this->assertContains('Before command message.', $out = $output->fetch());
- $this->assertContains('After command message.', $out);
+ $this->assertStringContainsString('Before command message.', $out = $output->fetch());
+ $this->assertStringContainsString('After command message.', $out);
$event = new ConsoleTerminateEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output, 0);
$dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
- $this->assertContains('Before terminate message.', $out = $output->fetch());
- $this->assertContains('After terminate message.', $out);
+ $this->assertStringContainsString('Before terminate message.', $out = $output->fetch());
+ $this->assertStringContainsString('After terminate message.', $out);
}
}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
index 6674feb94a88e..d69aee7037607 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
@@ -33,14 +33,14 @@ public function test()
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output);
$output = implode("\n", $output);
- $this->assertContains('FooCov', $output);
+ $this->assertStringContainsString('FooCov', $output);
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output);
$output = implode("\n", $output);
- $this->assertNotContains('FooCov', $output);
- $this->assertContains("SutNotFoundTest::test\nCould not find the tested class.", $output);
- $this->assertNotContains("CoversTest::test\nCould not find the tested class.", $output);
- $this->assertNotContains("CoversDefaultClassTest::test\nCould not find the tested class.", $output);
- $this->assertNotContains("CoversNothingTest::test\nCould not find the tested class.", $output);
+ $this->assertStringNotContainsString('FooCov', $output);
+ $this->assertStringContainsString("SutNotFoundTest::test\nCould not find the tested class.", $output);
+ $this->assertStringNotContainsString("CoversTest::test\nCould not find the tested class.", $output);
+ $this->assertStringNotContainsString("CoversDefaultClassTest::test\nCould not find the tested class.", $output);
+ $this->assertStringNotContainsString("CoversNothingTest::test\nCould not find the tested class.", $output);
}
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
index 2f4cc9cd870f7..7eb96018a355b 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
@@ -26,7 +26,7 @@ public function testDebugCommand()
$ret = $tester->execute([], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Functions', trim($tester->getDisplay()));
+ $this->assertStringContainsString('Functions', trim($tester->getDisplay()));
}
public function testLineSeparatorInLoaderPaths()
@@ -59,7 +59,7 @@ public function testLineSeparatorInLoaderPaths()
TXT;
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains($loaderPaths, trim($tester->getDisplay(true)));
+ $this->assertStringContainsString($loaderPaths, trim($tester->getDisplay(true)));
}
public function testWithGlobals()
@@ -70,7 +70,7 @@ public function testWithGlobals()
$display = $tester->getDisplay();
- $this->assertContains(json_encode($message), $display);
+ $this->assertStringContainsString(json_encode($message), $display);
}
public function testWithGlobalsJson()
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
index 5a698221bd9a0..db10ccb6c0904 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
@@ -31,7 +31,7 @@ public function testLintCorrectFile()
$ret = $tester->execute(['filename' => [$filename]], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('OK in', trim($tester->getDisplay()));
+ $this->assertStringContainsString('OK in', trim($tester->getDisplay()));
}
public function testLintIncorrectFile()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
index aa6229c5355ea..a4842f239aa05 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
@@ -27,7 +27,7 @@ public function testDebugAllRoutes()
$ret = $tester->execute(['name' => null], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Name Method Scheme Host Path', $tester->getDisplay());
+ $this->assertStringContainsString('Name Method Scheme Host Path', $tester->getDisplay());
}
public function testDebugSingleRoute()
@@ -36,7 +36,7 @@ public function testDebugSingleRoute()
$ret = $tester->execute(['name' => 'foo'], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Route Name | foo', $tester->getDisplay());
+ $this->assertStringContainsString('Route Name | foo', $tester->getDisplay());
}
public function testDebugInvalidRoute()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
index e0bc2de0eb9f4..b4748dde0d23a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
@@ -29,7 +29,7 @@ public function testWithMatchPath()
$ret = $tester->execute(['path_info' => '/foo', 'foo'], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Route Name | foo', $tester->getDisplay());
+ $this->assertStringContainsString('Route Name | foo', $tester->getDisplay());
}
public function testWithNotMatchPath()
@@ -38,7 +38,7 @@ public function testWithNotMatchPath()
$ret = $tester->execute(['path_info' => '/test', 'foo'], ['decorated' => false]);
$this->assertEquals(1, $ret, 'Returns 1 in case of failure');
- $this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
+ $this->assertStringContainsString('None of the routes match the path "/test"', $tester->getDisplay());
}
/**
@@ -56,7 +56,7 @@ public function testLegacyMatchCommand()
$tester->execute(['path_info' => '/']);
- $this->assertContains('None of the routes match the path "/"', $tester->getDisplay());
+ $this->assertStringContainsString('None of the routes match the path "/"', $tester->getDisplay());
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index a93906e15b106..b3e849b134743 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -239,7 +239,7 @@ public function testLegacyDebugCommand()
$tester = new CommandTester($application->find('debug:translation'));
$tester->execute(['locale' => 'en']);
- $this->assertContains('No defined or extracted', $tester->getDisplay());
+ $this->assertStringContainsString('No defined or extracted', $tester->getDisplay());
}
private function getBundle($path)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index 7e487ff527113..8483f0f0da750 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -231,7 +231,7 @@ public function testLegacyUpdateCommand()
$tester = new CommandTester($application->find('translation:update'));
$tester->execute(['locale' => 'en']);
- $this->assertContains('You must choose one of --force or --dump-messages', $tester->getDisplay());
+ $this->assertStringContainsString('You must choose one of --force or --dump-messages', $tester->getDisplay());
}
private function getBundle($path)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
index cb6595bf1f296..410ab4f90c8fc 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
@@ -41,7 +41,7 @@ public function testLintCorrectFile()
);
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
- $this->assertContains('OK', trim($tester->getDisplay()));
+ $this->assertStringContainsString('OK', trim($tester->getDisplay()));
}
public function testLintIncorrectFile()
@@ -55,7 +55,7 @@ public function testLintIncorrectFile()
$tester->execute(['filename' => $filename], ['decorated' => false]);
$this->assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error');
- $this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
+ $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
}
public function testLintFileNotReadable()
@@ -106,7 +106,7 @@ public function testLintFilesFromBundleDirectory()
);
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
- $this->assertContains('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
+ $this->assertStringContainsString('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php
index fbc5a77339311..50f9478cd2599 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php
@@ -160,9 +160,9 @@ public function testRunOnlyWarnsOnUnregistrableCommand()
$output = $tester->getDisplay();
$this->assertSame(0, $tester->getStatusCode());
- $this->assertContains('Some commands could not be registered:', $output);
- $this->assertContains('throwing', $output);
- $this->assertContains('fine', $output);
+ $this->assertStringContainsString('Some commands could not be registered:', $output);
+ $this->assertStringContainsString('throwing', $output);
+ $this->assertStringContainsString('fine', $output);
}
public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
@@ -188,8 +188,8 @@ public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
$output = $tester->getDisplay();
$this->assertSame(1, $tester->getStatusCode());
- $this->assertContains('Some commands could not be registered:', $output);
- $this->assertContains('Command "fine" is not defined.', $output);
+ $this->assertStringContainsString('Some commands could not be registered:', $output);
+ $this->assertStringContainsString('Command "fine" is not defined.', $output);
}
private function getKernel(array $bundles, $useDispatcher = false)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
index 91a72821e9539..3d4a503f28a47 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
@@ -127,9 +127,9 @@ public function testInvalidBundleName($bundleName, $suggestedBundleName)
if (false === $suggestedBundleName) {
// make sure we don't have a suggestion
- $this->assertNotContains('Did you mean', $e->getMessage());
+ $this->assertStringNotContainsString('Did you mean', $e->getMessage());
} else {
- $this->assertContains(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage());
+ $this->assertStringContainsString(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage());
}
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
index 030b31f0d00a0..befbfbcd94a51 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
@@ -186,8 +186,8 @@ public function testFile()
if ($response->headers->get('content-type')) {
$this->assertSame('text/x-php', $response->headers->get('content-type'));
}
- $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
- $this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
}
public function testFileAsInline()
@@ -202,8 +202,8 @@ public function testFileAsInline()
if ($response->headers->get('content-type')) {
$this->assertSame('text/x-php', $response->headers->get('content-type'));
}
- $this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
- $this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
}
public function testFileWithOwnFileName()
@@ -219,8 +219,8 @@ public function testFileWithOwnFileName()
if ($response->headers->get('content-type')) {
$this->assertSame('text/x-php', $response->headers->get('content-type'));
}
- $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
- $this->assertContains($fileName, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString($fileName, $response->headers->get('content-disposition'));
}
public function testFileWithOwnFileNameAsInline()
@@ -236,8 +236,8 @@ public function testFileWithOwnFileNameAsInline()
if ($response->headers->get('content-type')) {
$this->assertSame('text/x-php', $response->headers->get('content-type'));
}
- $this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
- $this->assertContains($fileName, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString($fileName, $response->headers->get('content-disposition'));
}
public function testFileFromPath()
@@ -252,8 +252,8 @@ public function testFileFromPath()
if ($response->headers->get('content-type')) {
$this->assertSame('text/x-php', $response->headers->get('content-type'));
}
- $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
- $this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
}
public function testFileFromPathWithCustomizedFileName()
@@ -268,8 +268,8 @@ public function testFileFromPathWithCustomizedFileName()
if ($response->headers->get('content-type')) {
$this->assertSame('text/x-php', $response->headers->get('content-type'));
}
- $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
- $this->assertContains('test.php', $response->headers->get('content-disposition'));
+ $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
+ $this->assertStringContainsString('test.php', $response->headers->get('content-disposition'));
}
public function testFileWhichDoesNotExist()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 7ff16746fd64a..ca47e33a629cc 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -824,9 +824,9 @@ public function testValidationMapping()
$this->assertSame('addYamlMappings', $calls[4][0]);
$this->assertCount(3, $calls[4][1][0]);
- $this->assertContains('foo.yml', $calls[4][1][0][0]);
- $this->assertContains('validation.yml', $calls[4][1][0][1]);
- $this->assertContains('validation.yaml', $calls[4][1][0][2]);
+ $this->assertStringContainsString('foo.yml', $calls[4][1][0][0]);
+ $this->assertStringContainsString('validation.yml', $calls[4][1][0][1]);
+ $this->assertStringContainsString('validation.yaml', $calls[4][1][0][2]);
}
public function testFormsCanBeEnabledWithoutCsrfProtection()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
index bb33f5436e12c..8a0f6593d9abc 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
@@ -31,8 +31,8 @@ public function testClearPrivatePool()
$tester->execute(['pools' => ['cache.private_pool']], ['decorated' => false]);
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
- $this->assertContains('Clearing cache pool: cache.private_pool', $tester->getDisplay());
- $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
+ $this->assertStringContainsString('Clearing cache pool: cache.private_pool', $tester->getDisplay());
+ $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
}
public function testClearPublicPool()
@@ -41,8 +41,8 @@ public function testClearPublicPool()
$tester->execute(['pools' => ['cache.public_pool']], ['decorated' => false]);
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
- $this->assertContains('Clearing cache pool: cache.public_pool', $tester->getDisplay());
- $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
+ $this->assertStringContainsString('Clearing cache pool: cache.public_pool', $tester->getDisplay());
+ $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
}
public function testClearPoolWithCustomClearer()
@@ -51,8 +51,8 @@ public function testClearPoolWithCustomClearer()
$tester->execute(['pools' => ['cache.pool_with_clearer']], ['decorated' => false]);
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
- $this->assertContains('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay());
- $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
+ $this->assertStringContainsString('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay());
+ $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
}
public function testCallClearer()
@@ -61,8 +61,8 @@ public function testCallClearer()
$tester->execute(['pools' => ['cache.app_clearer']], ['decorated' => false]);
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
- $this->assertContains('Calling cache clearer: cache.app_clearer', $tester->getDisplay());
- $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
+ $this->assertStringContainsString('Calling cache clearer: cache.app_clearer', $tester->getDisplay());
+ $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
}
public function testClearUnexistingPool()
@@ -86,7 +86,7 @@ public function testLegacyClearCommand()
$tester->execute(['pools' => []]);
- $this->assertContains('Cache was successfully cleared', $tester->getDisplay());
+ $this->assertStringContainsString('Cache was successfully cleared', $tester->getDisplay());
}
private function createCommandTester()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
index c10750eaa9352..a2e88f0039443 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
@@ -36,7 +36,7 @@ public function testDumpBundleName()
$ret = $tester->execute(['name' => 'TestBundle']);
$this->assertSame(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('custom: foo', $tester->getDisplay());
+ $this->assertStringContainsString('custom: foo', $tester->getDisplay());
}
public function testDumpBundleOption()
@@ -45,7 +45,7 @@ public function testDumpBundleOption()
$ret = $tester->execute(['name' => 'TestBundle', 'path' => 'custom']);
$this->assertSame(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('foo', $tester->getDisplay());
+ $this->assertStringContainsString('foo', $tester->getDisplay());
}
public function testParametersValuesAreResolved()
@@ -54,8 +54,8 @@ public function testParametersValuesAreResolved()
$ret = $tester->execute(['name' => 'framework']);
$this->assertSame(0, $ret, 'Returns 0 in case of success');
- $this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay());
- $this->assertContains('secret: test', $tester->getDisplay());
+ $this->assertStringContainsString("locale: '%env(LOCALE)%'", $tester->getDisplay());
+ $this->assertStringContainsString('secret: test', $tester->getDisplay());
}
public function testDumpUndefinedBundleOption()
@@ -63,7 +63,7 @@ public function testDumpUndefinedBundleOption()
$tester = $this->createCommandTester();
$tester->execute(['name' => 'TestBundle', 'path' => 'foo']);
- $this->assertContains('Unable to find configuration for "test.foo"', $tester->getDisplay());
+ $this->assertStringContainsString('Unable to find configuration for "test.foo"', $tester->getDisplay());
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
index b8ac6645f6fac..aa5dba65c0ff8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
@@ -36,8 +36,8 @@ public function testDumpBundleName()
$ret = $tester->execute(['name' => 'TestBundle']);
$this->assertSame(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('test:', $tester->getDisplay());
- $this->assertContains(' custom:', $tester->getDisplay());
+ $this->assertStringContainsString('test:', $tester->getDisplay());
+ $this->assertStringContainsString(' custom:', $tester->getDisplay());
}
public function testDumpAtPath()
@@ -70,7 +70,7 @@ public function testDumpAtPathXml()
]);
$this->assertSame(1, $ret);
- $this->assertContains('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay());
+ $this->assertStringContainsString('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay());
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php
index 21f33df0c8a22..6f936c7968679 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php
@@ -44,7 +44,7 @@ public function testNoDebug()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:container']);
- $this->assertContains('public', $tester->getDisplay());
+ $this->assertStringContainsString('public', $tester->getDisplay());
}
public function testPrivateAlias()
@@ -56,11 +56,11 @@ public function testPrivateAlias()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:container', '--show-private' => true]);
- $this->assertContains('public', $tester->getDisplay());
- $this->assertContains('private_alias', $tester->getDisplay());
+ $this->assertStringContainsString('public', $tester->getDisplay());
+ $this->assertStringContainsString('private_alias', $tester->getDisplay());
$tester->run(['command' => 'debug:container']);
- $this->assertContains('public', $tester->getDisplay());
- $this->assertNotContains('private_alias', $tester->getDisplay());
+ $this->assertStringContainsString('public', $tester->getDisplay());
+ $this->assertStringNotContainsString('private_alias', $tester->getDisplay());
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php
index 8e55eb5d84599..6d163b7838948 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php
@@ -29,8 +29,8 @@ public function testBasicFunctionality()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:autowiring']);
- $this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
- $this->assertContains('alias to http_kernel', $tester->getDisplay());
+ $this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
+ $this->assertStringContainsString('alias to http_kernel', $tester->getDisplay());
}
public function testSearchArgument()
@@ -43,8 +43,8 @@ public function testSearchArgument()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:autowiring', 'search' => 'kern']);
- $this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
- $this->assertNotContains('Symfony\Component\Routing\RouterInterface', $tester->getDisplay());
+ $this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
+ $this->assertStringNotContainsString('Symfony\Component\Routing\RouterInterface', $tester->getDisplay());
}
public function testSearchNoResults()
@@ -57,7 +57,7 @@ public function testSearchNoResults()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:autowiring', 'search' => 'foo_fake'], ['capture_stderr_separately' => true]);
- $this->assertContains('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput());
+ $this->assertStringContainsString('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput());
$this->assertEquals(1, $tester->getStatusCode());
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php
index 0fa8a09b4b229..c99b5e073e49a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php
@@ -27,23 +27,23 @@ public function testWelcome($config, $insulate)
// no session
$crawler = $client->request('GET', '/session');
- $this->assertContains('You are new here and gave no name.', $crawler->text());
+ $this->assertStringContainsString('You are new here and gave no name.', $crawler->text());
// remember name
$crawler = $client->request('GET', '/session/drak');
- $this->assertContains('Hello drak, nice to meet you.', $crawler->text());
+ $this->assertStringContainsString('Hello drak, nice to meet you.', $crawler->text());
// prove remembered name
$crawler = $client->request('GET', '/session');
- $this->assertContains('Welcome back drak, nice to meet you.', $crawler->text());
+ $this->assertStringContainsString('Welcome back drak, nice to meet you.', $crawler->text());
// clear session
$crawler = $client->request('GET', '/session_logout');
- $this->assertContains('Session cleared.', $crawler->text());
+ $this->assertStringContainsString('Session cleared.', $crawler->text());
// prove cleared session
$crawler = $client->request('GET', '/session');
- $this->assertContains('You are new here and gave no name.', $crawler->text());
+ $this->assertStringContainsString('You are new here and gave no name.', $crawler->text());
}
/**
@@ -62,11 +62,11 @@ public function testFlash($config, $insulate)
$crawler = $client->request('GET', '/session_setflash/Hello%20world.');
// check flash displays on redirect
- $this->assertContains('Hello world.', $client->followRedirect()->text());
+ $this->assertStringContainsString('Hello world.', $client->followRedirect()->text());
// check flash is gone
$crawler = $client->request('GET', '/session_showflash');
- $this->assertContains('No flash was set.', $crawler->text());
+ $this->assertStringContainsString('No flash was set.', $crawler->text());
}
/**
@@ -91,39 +91,39 @@ public function testTwoClients($config, $insulate)
// new session, so no name set.
$crawler1 = $client1->request('GET', '/session');
- $this->assertContains('You are new here and gave no name.', $crawler1->text());
+ $this->assertStringContainsString('You are new here and gave no name.', $crawler1->text());
// set name of client1
$crawler1 = $client1->request('GET', '/session/client1');
- $this->assertContains('Hello client1, nice to meet you.', $crawler1->text());
+ $this->assertStringContainsString('Hello client1, nice to meet you.', $crawler1->text());
// no session for client2
$crawler2 = $client2->request('GET', '/session');
- $this->assertContains('You are new here and gave no name.', $crawler2->text());
+ $this->assertStringContainsString('You are new here and gave no name.', $crawler2->text());
// remember name client2
$crawler2 = $client2->request('GET', '/session/client2');
- $this->assertContains('Hello client2, nice to meet you.', $crawler2->text());
+ $this->assertStringContainsString('Hello client2, nice to meet you.', $crawler2->text());
// prove remembered name of client1
$crawler1 = $client1->request('GET', '/session');
- $this->assertContains('Welcome back client1, nice to meet you.', $crawler1->text());
+ $this->assertStringContainsString('Welcome back client1, nice to meet you.', $crawler1->text());
// prove remembered name of client2
$crawler2 = $client2->request('GET', '/session');
- $this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text());
+ $this->assertStringContainsString('Welcome back client2, nice to meet you.', $crawler2->text());
// clear client1
$crawler1 = $client1->request('GET', '/session_logout');
- $this->assertContains('Session cleared.', $crawler1->text());
+ $this->assertStringContainsString('Session cleared.', $crawler1->text());
// prove client1 data is cleared
$crawler1 = $client1->request('GET', '/session');
- $this->assertContains('You are new here and gave no name.', $crawler1->text());
+ $this->assertStringContainsString('You are new here and gave no name.', $crawler1->text());
// prove remembered name of client2 remains untouched.
$crawler2 = $client2->request('GET', '/session');
- $this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text());
+ $this->assertStringContainsString('Welcome back client2, nice to meet you.', $crawler2->text());
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
index 93a3d8d5e1020..b19ce0d27027d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
@@ -69,7 +69,7 @@ public function testThrowsExceptionWhenTemplateNotFound()
$locator->locate($template);
$this->fail('->locate() should throw an exception when the file is not found.');
} catch (\InvalidArgumentException $e) {
- $this->assertContains(
+ $this->assertStringContainsString(
$errorMessage,
$e->getMessage(),
'TemplateLocator exception should propagate the FileLocator exception message'
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php
index a701c8e4ea1b0..dc2aeaec50541 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php
@@ -30,12 +30,12 @@ public function testFormLoginAndLogoutWithCsrfTokens($config)
$crawler = $client->followRedirect();
$text = $crawler->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/profile".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/profile".', $text);
$logoutLinks = $crawler->selectLink('Log out')->links();
$this->assertCount(2, $logoutLinks);
- $this->assertContains('_csrf_token=', $logoutLinks[0]->getUri());
+ $this->assertStringContainsString('_csrf_token=', $logoutLinks[0]->getUri());
$this->assertSame($logoutLinks[0]->getUri(), $logoutLinks[1]->getUri());
$client->click($logoutLinks[0]);
@@ -57,7 +57,7 @@ public function testFormLoginWithInvalidCsrfToken($config)
$this->assertRedirect($client->getResponse(), '/login');
$text = $client->followRedirect()->text();
- $this->assertContains('Invalid CSRF token.', $text);
+ $this->assertStringContainsString('Invalid CSRF token.', $text);
}
/**
@@ -76,8 +76,8 @@ public function testFormLoginWithCustomTargetPath($config)
$this->assertRedirect($client->getResponse(), '/foo');
$text = $client->followRedirect()->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/foo".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/foo".', $text);
}
/**
@@ -97,8 +97,8 @@ public function testFormLoginRedirectsToProtectedResourceAfterLogin($config)
$this->assertRedirect($client->getResponse(), '/protected-resource');
$text = $client->followRedirect()->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/protected-resource".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/protected-resource".', $text);
}
public function getConfigs()
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php
index af932a3ce42b3..1959d05576014 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php
@@ -28,8 +28,8 @@ public function testFormLogin($config)
$this->assertRedirect($client->getResponse(), '/profile');
$text = $client->followRedirect()->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/profile".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/profile".', $text);
}
/**
@@ -49,8 +49,8 @@ public function testFormLogout($config)
$crawler = $client->followRedirect();
$text = $crawler->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/profile".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/profile".', $text);
$logoutLinks = $crawler->selectLink('Log out')->links();
$this->assertCount(6, $logoutLinks);
@@ -81,8 +81,8 @@ public function testFormLoginWithCustomTargetPath($config)
$this->assertRedirect($client->getResponse(), '/foo');
$text = $client->followRedirect()->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/foo".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/foo".', $text);
}
/**
@@ -102,8 +102,8 @@ public function testFormLoginRedirectsToProtectedResourceAfterLogin($config)
$this->assertRedirect($client->getResponse(), '/protected_resource');
$text = $client->followRedirect()->text();
- $this->assertContains('Hello johannes!', $text);
- $this->assertContains('You\'re browsing to path "/protected_resource".', $text);
+ $this->assertStringContainsString('Hello johannes!', $text);
+ $this->assertStringContainsString('You\'re browsing to path "/protected_resource".', $text);
}
public function getConfigs()
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
index 8c327ad267af2..be643c3c344f2 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
@@ -49,7 +49,7 @@ public function testEncodeNoPasswordNoInteraction()
'command' => 'security:encode-password',
], ['interactive' => false]);
- $this->assertContains('[ERROR] The password must not be empty.', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString('[ERROR] The password must not be empty.', $this->passwordEncoderCommandTester->getDisplay());
$this->assertEquals($statusCode, 1);
}
@@ -62,7 +62,7 @@ public function testEncodePasswordBcrypt()
], ['interactive' => false]);
$output = $this->passwordEncoderCommandTester->getDisplay();
- $this->assertContains('Password encoding succeeded', $output);
+ $this->assertStringContainsString('Password encoding succeeded', $output);
$encoder = new BCryptPasswordEncoder(17);
preg_match('# Encoded password\s{1,}([\w+\/$.]+={0,2})\s+#', $output, $matches);
@@ -83,7 +83,7 @@ public function testEncodePasswordArgon2i()
], ['interactive' => false]);
$output = $this->passwordEncoderCommandTester->getDisplay();
- $this->assertContains('Password encoding succeeded', $output);
+ $this->assertStringContainsString('Password encoding succeeded', $output);
$encoder = new Argon2iPasswordEncoder();
preg_match('# Encoded password\s+(\$argon2id?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches);
@@ -100,7 +100,7 @@ public function testEncodePasswordPbkdf2()
], ['interactive' => false]);
$output = $this->passwordEncoderCommandTester->getDisplay();
- $this->assertContains('Password encoding succeeded', $output);
+ $this->assertStringContainsString('Password encoding succeeded', $output);
$encoder = new Pbkdf2PasswordEncoder('sha512', true, 1000);
preg_match('# Encoded password\s{1,}([\w+\/]+={0,2})\s+#', $output, $matches);
@@ -119,9 +119,9 @@ public function testEncodePasswordOutput()
], ['interactive' => false]
);
- $this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
- $this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());
- $this->assertContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
}
public function testEncodePasswordEmptySaltOutput()
@@ -133,9 +133,9 @@ public function testEncodePasswordEmptySaltOutput()
'--empty-salt' => true,
]);
- $this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
- $this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());
- $this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
}
public function testEncodePasswordBcryptOutput()
@@ -146,7 +146,7 @@ public function testEncodePasswordBcryptOutput()
'user-class' => 'Custom\Class\Bcrypt\User',
], ['interactive' => false]);
- $this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
}
public function testEncodePasswordArgon2iOutput()
@@ -162,7 +162,7 @@ public function testEncodePasswordArgon2iOutput()
'user-class' => 'Custom\Class\Argon2i\User',
], ['interactive' => false]);
- $this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
}
public function testEncodePasswordNoConfigForGivenUserClass()
@@ -185,7 +185,7 @@ public function testEncodePasswordAsksNonProvidedUserClass()
'password' => 'password',
], ['decorated' => false]);
- $this->assertContains(<<assertStringContainsString(<< 'password',
], ['interactive' => false]);
- $this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $this->passwordEncoderCommandTester->getDisplay());
+ $this->assertStringContainsString('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $this->passwordEncoderCommandTester->getDisplay());
}
public function testThrowsExceptionOnNoConfiguredEncoders()
@@ -240,7 +240,7 @@ public function testLegacy()
'password' => 'password',
], ['interactive' => false]);
- $this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $tester->getDisplay());
+ $this->assertStringContainsString('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $tester->getDisplay());
}
protected function setUp()
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
index dddfff76efcb7..3d509c44ecf73 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php
@@ -27,7 +27,7 @@ public function test()
$container = $kernel->getContainer();
$content = $container->get('twig')->render('index.html.twig');
- $this->assertContains('{ a: b }', $content);
+ $this->assertStringContainsString('{ a: b }', $content);
}
protected function setUp()
diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile b/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
index 0c9cbc35f6659..4653c8d7c776c 100644
--- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
+++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
@@ -24,28 +24,28 @@ public function testLoadFile()
XmlUtils::loadFile($fixtures.'invalid.xml');
$this->fail();
} catch (\InvalidArgumentException $e) {
- $this->assertContains('ERROR 77', $e->getMessage());
+ $this->assertStringContainsString('ERROR 77', $e->getMessage());
}
try {
XmlUtils::loadFile($fixtures.'document_type.xml');
$this->fail();
} catch (\InvalidArgumentException $e) {
- $this->assertContains('Document types are not allowed', $e->getMessage());
+ $this->assertStringContainsString('Document types are not allowed', $e->getMessage());
}
try {
XmlUtils::loadFile($fixtures.'invalid_schema.xml', $fixtures.'schema.xsd');
$this->fail();
} catch (\InvalidArgumentException $e) {
- $this->assertContains('ERROR 1845', $e->getMessage());
+ $this->assertStringContainsString('ERROR 1845', $e->getMessage());
}
try {
XmlUtils::loadFile($fixtures.'invalid_schema.xml', 'invalid_callback_or_file');
$this->fail();
} catch (\InvalidArgumentException $e) {
- $this->assertContains('XSD file or callable', $e->getMessage());
+ $this->assertStringContainsString('XSD file or callable', $e->getMessage());
}
$mock = $this->getMockBuilder(__NAMESPACE__.'\Validator')->getMock();
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 15ecf8e821616..59ca5d9e153b0 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -183,7 +183,7 @@ public function testRegisterAmbiguous()
$tester = new ApplicationTester($application);
$tester->run(['test']);
- $this->assertContains('It works!', $tester->getDisplay(true));
+ $this->assertStringContainsString('It works!', $tester->getDisplay(true));
}
public function testAdd()
@@ -705,7 +705,7 @@ public function testRenderException()
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exception');
$tester->run(['command' => 'foo'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE, 'capture_stderr_separately' => true]);
- $this->assertContains('Exception trace', $tester->getErrorOutput(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose');
+ $this->assertStringContainsString('Exception trace', $tester->getErrorOutput(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose');
$tester->run(['command' => 'list', '--foo' => true], ['decorated' => false, 'capture_stderr_separately' => true]);
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getErrorOutput(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
@@ -806,7 +806,7 @@ public function testRenderExceptionStackTraceContainsRootException()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'foo'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
- $this->assertContains(sprintf('() at %s:', __FILE__), $tester->getDisplay());
+ $this->assertStringContainsString(sprintf('() at %s:', __FILE__), $tester->getDisplay());
}
public function testRun()
@@ -1231,7 +1231,7 @@ public function testRunDispatchesAllEventsWithException()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'foo']);
- $this->assertContains('before.foo.error.after.', $tester->getDisplay());
+ $this->assertStringContainsString('before.foo.error.after.', $tester->getDisplay());
}
public function testRunDispatchesAllEventsWithExceptionInListener()
@@ -1251,7 +1251,7 @@ public function testRunDispatchesAllEventsWithExceptionInListener()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'foo']);
- $this->assertContains('before.error.after.', $tester->getDisplay());
+ $this->assertStringContainsString('before.error.after.', $tester->getDisplay());
}
/**
@@ -1302,7 +1302,7 @@ public function testRunAllowsErrorListenersToSilenceTheException()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'foo']);
- $this->assertContains('before.error.silenced.after.', $tester->getDisplay());
+ $this->assertStringContainsString('before.error.silenced.after.', $tester->getDisplay());
$this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $tester->getStatusCode());
}
@@ -1321,7 +1321,7 @@ public function testConsoleErrorEventIsTriggeredOnCommandNotFound()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'unknown']);
- $this->assertContains('silenced command not found', $tester->getDisplay());
+ $this->assertStringContainsString('silenced command not found', $tester->getDisplay());
$this->assertEquals(1, $tester->getStatusCode());
}
@@ -1348,8 +1348,8 @@ public function testLegacyExceptionListenersAreStillTriggered()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'foo']);
- $this->assertContains('before.caught.error.after.', $tester->getDisplay());
- $this->assertContains('replaced in caught.', $tester->getDisplay());
+ $this->assertStringContainsString('before.caught.error.after.', $tester->getDisplay());
+ $this->assertStringContainsString('replaced in caught.', $tester->getDisplay());
}
/**
@@ -1396,7 +1396,7 @@ public function testRunWithErrorAndDispatcher()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'dym']);
- $this->assertContains('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events');
+ $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events');
}
/**
@@ -1416,7 +1416,7 @@ public function testRunDispatchesAllEventsWithError()
$tester = new ApplicationTester($application);
$tester->run(['command' => 'dym']);
- $this->assertContains('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events');
+ $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events');
}
/**
@@ -1451,7 +1451,7 @@ public function testRunWithDispatcherSkippingCommand()
$tester = new ApplicationTester($application);
$exitCode = $tester->run(['command' => 'foo']);
- $this->assertContains('before.after.', $tester->getDisplay());
+ $this->assertStringContainsString('before.after.', $tester->getDisplay());
$this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $exitCode);
}
@@ -1579,10 +1579,10 @@ public function testSetRunCustomSingleCommand()
$tester = new ApplicationTester($application);
$tester->run([]);
- $this->assertContains('called', $tester->getDisplay());
+ $this->assertStringContainsString('called', $tester->getDisplay());
$tester->run(['--help' => true]);
- $this->assertContains('The foo:bar command', $tester->getDisplay());
+ $this->assertStringContainsString('The foo:bar command', $tester->getDisplay());
}
/**
diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
index 148b29a6d3d48..207302fdf9929 100644
--- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
@@ -154,20 +154,20 @@ public function testGetProcessedHelp()
{
$command = new \TestCommand();
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
- $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly');
- $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%');
+ $this->assertStringContainsString('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly');
+ $this->assertStringNotContainsString('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%');
$command = new \TestCommand();
$command->setHelp('');
- $this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
+ $this->assertStringContainsString('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
$command = new \TestCommand();
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
$application = new Application();
$application->add($command);
$application->setDefaultCommand('namespace:name', true);
- $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications');
- $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications');
+ $this->assertStringContainsString('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications');
+ $this->assertStringNotContainsString('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications');
}
public function testGetSetAliases()
diff --git a/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php b/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php
index ce9d8d4fe4ccb..5b25550a6d8ec 100644
--- a/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php
@@ -25,9 +25,9 @@ public function testExecuteForCommandAlias()
$command->setApplication(new Application());
$commandTester = new CommandTester($command);
$commandTester->execute(['command_name' => 'li'], ['decorated' => false]);
- $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
- $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
- $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
+ $this->assertStringContainsString('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
+ $this->assertStringContainsString('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
+ $this->assertStringContainsString('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
}
public function testExecuteForCommand()
@@ -36,9 +36,9 @@ public function testExecuteForCommand()
$commandTester = new CommandTester($command);
$command->setCommand(new ListCommand());
$commandTester->execute([], ['decorated' => false]);
- $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
- $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
- $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
}
public function testExecuteForCommandWithXmlOption()
@@ -47,7 +47,7 @@ public function testExecuteForCommandWithXmlOption()
$commandTester = new CommandTester($command);
$command->setCommand(new ListCommand());
$commandTester->execute(['--format' => 'xml']);
- $this->assertContains('getDisplay(), '->execute() returns an XML help text if --xml is passed');
+ $this->assertStringContainsString('getDisplay(), '->execute() returns an XML help text if --xml is passed');
}
public function testExecuteForApplicationCommand()
@@ -55,9 +55,9 @@ public function testExecuteForApplicationCommand()
$application = new Application();
$commandTester = new CommandTester($application->get('help'));
$commandTester->execute(['command_name' => 'list']);
- $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
- $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
- $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
}
public function testExecuteForApplicationCommandWithXmlOption()
@@ -65,7 +65,7 @@ public function testExecuteForApplicationCommandWithXmlOption()
$application = new Application();
$commandTester = new CommandTester($application->get('help'));
$commandTester->execute(['command_name' => 'list', '--format' => 'xml']);
- $this->assertContains('list [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
- $this->assertContains('getDisplay(), '->execute() returns an XML help text if --format=xml is passed');
+ $this->assertStringContainsString('list [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
+ $this->assertStringContainsString('getDisplay(), '->execute() returns an XML help text if --format=xml is passed');
}
}
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
index 1240f7f340906..4fe79805c567f 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
@@ -86,7 +86,7 @@ public function testOptions()
$this->fail('->setOption() throws an \InvalidArgumentException when the option does not exist in the available options');
} catch (\Exception $e) {
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options');
- $this->assertContains('Invalid option specified: "foo"', $e->getMessage(), '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options');
+ $this->assertStringContainsString('Invalid option specified: "foo"', $e->getMessage(), '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options');
}
try {
@@ -94,7 +94,7 @@ public function testOptions()
$this->fail('->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options');
} catch (\Exception $e) {
$this->assertInstanceOf('\InvalidArgumentException', $e, '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options');
- $this->assertContains('Invalid option specified: "foo"', $e->getMessage(), '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options');
+ $this->assertStringContainsString('Invalid option specified: "foo"', $e->getMessage(), '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options');
}
}
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
index ffb12b3421f9a..d608f7bfd2395 100644
--- a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
@@ -68,7 +68,7 @@ public function testGet()
} catch (\Exception $e) {
$this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws InvalidArgumentException when helper not found');
$this->assertInstanceOf('Symfony\Component\Console\Exception\ExceptionInterface', $e, '->get() throws domain specific exception when helper not found');
- $this->assertContains('The helper "foo" is not defined.', $e->getMessage(), '->get() throws InvalidArgumentException when helper not found');
+ $this->assertStringContainsString('The helper "foo" is not defined.', $e->getMessage(), '->get() throws InvalidArgumentException when helper not found');
}
}
diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
index 0c1d4d65e5a25..d4ac0f4693ae7 100644
--- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
@@ -53,7 +53,7 @@ public function testAskChoice()
rewind($output->getStream());
$stream = stream_get_contents($output->getStream());
- $this->assertContains('Input "Fabien" is not a superhero!', $stream);
+ $this->assertStringContainsString('Input "Fabien" is not a superhero!', $stream);
try {
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1');
@@ -616,7 +616,7 @@ public function testLegacyAskChoice()
rewind($output->getStream());
$stream = stream_get_contents($output->getStream());
- $this->assertContains('Input "Fabien" is not a superhero!', $stream);
+ $this->assertStringContainsString('Input "Fabien" is not a superhero!', $stream);
try {
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1');
diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
index a2d78621ddb6d..cbf3b957b3913 100644
--- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
@@ -161,6 +161,6 @@ private function assertOutputContains($expected, StreamOutput $output)
{
rewind($output->getStream());
$stream = stream_get_contents($output->getStream());
- $this->assertContains($expected, $stream);
+ $this->assertStringContainsString($expected, $stream);
}
}
diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
index 18d04e47c9f5e..bcb86b4e3f39f 100644
--- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
+++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
@@ -267,7 +267,7 @@ public function testRecursionInArguments()
$flattened = FlattenException::create($exception);
$trace = $flattened->getTrace();
- $this->assertContains('*DEEP NESTED ARRAY*', serialize($trace));
+ $this->assertStringContainsString('*DEEP NESTED ARRAY*', serialize($trace));
}
public function testTooBigArray()
@@ -291,8 +291,8 @@ public function testTooBigArray()
$serializeTrace = serialize($trace);
- $this->assertContains('*SKIPPED over 10000 entries*', $serializeTrace);
- $this->assertNotContains('*value1*', $serializeTrace);
+ $this->assertStringContainsString('*SKIPPED over 10000 entries*', $serializeTrace);
+ $this->assertStringNotContainsString('*value1*', $serializeTrace);
}
private function createException($foo)
diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
index 8a196649503c3..61a0727d1c420 100644
--- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
@@ -39,8 +39,8 @@ public function testDebug()
$handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean();
- $this->assertContains('Whoops, looks like something went wrong.', $response);
- $this->assertNotContains('
', $response);
+ $this->assertStringContainsString('Whoops, looks like something went wrong.', $response);
+ $this->assertStringNotContainsString('
', $response);
$handler = new ExceptionHandler(true);
@@ -48,8 +48,8 @@ public function testDebug()
$handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean();
- $this->assertContains('Whoops, looks like something went wrong.', $response);
- $this->assertContains('
', $response);
+ $this->assertStringContainsString('Whoops, looks like something went wrong.', $response);
+ $this->assertStringContainsString('
', $response);
}
public function testStatusCode()
@@ -60,7 +60,7 @@ public function testStatusCode()
$handler->sendPhpResponse(new NotFoundHttpException('Foo'));
$response = ob_get_clean();
- $this->assertContains('Sorry, the page you are looking for could not be found.', $response);
+ $this->assertStringContainsString('Sorry, the page you are looking for could not be found.', $response);
$expectedHeaders = [
['HTTP/1.0 404', true, null],
@@ -157,7 +157,7 @@ public function testHandleOutOfMemoryException()
private function assertThatTheExceptionWasOutput($content, $expectedClass, $expectedTitle, $expectedMessage)
{
- $this->assertContains(sprintf('%s', $expectedClass, $expectedTitle), $content);
- $this->assertContains(sprintf('
', $expectedMessage), $content);
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index 9fbeed91ff230..1b6e51c56757e 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -438,7 +438,7 @@ public function testExtensions()
$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
- $this->assertContains('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
+ $this->assertStringContainsString('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
}
// non-registered extension
@@ -478,7 +478,7 @@ public function testExtensionInPhar()
$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
- $this->assertContains('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
+ $this->assertStringContainsString('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
index 8c4a99f7de373..4fcb2c8405d21 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
@@ -41,7 +41,7 @@ public function testMergeWillNotDuplicateIdenticalParameters()
$this->assertCount(1, $placeholderForVariable);
$this->assertIsString($placeholder);
- $this->assertContains($envVariableName, $placeholder);
+ $this->assertStringContainsString($envVariableName, $placeholder);
}
public function testMergeWhereFirstBagIsEmptyWillWork()
@@ -64,7 +64,7 @@ public function testMergeWhereFirstBagIsEmptyWillWork()
$this->assertCount(1, $placeholderForVariable);
$this->assertIsString($placeholder);
- $this->assertContains($envVariableName, $placeholder);
+ $this->assertStringContainsString($envVariableName, $placeholder);
}
public function testMergeWherePlaceholderOnlyExistsInSecond()
diff --git a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
index fe0d3e6629b26..6eef4179e89f0 100644
--- a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
@@ -917,7 +917,7 @@ public function testWidgetContainerAttributes()
$html = $this->renderWidget($form->createView());
// compare plain HTML to check the whitespace
- $this->assertContains('
', $html);
+ $this->assertStringContainsString('
', $html);
}
public function testWidgetContainerAttributeNameRepeatedIfTrue()
@@ -929,6 +929,6 @@ public function testWidgetContainerAttributeNameRepeatedIfTrue()
$html = $this->renderWidget($form->createView());
// foo="foo"
- $this->assertContains('
', $html);
+ $this->assertStringContainsString('
', $html);
}
}
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index 4e01253e2e564..8fc2c4002eaba 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -2395,7 +2395,7 @@ public function testWidgetAttributeHiddenIfFalse()
$html = $this->renderWidget($form->createView());
- $this->assertNotContains('foo="', $html);
+ $this->assertStringNotContainsString('foo="', $html);
}
public function testButtonAttributes()
@@ -2431,7 +2431,7 @@ public function testButtonAttributeHiddenIfFalse()
$html = $this->renderWidget($form->createView());
- $this->assertNotContains('foo="', $html);
+ $this->assertStringNotContainsString('foo="', $html);
}
public function testTextareaWithWhitespaceOnlyContentRetainsValue()
@@ -2440,7 +2440,7 @@ public function testTextareaWithWhitespaceOnlyContentRetainsValue()
$html = $this->renderWidget($form->createView());
- $this->assertContains('> ', $html);
+ $this->assertStringContainsString('> ', $html);
}
public function testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingForm()
@@ -2451,7 +2451,7 @@ public function testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingFo
$html = $this->renderForm($form->createView());
- $this->assertContains('> ', $html);
+ $this->assertStringContainsString('> ', $html);
}
public function testWidgetContainerAttributeHiddenIfFalse()
@@ -2463,7 +2463,7 @@ public function testWidgetContainerAttributeHiddenIfFalse()
$html = $this->renderWidget($form->createView());
// no foo
- $this->assertNotContains('foo="', $html);
+ $this->assertStringNotContainsString('foo="', $html);
}
public function testTranslatedAttributes()
diff --git a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
index 7cc68bd83d268..6240ad23168c4 100644
--- a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
@@ -519,7 +519,7 @@ public function testWidgetContainerAttributes()
$html = $this->renderWidget($form->createView());
// compare plain HTML to check the whitespace
- $this->assertContains('
', $html);
+ $this->assertStringContainsString('
', $html);
}
public function testWidgetContainerAttributeNameRepeatedIfTrue()
@@ -531,6 +531,6 @@ public function testWidgetContainerAttributeNameRepeatedIfTrue()
$html = $this->renderWidget($form->createView());
// foo="foo"
- $this->assertContains('
', $html);
+ $this->assertStringContainsString('
', $html);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
index 350cb82ecaeb3..f9de07dd229dc 100644
--- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
@@ -27,7 +27,7 @@ public function testDebugDefaults()
$ret = $tester->execute([], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Built-in form types', $tester->getDisplay());
+ $this->assertStringContainsString('Built-in form types', $tester->getDisplay());
}
public function testDebugSingleFormType()
@@ -36,7 +36,7 @@ public function testDebugSingleFormType()
$ret = $tester->execute(['class' => 'FormType'], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Symfony\Component\Form\Extension\Core\Type\FormType (Block prefix: "form")', $tester->getDisplay());
+ $this->assertStringContainsString('Symfony\Component\Form\Extension\Core\Type\FormType (Block prefix: "form")', $tester->getDisplay());
}
public function testDebugFormTypeOption()
@@ -45,7 +45,7 @@ public function testDebugFormTypeOption()
$ret = $tester->execute(['class' => 'FormType', 'option' => 'method'], ['decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertContains('Symfony\Component\Form\Extension\Core\Type\FormType (method)', $tester->getDisplay());
+ $this->assertStringContainsString('Symfony\Component\Form\Extension\Core\Type\FormType (method)', $tester->getDisplay());
}
public function testDebugSingleFormTypeNotFound()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
index 0bc150e8d2360..3df96f393bb10 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php
@@ -261,7 +261,7 @@ public function testXSendfile($file)
$this->expectOutputString('');
$response->sendContent();
- $this->assertContains('README.md', $response->headers->get('X-Sendfile'));
+ $this->assertStringContainsString('README.md', $response->headers->get('X-Sendfile'));
}
public function provideXSendfileFiles()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index aaefc03599842..3966446323faf 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -1631,14 +1631,14 @@ public function testToString()
$asString = (string) $request;
- $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString);
- $this->assertContains('Cookie: Foo=Bar', $asString);
+ $this->assertStringContainsString('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString);
+ $this->assertStringContainsString('Cookie: Foo=Bar', $asString);
$request->cookies->set('Another', 'Cookie');
$asString = (string) $request;
- $this->assertContains('Cookie: Foo=Bar; Another=Cookie', $asString);
+ $this->assertStringContainsString('Cookie: Foo=Bar; Another=Cookie', $asString);
}
public function testIsMethod()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
index 776f85cd0fe5c..2858b0a40a81f 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
@@ -582,7 +582,7 @@ public function testSetCache()
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');
- $this->assertContains('"wrong option"', $e->getMessage());
+ $this->assertStringContainsString('"wrong option"', $e->getMessage());
}
$options = ['etag' => '"whatever"'];
@@ -635,7 +635,7 @@ public function testSendContent()
ob_start();
$response->sendContent();
$string = ob_get_clean();
- $this->assertContains('test response rendering', $string);
+ $this->assertStringContainsString('test response rendering', $string);
}
public function testSetPublic()
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
index 60325d594cf88..dbe033d161930 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
@@ -204,7 +204,7 @@ public function testNoRoutingConfigurationResponse()
$request = Request::create('http://localhost/');
$response = $kernel->handle($request);
$this->assertSame(404, $response->getStatusCode());
- $this->assertContains('Welcome', $response->getContent());
+ $this->assertStringContainsString('Welcome', $response->getContent());
}
public function testRequestWithBadHost()
diff --git a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
index 9b7fe08a99909..b2eb59206ba03 100644
--- a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
@@ -20,9 +20,9 @@ public function testSign()
{
$signer = new UriSigner('foobar');
- $this->assertContains('?_hash=', $signer->sign('http://example.com/foo'));
- $this->assertContains('?_hash=', $signer->sign('http://example.com/foo?foo=bar'));
- $this->assertContains('&foo=', $signer->sign('http://example.com/foo?foo=bar'));
+ $this->assertStringContainsString('?_hash=', $signer->sign('http://example.com/foo'));
+ $this->assertStringContainsString('?_hash=', $signer->sign('http://example.com/foo?foo=bar'));
+ $this->assertStringContainsString('&foo=', $signer->sign('http://example.com/foo?foo=bar'));
}
public function testCheck()
diff --git a/src/Symfony/Component/Process/Tests/PhpProcessTest.php b/src/Symfony/Component/Process/Tests/PhpProcessTest.php
index b0f0a57acefaa..d34e84222c35c 100644
--- a/src/Symfony/Component/Process/Tests/PhpProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/PhpProcessTest.php
@@ -38,10 +38,10 @@ public function testCommandLine()
$commandLine = $process->getCommandLine();
$process->start();
- $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
+ $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
$process->wait();
- $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
+ $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
$this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput());
}
diff --git a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
index 1b09c0cac535b..7ab74402ac688 100644
--- a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
@@ -79,7 +79,7 @@ public function testShouldSetArguments()
$proc = $pb->getProcess();
- $this->assertContains('second', $proc->getCommandLine());
+ $this->assertStringContainsString('second', $proc->getCommandLine());
}
public function testPrefixIsPrependedToAllGeneratedProcess()
diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
index 0697de418bb02..b1306f043cdba 100644
--- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php
@@ -48,7 +48,7 @@ public function testLintIncorrectFile()
$ret = $tester->execute(['filename' => $filename], ['decorated' => false]);
$this->assertEquals(1, $ret, 'Returns 1 in case of error');
- $this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
+ $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
}
public function testConstantAsKey()
diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php
index c6db784a8fe67..3b3dabf56d1d4 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -132,7 +132,7 @@ public function testDumpNumericValueWithLocale()
}
$this->assertEquals('1.2', Inline::dump(1.2));
- $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
+ $this->assertStringContainsStringIgnoringCase('fr', setlocale(LC_NUMERIC, 0));
} finally {
setlocale(LC_NUMERIC, $locale);
}
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index a806723025f1b..316f31b1cd9b4 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -58,7 +58,7 @@ public function testSpecifications($expected, $yaml, $comment, $deprecated)
restore_error_handler();
$this->assertCount(1, $deprecations);
- $this->assertContains(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]);
+ $this->assertStringContainsString(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]);
}
}
From 611f57c45684ee5ada386e6d9910331eb5c99dd6 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Tue, 6 Aug 2019 08:41:45 +0200
Subject: [PATCH 057/147] bump phpunit-bridge cache-id
---
phpunit | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpunit b/phpunit
index f2718fadcf68f..437f7b9b44b82 100755
--- a/phpunit
+++ b/phpunit
@@ -1,7 +1,7 @@
#!/usr/bin/env php
Date: Tue, 6 Aug 2019 11:10:43 +0200
Subject: [PATCH 058/147] Fix remaining tests
---
.../DependencyInjection/Configuration.php | 2 +-
src/Symfony/Component/Config/Util/XmlUtils.php | 2 +-
src/Symfony/Component/Debug/ErrorHandler.php | 2 +-
.../Component/Debug/Tests/ErrorHandlerTest.php | 4 ++++
.../Component/DomCrawler/FormFieldRegistry.php | 4 ++--
.../Tests/Iterator/SortableIteratorTest.php | 6 +-----
.../Tests/Extension/Core/Type/DateTypeTest.php | 10 ++++++----
.../AbstractCurrencyDataProviderTest.php | 10 ++++++++++
.../AbstractLanguageDataProviderTest.php | 10 ++++++++++
.../Provider/AbstractLocaleDataProviderTest.php | 8 ++++++++
.../Provider/AbstractRegionDataProviderTest.php | 10 ++++++++++
.../Provider/AbstractScriptDataProviderTest.php | 10 ++++++++++
.../AbstractIntlDateFormatterTest.php | 12 ++++++++++++
src/Symfony/Component/Intl/Tests/IntlTest.php | 16 ++++++++++++++++
.../AbstractNumberFormatterTest.php | 2 +-
.../Component/Stopwatch/Tests/StopwatchTest.php | 2 +-
.../Translation/Loader/CsvFileLoader.php | 4 ++++
.../Translation/Tests/IdentityTranslatorTest.php | 16 ++++++++++++++++
.../Tests/Constraints/CountryValidatorTest.php | 16 ++++++++++++++++
.../Tests/Constraints/CurrencyValidatorTest.php | 16 ++++++++++++++++
.../Tests/Constraints/LanguageValidatorTest.php | 16 ++++++++++++++++
.../Tests/Constraints/RangeValidatorTest.php | 4 ++--
.../Tests/Caster/ExceptionCasterTest.php | 7 ++-----
23 files changed, 166 insertions(+), 23 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 52369bbffaa99..4dfbb0b82de90 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -264,7 +264,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
->canBeEnabled()
->beforeNormalization()
->always(function ($v) {
- if (true === $v['enabled']) {
+ if (\is_array($v) && true === $v['enabled']) {
$workflows = $v;
unset($workflows['enabled']);
diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php
index df1edd68bd79e..dfacaff4ea01f 100644
--- a/src/Symfony/Component/Config/Util/XmlUtils.php
+++ b/src/Symfony/Component/Config/Util/XmlUtils.php
@@ -234,7 +234,7 @@ public static function phpize($value)
return true;
case 'false' === $lowercaseValue:
return false;
- case isset($value[1]) && '0b' == $value[0].$value[1]:
+ case isset($value[1]) && '0b' == $value[0].$value[1] && preg_match('/^0b[01]*$/', $value):
return bindec($value);
case is_numeric($value):
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php
index c7dc3279d73af..9d7c0c67ad6a3 100644
--- a/src/Symfony/Component/Debug/ErrorHandler.php
+++ b/src/Symfony/Component/Debug/ErrorHandler.php
@@ -470,7 +470,7 @@ public function handleError($type, $message, $file, $line)
}
if ($throw) {
- if (E_USER_ERROR & $type) {
+ if (\PHP_VERSION_ID < 70400 && E_USER_ERROR & $type) {
for ($i = 1; isset($backtrace[$i]); ++$i) {
if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
&& '__toString' === $backtrace[$i]['function']
diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
index 3094d22d95d91..2cf75a0e8e322 100644
--- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
@@ -283,6 +283,10 @@ public function testHandleError()
public function testHandleUserError()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ $this->markTestSkipped('PHP 7.4 allows __toString to throw exceptions');
+ }
+
try {
$handler = ErrorHandler::register();
$handler->throwAt(0, true);
diff --git a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
index 8f432cfbbb830..bd73742af7437 100644
--- a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
+++ b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
@@ -57,7 +57,7 @@ public function remove($name)
$target = &$this->fields;
while (\count($segments) > 1) {
$path = array_shift($segments);
- if (!\array_key_exists($path, $target)) {
+ if (!\is_array($target) || !\array_key_exists($path, $target)) {
return;
}
$target = &$target[$path];
@@ -80,7 +80,7 @@ public function &get($name)
$target = &$this->fields;
while ($segments) {
$path = array_shift($segments);
- if (!\array_key_exists($path, $target)) {
+ if (!\is_array($target) || !\array_key_exists($path, $target)) {
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
}
$target = &$target[$path];
diff --git a/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
index 57f1e096a5334..118c4769f2994 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
@@ -33,11 +33,7 @@ public function testAccept($mode, $expected)
if (!\is_callable($mode)) {
switch ($mode) {
case SortableIterator::SORT_BY_ACCESSED_TIME:
- if ('\\' === \DIRECTORY_SEPARATOR) {
- touch(self::toAbsolute('.git'));
- } else {
- file_get_contents(self::toAbsolute('.git'));
- }
+ touch(self::toAbsolute('.git'));
sleep(1);
file_get_contents(self::toAbsolute('.bar'));
break;
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 91e6ff5f8eb12..96c74fe0e4209 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -471,6 +471,7 @@ public function testYearsOption()
public function testMonthsOption()
{
+ \Locale::setDefault('en');
$form = $this->factory->create(static::TESTED_TYPE, null, [
'months' => [6, 7],
'format' => \IntlDateFormatter::SHORT,
@@ -479,8 +480,8 @@ public function testMonthsOption()
$view = $form->createView();
$this->assertEquals([
- new ChoiceView(6, '6', '06'),
- new ChoiceView(7, '7', '07'),
+ new ChoiceView(6, '6', '6'),
+ new ChoiceView(7, '7', '7'),
], $view['month']->vars['choices']);
}
@@ -544,14 +545,15 @@ public function testMonthsOptionLongFormatWithDifferentTimezone()
public function testIsDayWithinRangeReturnsTrueIfWithin()
{
+ \Locale::setDefault('en');
$view = $this->factory->create(static::TESTED_TYPE, null, [
'days' => [6, 7],
])
->createView();
$this->assertEquals([
- new ChoiceView(6, '6', '06'),
- new ChoiceView(7, '7', '07'),
+ new ChoiceView(6, '6', '6'),
+ new ChoiceView(7, '7', '7'),
], $view['day']->vars['choices']);
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
index 3b1f4957aa7ab..12660eb0acfb8 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php
@@ -589,6 +589,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
* @var CurrencyDataProvider
*/
protected $dataProvider;
+ private $defaultLocale;
protected function setUp()
{
@@ -598,6 +599,15 @@ protected function setUp()
$this->getDataDirectory().'/'.Intl::CURRENCY_DIR,
$this->createEntryReader()
);
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
}
abstract protected function getDataDirectory();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
index 917f6f0dd1e6f..2d294f2c6429c 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php
@@ -831,6 +831,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
* @var LanguageDataProvider
*/
protected $dataProvider;
+ private $defaultLocale;
protected function setUp()
{
@@ -840,6 +841,15 @@ protected function setUp()
$this->getDataDirectory().'/'.Intl::LANGUAGE_DIR,
$this->createEntryReader()
);
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
}
abstract protected function getDataDirectory();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
index 88242a6f9bcb3..7da43c70eb85a 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php
@@ -23,6 +23,7 @@ abstract class AbstractLocaleDataProviderTest extends AbstractDataProviderTest
* @var LocaleDataProvider
*/
protected $dataProvider;
+ private $defaultLocale;
protected function setUp()
{
@@ -32,6 +33,13 @@ protected function setUp()
$this->getDataDirectory().'/'.Intl::LOCALE_DIR,
$this->createEntryReader()
);
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ \Locale::setDefault($this->defaultLocale);
}
abstract protected function getDataDirectory();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
index aeb922f9e3e5f..6e2f57aa7a51e 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php
@@ -283,6 +283,7 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
* @var RegionDataProvider
*/
protected $dataProvider;
+ private $defaultLocale;
protected function setUp()
{
@@ -292,6 +293,15 @@ protected function setUp()
$this->getDataDirectory().'/'.Intl::REGION_DIR,
$this->createEntryReader()
);
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
}
abstract protected function getDataDirectory();
diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
index 8620fb2060fbc..5c279065a192b 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractScriptDataProviderTest.php
@@ -219,6 +219,7 @@ abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
* @var ScriptDataProvider
*/
protected $dataProvider;
+ private $defaultLocale;
protected function setUp()
{
@@ -228,6 +229,15 @@ protected function setUp()
$this->getDataDirectory().'/'.Intl::SCRIPT_DIR,
$this->createEntryReader()
);
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
}
abstract protected function getDataDirectory();
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
index 682380bf54157..df99b12109393 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -24,11 +24,23 @@
*/
abstract class AbstractIntlDateFormatterTest extends TestCase
{
+ private $defaultLocale;
+
protected function setUp()
{
+ parent::setUp();
+
+ $this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
+ }
+
/**
* When a time zone is not specified, it uses the system default however it returns null in the getter method.
*
diff --git a/src/Symfony/Component/Intl/Tests/IntlTest.php b/src/Symfony/Component/Intl/Tests/IntlTest.php
index d45a1ded5c304..059f5eb6c4a4a 100644
--- a/src/Symfony/Component/Intl/Tests/IntlTest.php
+++ b/src/Symfony/Component/Intl/Tests/IntlTest.php
@@ -16,6 +16,22 @@
class IntlTest extends TestCase
{
+ private $defaultLocale;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
+ }
+
/**
* @requires extension intl
*/
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index 9e8499eba963f..f64131a61b8c1 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -36,7 +36,7 @@ public function formatCurrencyWithDecimalStyleProvider()
{
return [
[100, 'ALL', '100'],
- [100, 'BRL', '100.00'],
+ [100, 'BRL', '100'],
[100, 'CRC', '100'],
[100, 'JPY', '100'],
[100, 'CHF', '100'],
diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
index f85ccd0ec442d..b8efa373b4cd1 100644
--- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
+++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
@@ -87,7 +87,7 @@ public function testStop()
$event = $stopwatch->stop('foo');
$this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
- $this->assertEquals(200, $event->getDuration(), '', self::DELTA);
+ $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
}
public function testUnknownEvent()
diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php
index 18cc83ed686c6..db17bd563111a 100644
--- a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php
@@ -41,6 +41,10 @@ protected function loadResource($resource)
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
foreach ($file as $data) {
+ if (false === $data) {
+ continue;
+ }
+
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) {
$messages[$data[0]] = $data[1];
}
diff --git a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
index c3d7b1f7d128d..a5c63df988477 100644
--- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
@@ -17,6 +17,22 @@
class IdentityTranslatorTest extends TestCase
{
+ private $defaultLocale;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
+ }
+
/**
* @dataProvider getTransTests
*/
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
index 429aef812f0d3..f5cb9a6db38f7 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
@@ -18,6 +18,22 @@
class CountryValidatorTest extends ConstraintValidatorTestCase
{
+ private $defaultLocale;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
+ }
+
protected function createValidator()
{
return new CountryValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
index 7a619735369e7..d46fcd55487ea 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php
@@ -18,6 +18,22 @@
class CurrencyValidatorTest extends ConstraintValidatorTestCase
{
+ private $defaultLocale;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
+ }
+
protected function createValidator()
{
return new CurrencyValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
index f23fd13fcb692..31a987bdd3e58 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
@@ -18,6 +18,22 @@
class LanguageValidatorTest extends ConstraintValidatorTestCase
{
+ private $defaultLocale;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->defaultLocale = \Locale::getDefault();
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ \Locale::setDefault($this->defaultLocale);
+ }
+
protected function createValidator()
{
return new LanguageValidator();
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php
index 661161d886a20..df33d2c422f95 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php
@@ -50,7 +50,7 @@ public function getLessThanTen()
[9.99999, '9.99999'],
['9.99999', '"9.99999"'],
[5, '5'],
- [1.0, '1.0'],
+ [1.0, '1'],
];
}
@@ -60,7 +60,7 @@ public function getMoreThanTwenty()
[20.000001, '20.000001'],
['20.000001', '"20.000001"'],
[21, '21'],
- [30.0, '30.0'],
+ [30.0, '30'],
];
}
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
index ea83e77163d19..738180f5b22dc 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
@@ -52,7 +52,6 @@ public function testDefaultSettings()
› }
}
%s%eTests%eCaster%eExceptionCasterTest.php:40 { …}
- Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testDefaultSettings() {}
%A
EODUMP;
@@ -71,8 +70,7 @@ public function testSeek()
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:65 { …}
- Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testSeek() {}
+ %s%eTests%eCaster%eExceptionCasterTest.php:64 { …}
%A
EODUMP;
@@ -96,8 +94,7 @@ public function testNoArgs()
› return new \Exception(''.$msg);
› }
}
- %s%eTests%eCaster%eExceptionCasterTest.php:84 { …}
- Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testNoArgs() {}
+ %s%eTests%eCaster%eExceptionCasterTest.php:82 { …}
%A
EODUMP;
From 6af3c6bb0148794a406d5f4ae69afc800b396e74 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Tue, 6 Aug 2019 17:37:23 +0200
Subject: [PATCH 059/147] [Config] fix test
---
src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile
diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile b/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile
new file mode 100644
index 0000000000000..e69de29bb2d1d
From dbd9b75d8692e838fa4524d9e0f5fdafa2703bb0 Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Fri, 12 Jul 2019 11:05:21 +0200
Subject: [PATCH 060/147] [FrameworkBundle][Config] Ignore exeptions thrown
during reflection classes autoload
---
.../AbstractPhpFileCacheWarmer.php | 16 +++++-
.../CacheWarmer/AnnotationsCacheWarmer.php | 37 +++++++-----
.../CacheWarmer/SerializerCacheWarmer.php | 4 +-
.../CacheWarmer/ValidatorCacheWarmer.php | 4 +-
.../AnnotationsCacheWarmerTest.php | 48 ++++++++++++++++
.../CacheWarmer/SerializerCacheWarmerTest.php | 54 ++++++++++++++++++
.../CacheWarmer/ValidatorCacheWarmerTest.php | 50 ++++++++++++++++
.../Resources/does_not_exist.yaml | 1 +
.../Validation/Resources/does_not_exist.yaml | 1 +
.../Bundle/FrameworkBundle/composer.json | 2 +-
.../Cache/Adapter/PhpArrayAdapter.php | 2 +-
.../Resource/ClassExistenceResource.php | 57 +++++++++++++++----
12 files changed, 244 insertions(+), 32 deletions(-)
create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Serialization/Resources/does_not_exist.yaml
create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Resources/does_not_exist.yaml
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php
index 43cbb7968a8ad..c7e641788b9af 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php
@@ -16,6 +16,7 @@
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
use Symfony\Component\Cache\Adapter\ProxyAdapter;
+use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
/**
@@ -54,13 +55,13 @@ public function warmUp($cacheDir)
{
$arrayAdapter = new ArrayAdapter();
- spl_autoload_register([PhpArrayAdapter::class, 'throwOnRequiredClass']);
+ spl_autoload_register([ClassExistenceResource::class, 'throwOnRequiredClass']);
try {
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
return;
}
} finally {
- spl_autoload_unregister([PhpArrayAdapter::class, 'throwOnRequiredClass']);
+ spl_autoload_unregister([ClassExistenceResource::class, 'throwOnRequiredClass']);
}
// the ArrayAdapter stores the values serialized
@@ -82,6 +83,17 @@ protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array
$phpArrayAdapter->warmUp($values);
}
+ /**
+ * @internal
+ */
+ final protected function ignoreAutoloadException($class, \Exception $exception)
+ {
+ try {
+ ClassExistenceResource::throwOnRequiredClass($class, $exception);
+ } catch (\ReflectionException $e) {
+ }
+ }
+
/**
* @param string $cacheDir
* @param ArrayAdapter $arrayAdapter
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
index 3c32cb1c4a33a..ad4687620da3d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
@@ -64,17 +64,8 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
}
try {
$this->readAllComponents($reader, $class);
- } catch (\ReflectionException $e) {
- // ignore failing reflection
- } catch (AnnotationException $e) {
- /*
- * Ignore any AnnotationException to not break the cache warming process if an Annotation is badly
- * configured or could not be found / read / etc.
- *
- * In particular cases, an Annotation in your code can be used and defined only for a specific
- * environment but is always added to the annotations.map file by some Symfony default behaviors,
- * and you always end up with a not found Annotation.
- */
+ } catch (\Exception $e) {
+ $this->ignoreAutoloadException($class, $e);
}
}
@@ -84,14 +75,32 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
private function readAllComponents(Reader $reader, $class)
{
$reflectionClass = new \ReflectionClass($class);
- $reader->getClassAnnotations($reflectionClass);
+
+ try {
+ $reader->getClassAnnotations($reflectionClass);
+ } catch (AnnotationException $e) {
+ /*
+ * Ignore any AnnotationException to not break the cache warming process if an Annotation is badly
+ * configured or could not be found / read / etc.
+ *
+ * In particular cases, an Annotation in your code can be used and defined only for a specific
+ * environment but is always added to the annotations.map file by some Symfony default behaviors,
+ * and you always end up with a not found Annotation.
+ */
+ }
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
- $reader->getMethodAnnotations($reflectionMethod);
+ try {
+ $reader->getMethodAnnotations($reflectionMethod);
+ } catch (AnnotationException $e) {
+ }
}
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
- $reader->getPropertyAnnotations($reflectionProperty);
+ try {
+ $reader->getPropertyAnnotations($reflectionProperty);
+ } catch (AnnotationException $e) {
+ }
}
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php
index 917ea47235fd7..e74206c8650db 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php
@@ -56,10 +56,10 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
foreach ($loader->getMappedClasses() as $mappedClass) {
try {
$metadataFactory->getMetadataFor($mappedClass);
- } catch (\ReflectionException $e) {
- // ignore failing reflection
} catch (AnnotationException $e) {
// ignore failing annotations
+ } catch (\Exception $e) {
+ $this->ignoreAutoloadException($mappedClass, $e);
}
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php
index 8ac38133c06ee..623a2907f64e7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php
@@ -61,10 +61,10 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
if ($metadataFactory->hasMetadataFor($mappedClass)) {
$metadataFactory->getMetadataFor($mappedClass);
}
- } catch (\ReflectionException $e) {
- // ignore failing reflection
} catch (AnnotationException $e) {
// ignore failing annotations
+ } catch (\Exception $e) {
+ $this->ignoreAutoloadException($mappedClass, $e);
}
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
index 9a5b40ee36e97..6ead6d746e520 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
@@ -86,6 +86,54 @@ public function testAnnotationsCacheWarmerWithDebugEnabled()
$reader->getPropertyAnnotations($refClass->getProperty('cacheDir'));
}
+ /**
+ * Test that the cache warming process is not broken if a class loader
+ * throws an exception (on class / file not found for example).
+ */
+ public function testClassAutoloadException()
+ {
+ $this->assertFalse(class_exists($annotatedClass = 'C\C\C', false));
+
+ file_put_contents($this->cacheDir.'/annotations.map', sprintf('cacheDir, __FUNCTION__), new ArrayAdapter());
+
+ spl_autoload_register($classLoader = function ($class) use ($annotatedClass) {
+ if ($class === $annotatedClass) {
+ throw new \DomainException('This exception should be caught by the warmer.');
+ }
+ }, true, true);
+
+ $warmer->warmUp($this->cacheDir);
+
+ spl_autoload_unregister($classLoader);
+ }
+
+ /**
+ * Test that the cache warming process is broken if a class loader throws an
+ * exception but that is unrelated to the class load.
+ */
+ public function testClassAutoloadExceptionWithUnrelatedException()
+ {
+ $this->expectException(\DomainException::class);
+ $this->expectExceptionMessage('This exception should not be caught by the warmer.');
+
+ $this->assertFalse(class_exists($annotatedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_AnnotationsCacheWarmerTest', false));
+
+ file_put_contents($this->cacheDir.'/annotations.map', sprintf('cacheDir, __FUNCTION__), new ArrayAdapter());
+
+ spl_autoload_register($classLoader = function ($class) use ($annotatedClass) {
+ if ($class === $annotatedClass) {
+ eval('class '.$annotatedClass.'{}');
+ throw new \DomainException('This exception should not be caught by the warmer.');
+ }
+ }, true, true);
+
+ $warmer->warmUp($this->cacheDir);
+
+ spl_autoload_unregister($classLoader);
+ }
+
/**
* @return MockObject|Reader
*/
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
index 51c979c597825..1a244252f1f1b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php
@@ -77,4 +77,58 @@ public function testWarmUpWithoutLoader()
$this->assertIsArray($values);
$this->assertCount(0, $values);
}
+
+ /**
+ * Test that the cache warming process is not broken if a class loader
+ * throws an exception (on class / file not found for example).
+ */
+ public function testClassAutoloadException()
+ {
+ if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
+ $this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
+ }
+
+ $this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest', false));
+
+ $warmer = new SerializerCacheWarmer([new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/does_not_exist.yaml')], tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
+
+ spl_autoload_register($classLoader = function ($class) use ($mappedClass) {
+ if ($class === $mappedClass) {
+ throw new \DomainException('This exception should be caught by the warmer.');
+ }
+ }, true, true);
+
+ $warmer->warmUp('foo');
+
+ spl_autoload_unregister($classLoader);
+ }
+
+ /**
+ * Test that the cache warming process is broken if a class loader throws an
+ * exception but that is unrelated to the class load.
+ */
+ public function testClassAutoloadExceptionWithUnrelatedException()
+ {
+ $this->expectException(\DomainException::class);
+ $this->expectExceptionMessage('This exception should not be caught by the warmer.');
+
+ if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
+ $this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
+ }
+
+ $this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest', false));
+
+ $warmer = new SerializerCacheWarmer([new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/does_not_exist.yaml')], tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
+
+ spl_autoload_register($classLoader = function ($class) use ($mappedClass) {
+ if ($class === $mappedClass) {
+ eval('class '.$mappedClass.'{}');
+ throw new \DomainException('This exception should not be caught by the warmer.');
+ }
+ }, true, true);
+
+ $warmer->warmUp('foo');
+
+ spl_autoload_unregister($classLoader);
+ }
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
index 3f0a9a14d4f64..9923b032c048d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
@@ -107,4 +107,54 @@ public function testWarmUpWithoutLoader()
$this->assertIsArray($values);
$this->assertCount(0, $values);
}
+
+ /**
+ * Test that the cache warming process is not broken if a class loader
+ * throws an exception (on class / file not found for example).
+ */
+ public function testClassAutoloadException()
+ {
+ $this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_ValidatorCacheWarmerTest', false));
+
+ $validatorBuilder = new ValidatorBuilder();
+ $validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/does_not_exist.yaml');
+ $warmer = new ValidatorCacheWarmer($validatorBuilder, tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
+
+ spl_autoload_register($classloader = function ($class) use ($mappedClass) {
+ if ($class === $mappedClass) {
+ throw new \DomainException('This exception should be caught by the warmer.');
+ }
+ }, true, true);
+
+ $warmer->warmUp('foo');
+
+ spl_autoload_unregister($classloader);
+ }
+
+ /**
+ * Test that the cache warming process is broken if a class loader throws an
+ * exception but that is unrelated to the class load.
+ */
+ public function testClassAutoloadExceptionWithUnrelatedException()
+ {
+ $this->expectException(\DomainException::class);
+ $this->expectExceptionMessage('This exception should not be caught by the warmer.');
+
+ $this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_ValidatorCacheWarmerTest', false));
+
+ $validatorBuilder = new ValidatorBuilder();
+ $validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/does_not_exist.yaml');
+ $warmer = new ValidatorCacheWarmer($validatorBuilder, tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
+
+ spl_autoload_register($classLoader = function ($class) use ($mappedClass) {
+ if ($class === $mappedClass) {
+ eval('class '.$mappedClass.'{}');
+ throw new \DomainException('This exception should not be caught by the warmer.');
+ }
+ }, true, true);
+
+ $warmer->warmUp('foo');
+
+ spl_autoload_unregister($classLoader);
+ }
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Serialization/Resources/does_not_exist.yaml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Serialization/Resources/does_not_exist.yaml
new file mode 100644
index 0000000000000..061691224619a
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Serialization/Resources/does_not_exist.yaml
@@ -0,0 +1 @@
+AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest: ~
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Resources/does_not_exist.yaml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Resources/does_not_exist.yaml
new file mode 100644
index 0000000000000..69b1635e47063
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Resources/does_not_exist.yaml
@@ -0,0 +1 @@
+AClassThatDoesNotExist_FWB_CacheWarmer_ValidatorCacheWarmerTest: ~
diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index 40cff711ae8ad..5ff8a22471183 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -21,7 +21,7 @@
"symfony/cache": "~3.4|~4.0",
"symfony/class-loader": "~3.2",
"symfony/dependency-injection": "^3.4.24|^4.2.5",
- "symfony/config": "~3.4|~4.0",
+ "symfony/config": "^3.4.31|^4.3.4",
"symfony/debug": "~2.8|~3.0|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/http-foundation": "^3.3.11|~4.0",
diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
index 59994ea4b6a2d..76673e0a03c7b 100644
--- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
@@ -266,7 +266,7 @@ private function generateItems(array $keys)
/**
* @throws \ReflectionException When $class is not found and is required
*
- * @internal
+ * @internal to be removed in Symfony 5.0
*/
public static function throwOnRequiredClass($class)
{
diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
index 5554f4c672524..e7ab1b8d7288e 100644
--- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
+++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
@@ -76,10 +76,14 @@ public function isFresh($timestamp)
try {
$exists = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
- } catch (\ReflectionException $e) {
- if (0 >= $timestamp) {
- unset(self::$existsCache[1][$this->resource]);
- throw $e;
+ } catch (\Exception $e) {
+ try {
+ self::throwOnRequiredClass($this->resource, $e);
+ } catch (\ReflectionException $e) {
+ if (0 >= $timestamp) {
+ unset(self::$existsCache[1][$this->resource]);
+ throw $e;
+ }
}
} finally {
self::$autoloadedClass = $autoloadedClass;
@@ -117,24 +121,57 @@ public function unserialize($serialized)
}
/**
- * @throws \ReflectionException When $class is not found and is required
+ * Throws a reflection exception when the passed class does not exist but is required.
+ *
+ * A class is considered "not required" when it's loaded as part of a "class_exists" or similar check.
+ *
+ * This function can be used as an autoload function to throw a reflection
+ * exception if the class was not found by previous autoload functions.
+ *
+ * A previous exception can be passed. In this case, the class is considered as being
+ * required totally, so if it doesn't exist, a reflection exception is always thrown.
+ * If it exists, the previous exception is rethrown.
+ *
+ * @throws \ReflectionException
*
* @internal
*/
- public static function throwOnRequiredClass($class)
+ public static function throwOnRequiredClass($class, \Exception $previous = null)
{
- if (self::$autoloadedClass === $class) {
+ // If the passed class is the resource being checked, we shouldn't throw.
+ if (null === $previous && self::$autoloadedClass === $class) {
+ return;
+ }
+
+ if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) {
+ if (null !== $previous) {
+ throw $previous;
+ }
+
return;
}
- $e = new \ReflectionException("Class $class not found");
+
+ if ($previous instanceof \ReflectionException) {
+ throw $previous;
+ }
+
+ $e = new \ReflectionException("Class $class not found", 0, $previous);
+
+ if (null !== $previous) {
+ throw $e;
+ }
+
$trace = $e->getTrace();
$autoloadFrame = [
'function' => 'spl_autoload_call',
'args' => [$class],
];
- $i = 1 + array_search($autoloadFrame, $trace, true);
- if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) {
+ if (false === $i = array_search($autoloadFrame, $trace, true)) {
+ throw $e;
+ }
+
+ if (isset($trace[++$i]['function']) && !isset($trace[$i]['class'])) {
switch ($trace[$i]['function']) {
case 'get_class_methods':
case 'get_class_vars':
From 484668fe563f1d3eb5f2c68d186de915ec587e70 Mon Sep 17 00:00:00 2001
From: Vladimir Reznichenko
Date: Tue, 6 Aug 2019 20:02:07 +0200
Subject: [PATCH 061/147] SCA: dropped unused mocks, duplicate import and a
function alias usage
---
.../Tests/Definition/Builder/NumericNodeDefinitionTest.php | 7 +++----
.../ExpressionLanguage/Tests/ExpressionLanguageTest.php | 1 -
src/Symfony/Component/Ldap/Tests/LdapTestCase.php | 2 +-
.../Security/Guard/Tests/GuardAuthenticatorHandlerTest.php | 7 -------
.../Tests/Firewall/BasicAuthenticationListenerTest.php | 2 --
.../Tests/RememberMe/AbstractRememberMeServicesTest.php | 1 -
.../DependencyInjection/TranslationExtractorPassTest.php | 3 ---
7 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
index e60bf407fe6d4..aa938bbaa7ed1 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
@@ -14,7 +14,6 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition;
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition;
-use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition;
class NumericNodeDefinitionTest extends TestCase
{
@@ -22,7 +21,7 @@ public function testIncoherentMinAssertion()
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('You cannot define a min(4) as you already have a max(3)');
- $def = new NumericNodeDefinition('foo');
+ $def = new IntegerNodeDefinition('foo');
$def->max(3)->min(4);
}
@@ -30,7 +29,7 @@ public function testIncoherentMaxAssertion()
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('You cannot define a max(2) as you already have a min(3)');
- $node = new NumericNodeDefinition('foo');
+ $node = new IntegerNodeDefinition('foo');
$node->min(3)->max(2);
}
@@ -84,7 +83,7 @@ public function testCannotBeEmptyThrowsAnException()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
$this->expectExceptionMessage('->cannotBeEmpty() is not applicable to NumericNodeDefinition.');
- $def = new NumericNodeDefinition('foo');
+ $def = new IntegerNodeDefinition('foo');
$def->cannotBeEmpty();
}
}
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
index d6e46768bdd6b..22d1d1649da12 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
@@ -70,7 +70,6 @@ public function testCachedParseWithDeprecatedParserCacheInterface()
{
$cacheMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
- $cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock();
$savedParsedExpression = null;
$expressionLanguage = new ExpressionLanguage($cacheMock);
diff --git a/src/Symfony/Component/Ldap/Tests/LdapTestCase.php b/src/Symfony/Component/Ldap/Tests/LdapTestCase.php
index cc50ecae73dc1..9a1424a62e8f7 100644
--- a/src/Symfony/Component/Ldap/Tests/LdapTestCase.php
+++ b/src/Symfony/Component/Ldap/Tests/LdapTestCase.php
@@ -14,7 +14,7 @@ protected function getLdapConfig()
$this->markTestSkipped('No server is listening on LDAP_HOST:LDAP_PORT');
}
- ldap_close($h);
+ ldap_unbind($h);
return [
'host' => getenv('LDAP_HOST'),
diff --git a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
index 3bf204ec7f5c0..dd41c69800806 100644
--- a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
+++ b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
@@ -85,13 +85,6 @@ public function testHandleAuthenticationFailure()
*/
public function testHandleAuthenticationClearsToken($tokenClass, $tokenProviderKey, $actualProviderKey)
{
- $token = $this->getMockBuilder($tokenClass)
- ->disableOriginalConstructor()
- ->getMock();
- $token->expects($this->any())
- ->method('getProviderKey')
- ->willReturn($tokenProviderKey);
-
$this->tokenStorage->expects($this->never())
->method('setToken')
->with(null);
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
index 125d403a72147..08c4e6de37ba8 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
@@ -74,8 +74,6 @@ public function testHandleWhenAuthenticationFails()
'PHP_AUTH_PW' => 'ThePassword',
]);
- $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
-
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
$tokenStorage
->expects($this->any())
diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
index 75aa0c324bfd9..c476e65403c2e 100644
--- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
@@ -124,7 +124,6 @@ public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfa
$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();
$token
->expects($this->once())
diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
index b5eff6cfcd9fd..113536bca89a1 100644
--- a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
+++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
@@ -50,14 +50,11 @@ public function testProcessMissingAlias()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$this->expectExceptionMessage('The alias for the tag "translation.extractor" of service "foo.id" must be set.');
- $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->disableOriginalConstructor()->getMock();
$container = new ContainerBuilder();
$container->register('translation.extractor');
$container->register('foo.id')
->addTag('translation.extractor', []);
- $definition->expects($this->never())->method('addMethodCall');
-
$translationDumperPass = new TranslationExtractorPass();
$translationDumperPass->process($container);
}
From 33f722d86ec4d2b5b6696c385505898ba58d91d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Tue, 6 Aug 2019 15:47:21 +0200
Subject: [PATCH 062/147] [ProxyManagerBridge] Polyfill for unmaintained
version
---
composer.json | 3 +-
.../LazyProxy/PhpDumper/ProxyDumper.php | 4 +
.../Legacy/ProxiedMethodReturnExpression.php | 73 +++++++++++++++++++
.../LazyProxy/PhpDumper/ProxyDumperTest.php | 15 ++++
src/Symfony/Bridge/ProxyManager/composer.json | 1 +
5 files changed, 95 insertions(+), 1 deletion(-)
create mode 100644 src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php
diff --git a/composer.json b/composer.json
index 919941f984d6b..fe465e81e155e 100644
--- a/composer.json
+++ b/composer.json
@@ -123,7 +123,8 @@
"Symfony\\Component\\": "src/Symfony/Component/"
},
"classmap": [
- "src/Symfony/Component/Intl/Resources/stubs"
+ "src/Symfony/Component/Intl/Resources/stubs",
+ "src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php"
],
"exclude-from-classmap": [
"**/Tests/"
diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
index 7acc1c65420b7..d9cd210263cc9 100644
--- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
+++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
@@ -112,6 +112,10 @@ public function getProxyCode(Definition $definition)
);
}
+ if (version_compare(self::getProxyManagerVersion(), '2.5', '<')) {
+ $code = str_replace(' \Closure::bind(function ', ' \Closure::bind(static function ', $code);
+ }
+
return $code;
}
diff --git a/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php b/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php
new file mode 100644
index 0000000000000..e3d98d800301a
--- /dev/null
+++ b/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php
@@ -0,0 +1,73 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ProxyManager\Generator\Util;
+
+use Composer\Autoload\ClassLoader;
+use ProxyManager\Version;
+
+if (class_exists(Version::class) && version_compare(\defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion(), '2.5', '<')) {
+ /**
+ * Utility class to generate return expressions in method, given a method signature.
+ *
+ * This is required since return expressions may be forbidden by the method signature (void).
+ *
+ * @author Marco Pivetta
+ * @license MIT
+ *
+ * @see https://github.com/Ocramius/ProxyManager
+ */
+ final class ProxiedMethodReturnExpression
+ {
+ public static function generate(string $returnedValueExpression, ?\ReflectionMethod $originalMethod): string
+ {
+ $originalReturnType = null === $originalMethod ? null : $originalMethod->getReturnType();
+
+ $originalReturnTypeName = null === $originalReturnType ? null : $originalReturnType->getName();
+
+ if ('void' === $originalReturnTypeName) {
+ return $returnedValueExpression.";\nreturn;";
+ }
+
+ return 'return '.$returnedValueExpression.';';
+ }
+ }
+} else {
+ // Fallback to the original class by unregistering this file from composer class loader
+ $getComposerClassLoader = static function ($functionLoader) use (&$getComposerClassLoader) {
+ if (\is_array($functionLoader)) {
+ $functionLoader = $functionLoader[0];
+ }
+ if (!\is_object($functionLoader)) {
+ return;
+ }
+ if ($functionLoader instanceof ClassLoader) {
+ return $functionLoader;
+ }
+ if ($functionLoader instanceof \Symfony\Component\Debug\DebugClassLoader) {
+ return $getComposerClassLoader($functionLoader->getClassLoader());
+ }
+ if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
+ return $getComposerClassLoader($functionLoader->getClassLoader());
+ }
+ };
+
+ $classLoader = null;
+ $functions = spl_autoload_functions();
+ while (null === $classLoader && $functions) {
+ $classLoader = $getComposerClassLoader(array_shift($functions));
+ }
+ $getComposerClassLoader = null;
+
+ if (null !== $classLoader) {
+ $classLoader->addClassMap([ProxiedMethodReturnExpression::class => null]);
+ $classLoader->loadClass(ProxiedMethodReturnExpression::class);
+ }
+}
diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
index 5328c9ae1227d..e3e40fdbcfbc0 100644
--- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
use PHPUnit\Framework\TestCase;
+use ProxyManager\Version;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -63,6 +64,20 @@ public function testGetProxyCode()
);
}
+ public function testStaticBinding()
+ {
+ if (!class_exists(Version::class) || version_compare(\defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion(), '2.1', '<')) {
+ $this->markTestSkipped('ProxyManager prior to version 2.1 does not support static binding');
+ }
+
+ $definition = new Definition(__CLASS__);
+ $definition->setLazy(true);
+
+ $code = $this->dumper->getProxyCode($definition);
+
+ $this->assertStringContainsString('\Closure::bind(static function (\PHPUnit\Framework\TestCase $instance) {', $code);
+ }
+
public function testDeterministicProxyCode()
{
$definition = new Definition(__CLASS__);
diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json
index 7e34cd90b5139..4adc5c063f89d 100644
--- a/src/Symfony/Bridge/ProxyManager/composer.json
+++ b/src/Symfony/Bridge/ProxyManager/composer.json
@@ -25,6 +25,7 @@
},
"autoload": {
"psr-4": { "Symfony\\Bridge\\ProxyManager\\": "" },
+ "classmap": [ "Legacy/ProxiedMethodReturnExpression.php" ],
"exclude-from-classmap": [
"/Tests/"
]
From 1a83f9beedf92c4a1cb1a7ea05ce857d6e20f62a Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Wed, 7 Aug 2019 13:13:33 +0200
Subject: [PATCH 063/147] Fix inconsistent return points.
---
src/Symfony/Bridge/Monolog/Logger.php | 2 +
.../SecurityBundle/Security/FirewallMap.php | 6 ++-
src/Symfony/Component/Console/Terminal.php | 52 +++++++++----------
.../Compiler/AutowirePass.php | 12 +++--
.../Loader/XmlFileLoader.php | 2 +-
.../Component/HttpKernel/HttpCache/Store.php | 13 +++--
.../PropertyAccess/PropertyAccessor.php | 2 +
.../Routing/Loader/XmlFileLoader.php | 4 +-
.../Component/Serializer/Serializer.php | 4 ++
9 files changed, 57 insertions(+), 40 deletions(-)
diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php
index a8b31cc09b910..a88b46fd78f15 100644
--- a/src/Symfony/Bridge/Monolog/Logger.php
+++ b/src/Symfony/Bridge/Monolog/Logger.php
@@ -73,5 +73,7 @@ private function getDebugLogger()
return $handler;
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php
index 599f9050aff9b..3bb16b26c765a 100644
--- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php
+++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php
@@ -135,14 +135,14 @@ public function getFirewallConfig(Request $request)
$context = $this->getFirewallContext($request);
if (null === $context) {
- return;
+ return null;
}
return $context->getConfig();
}
/**
- * @return FirewallContext
+ * @return FirewallContext|null
*/
private function getFirewallContext(Request $request)
{
@@ -164,5 +164,7 @@ private function getFirewallContext(Request $request)
return $this->container->get($contextId);
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/Console/Terminal.php b/src/Symfony/Component/Console/Terminal.php
index 456cca11ca8a6..56eb05096442b 100644
--- a/src/Symfony/Component/Console/Terminal.php
+++ b/src/Symfony/Component/Console/Terminal.php
@@ -87,25 +87,13 @@ private static function initDimensions()
*/
private static function getConsoleMode()
{
- if (!\function_exists('proc_open')) {
- return;
- }
+ $info = self::readFromProcess('mode CON');
- $descriptorspec = [
- 1 => ['pipe', 'w'],
- 2 => ['pipe', 'w'],
- ];
- $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
- if (\is_resource($process)) {
- $info = stream_get_contents($pipes[1]);
- fclose($pipes[1]);
- fclose($pipes[2]);
- proc_close($process);
-
- if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
- return [(int) $matches[2], (int) $matches[1]];
- }
+ if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
+ return null;
}
+
+ return [(int) $matches[2], (int) $matches[1]];
}
/**
@@ -114,9 +102,19 @@ private static function getConsoleMode()
* @return string|null
*/
private static function getSttyColumns()
+ {
+ return self::readFromProcess('stty -a | grep columns');
+ }
+
+ /**
+ * @param string $command
+ *
+ * @return string|null
+ */
+ private static function readFromProcess($command)
{
if (!\function_exists('proc_open')) {
- return;
+ return null;
}
$descriptorspec = [
@@ -124,14 +122,16 @@ private static function getSttyColumns()
2 => ['pipe', 'w'],
];
- $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
- if (\is_resource($process)) {
- $info = stream_get_contents($pipes[1]);
- fclose($pipes[1]);
- fclose($pipes[2]);
- proc_close($process);
-
- return $info;
+ $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
+ if (!\is_resource($process)) {
+ return null;
}
+
+ $info = stream_get_contents($pipes[1]);
+ fclose($pipes[1]);
+ fclose($pipes[2]);
+ proc_close($process);
+
+ return $info;
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
index c8e7a0f575f4e..f2a5b46993a0a 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
@@ -318,7 +318,7 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
}
if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) {
- return;
+ return null;
}
if (isset($this->autowired[$type])) {
@@ -328,6 +328,8 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
if (!$this->strictMode) {
return $this->createAutowiredDefinition($type);
}
+
+ return null;
}
/**
@@ -425,7 +427,7 @@ private function set($type, $id)
private function createAutowiredDefinition($type)
{
if (!($typeHint = $this->container->getReflectionClass($type, false)) || !$typeHint->isInstantiable()) {
- return;
+ return null;
}
$currentId = $this->currentId;
@@ -445,7 +447,7 @@ private function createAutowiredDefinition($type)
$this->lastFailure = $e->getMessage();
$this->container->log($this, $this->lastFailure);
- return;
+ return null;
} finally {
$this->throwOnAutowiringException = $originalThrowSetting;
$this->currentId = $currentId;
@@ -518,7 +520,7 @@ private function createTypeAlternatives(TypedReference $reference)
} elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) {
return ' It cannot be auto-registered because it is from a different root namespace.';
} else {
- return;
+ return '';
}
return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
@@ -572,5 +574,7 @@ private function getAliasesSuggestionForType($type, $extraContext = null)
if ($aliases) {
return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]);
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
index 718592d8eca39..60102eaa8c298 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
@@ -211,7 +211,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
$alias->setPublic($defaults['public']);
}
- return;
+ return null;
}
if ($this->isLoadingInstanceof) {
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
index ffd4f01aea59f..d0eeb165291b3 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
@@ -134,7 +134,7 @@ public function lookup(Request $request)
$key = $this->getCacheKey($request);
if (!$entries = $this->getMetadata($key)) {
- return;
+ return null;
}
// find a cached entry that matches the request.
@@ -148,7 +148,7 @@ public function lookup(Request $request)
}
if (null === $match) {
- return;
+ return null;
}
$headers = $match[1];
@@ -159,6 +159,7 @@ public function lookup(Request $request)
// TODO the metaStore referenced an entity that doesn't exist in
// the entityStore. We definitely want to return nil but we should
// also purge the entry from the meta-store when this is detected.
+ return null;
}
/**
@@ -180,7 +181,7 @@ public function write(Request $request, Response $response)
if (!$response->headers->has('X-Content-Digest')) {
$digest = $this->generateContentDigest($response);
- if (false === $this->save($digest, $response->getContent())) {
+ if (!$this->save($digest, $response->getContent())) {
throw new \RuntimeException('Unable to store the entity.');
}
@@ -209,7 +210,7 @@ public function write(Request $request, Response $response)
array_unshift($entries, [$storedEnv, $headers]);
- if (false === $this->save($key, serialize($entries))) {
+ if (!$this->save($key, serialize($entries))) {
throw new \RuntimeException('Unable to store the metadata.');
}
@@ -248,7 +249,7 @@ public function invalidate(Request $request)
}
}
- if ($modified && false === $this->save($key, serialize($entries))) {
+ if ($modified && !$this->save($key, serialize($entries))) {
throw new \RuntimeException('Unable to store the metadata.');
}
}
@@ -408,6 +409,8 @@ private function save($key, $data)
}
@chmod($path, 0666 & ~umask());
+
+ return true;
}
public function getPath($key)
diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
index 83b0f1ce13269..e36211bd65cbf 100644
--- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
+++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
@@ -840,6 +840,8 @@ private function findAdderAndRemover(\ReflectionClass $reflClass, array $singula
return [$addMethod, $removeMethod];
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
index 444a08a77685b..c114310fc3232 100644
--- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
@@ -261,7 +261,7 @@ private function parseConfigs(\DOMElement $node, $path)
private function parseDefaultsConfig(\DOMElement $element, $path)
{
if ($this->isElementValueNull($element)) {
- return;
+ return null;
}
// Check for existing element nodes in the default element. There can
@@ -298,7 +298,7 @@ private function parseDefaultsConfig(\DOMElement $element, $path)
private function parseDefaultNode(\DOMElement $node, $path)
{
if ($this->isElementValueNull($node)) {
- return;
+ return null;
}
switch ($node->localName) {
diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php
index f63cf67bdf7ed..fd6b7dd0598e8 100644
--- a/src/Symfony/Component/Serializer/Serializer.php
+++ b/src/Symfony/Component/Serializer/Serializer.php
@@ -243,6 +243,8 @@ private function getNormalizer($data, $format, array $context)
return $normalizer;
}
}
+
+ return null;
}
/**
@@ -262,6 +264,8 @@ private function getDenormalizer($data, $class, $format, array $context)
return $normalizer;
}
}
+
+ return null;
}
/**
From 0a78dc0f6f2300d53774ab1b2e1f20fd45ff8ac3 Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Wed, 7 Aug 2019 10:40:19 +0200
Subject: [PATCH 064/147] Fix some return type annotations.
---
.../Console/Descriptor/JsonDescriptor.php | 2 --
.../Console/Descriptor/XmlDescriptor.php | 2 --
.../Console/Descriptor/JsonDescriptor.php | 2 --
.../Console/Descriptor/XmlDescriptor.php | 2 --
src/Symfony/Component/DomCrawler/Crawler.php | 32 +++++++++----------
.../Component/Form/NativeRequestHandler.php | 6 ++--
.../Component/HttpKernel/HttpCache/Store.php | 4 +--
7 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index c18d278688193..1b70e6d6d64e4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -179,8 +179,6 @@ protected function describeContainerParameter($parameter, array $options = [])
/**
* Writes data as json.
- *
- * @return array|string
*/
private function writeData(array $data, array $options)
{
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
index 53e2ee1fac358..638edbfade4f9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
@@ -132,8 +132,6 @@ protected function describeContainerParameter($parameter, array $options = [])
/**
* Writes DOM document.
- *
- * @return \DOMDocument|string
*/
private function writeDocument(\DOMDocument $dom)
{
diff --git a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
index f5a143800b27c..d1af3bab2a4a8 100644
--- a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
@@ -92,8 +92,6 @@ protected function describeApplication(Application $application, array $options
/**
* Writes data as json.
- *
- * @return array|string
*/
private function writeData(array $data, array $options)
{
diff --git a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
index 0cc0c9901f193..ace3191a847a1 100644
--- a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
@@ -179,8 +179,6 @@ private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
/**
* Writes DOM document.
- *
- * @return \DOMDocument|string
*/
private function writeDocument(\DOMDocument $dom)
{
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index 68d7c3dafce88..d9ae3ed7a7433 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -334,7 +334,7 @@ public function addNode(\DOMNode $node)
*
* @param int $position The position
*
- * @return self
+ * @return static
*/
public function eq($position)
{
@@ -377,7 +377,7 @@ public function each(\Closure $closure)
* @param int $offset
* @param int $length
*
- * @return self
+ * @return static
*/
public function slice($offset = 0, $length = null)
{
@@ -391,7 +391,7 @@ public function slice($offset = 0, $length = null)
*
* @param \Closure $closure An anonymous function
*
- * @return self
+ * @return static
*/
public function reduce(\Closure $closure)
{
@@ -408,7 +408,7 @@ public function reduce(\Closure $closure)
/**
* Returns the first node of the current selection.
*
- * @return self
+ * @return static
*/
public function first()
{
@@ -418,7 +418,7 @@ public function first()
/**
* Returns the last node of the current selection.
*
- * @return self
+ * @return static
*/
public function last()
{
@@ -428,7 +428,7 @@ public function last()
/**
* Returns the siblings nodes of the current selection.
*
- * @return self
+ * @return static
*
* @throws \InvalidArgumentException When current node is empty
*/
@@ -444,7 +444,7 @@ public function siblings()
/**
* Returns the next siblings nodes of the current selection.
*
- * @return self
+ * @return static
*
* @throws \InvalidArgumentException When current node is empty
*/
@@ -460,7 +460,7 @@ public function nextAll()
/**
* Returns the previous sibling nodes of the current selection.
*
- * @return self
+ * @return static
*
* @throws \InvalidArgumentException
*/
@@ -476,7 +476,7 @@ public function previousAll()
/**
* Returns the parents nodes of the current selection.
*
- * @return self
+ * @return static
*
* @throws \InvalidArgumentException When current node is empty
*/
@@ -501,7 +501,7 @@ public function parents()
/**
* Returns the children nodes of the current selection.
*
- * @return self
+ * @return static
*
* @throws \InvalidArgumentException When current node is empty
*/
@@ -664,7 +664,7 @@ public function extract($attributes)
*
* @param string $xpath An XPath expression
*
- * @return self
+ * @return static
*/
public function filterXPath($xpath)
{
@@ -685,7 +685,7 @@ public function filterXPath($xpath)
*
* @param string $selector A CSS selector
*
- * @return self
+ * @return static
*
* @throws \RuntimeException if the CssSelector Component is not available
*/
@@ -706,7 +706,7 @@ public function filter($selector)
*
* @param string $value The link text
*
- * @return self
+ * @return static
*/
public function selectLink($value)
{
@@ -721,7 +721,7 @@ public function selectLink($value)
*
* @param string $value The image alt
*
- * @return self A new instance of Crawler with the filtered list of nodes
+ * @return static A new instance of Crawler with the filtered list of nodes
*/
public function selectImage($value)
{
@@ -735,7 +735,7 @@ public function selectImage($value)
*
* @param string $value The button text
*
- * @return self
+ * @return static
*/
public function selectButton($value)
{
@@ -937,7 +937,7 @@ public static function xpathLiteral($s)
*
* @param string $xpath
*
- * @return self
+ * @return static
*/
private function filterRelativeXPath($xpath)
{
diff --git a/src/Symfony/Component/Form/NativeRequestHandler.php b/src/Symfony/Component/Form/NativeRequestHandler.php
index 5997fba67df15..69a2a1c7286fd 100644
--- a/src/Symfony/Component/Form/NativeRequestHandler.php
+++ b/src/Symfony/Component/Form/NativeRequestHandler.php
@@ -192,7 +192,7 @@ private static function getRequestMethod()
* This method is identical to {@link \Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray}
* and should be kept as such in order to port fixes quickly and easily.
*
- * @return array
+ * @return mixed
*/
private static function fixPhpFilesArray($data)
{
@@ -228,9 +228,7 @@ private static function fixPhpFilesArray($data)
/**
* Sets empty uploaded files to NULL in the given uploaded files array.
*
- * @param mixed $data The file upload data
- *
- * @return array|null Returns the stripped upload data
+ * @return mixed Returns the stripped upload data
*/
private static function stripEmptyFiles($data)
{
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
index d0eeb165291b3..9533cf637c509 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
@@ -350,13 +350,13 @@ private function doPurge($url)
*
* @param string $key The store key
*
- * @return string The data associated with the key
+ * @return string|null The data associated with the key
*/
private function load($key)
{
$path = $this->getPath($key);
- return file_exists($path) ? file_get_contents($path) : false;
+ return file_exists($path) ? file_get_contents($path) : null;
}
/**
From 5892837641956cdb746174146feb1cc67a7621c6 Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Wed, 7 Aug 2019 17:07:08 +0200
Subject: [PATCH 065/147] Resilience against file_get_contents() race
conditions.
---
src/Symfony/Component/HttpKernel/HttpCache/Store.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
index 9533cf637c509..c831ba2ac3ffb 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
@@ -356,7 +356,7 @@ private function load($key)
{
$path = $this->getPath($key);
- return file_exists($path) ? file_get_contents($path) : null;
+ return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null;
}
/**
From 63b71b5ade977f2b2f34b6db5af0b6a0cb296260 Mon Sep 17 00:00:00 2001
From: Tobias Schultze
Date: Wed, 7 Aug 2019 18:29:13 +0200
Subject: [PATCH 066/147] [Intl] fix nullable phpdocs and useless method
visibility of internal class
---
.../Component/Intl/Collator/Collator.php | 4 +--
.../DateFormat/FullTransformer.php | 29 ++++++-------------
.../Intl/DateFormatter/IntlDateFormatter.php | 4 +--
.../Intl/NumberFormatter/NumberFormatter.php | 14 ++++-----
4 files changed, 20 insertions(+), 31 deletions(-)
diff --git a/src/Symfony/Component/Intl/Collator/Collator.php b/src/Symfony/Component/Intl/Collator/Collator.php
index 62b1ddc9953e1..a87e0eb228867 100644
--- a/src/Symfony/Component/Intl/Collator/Collator.php
+++ b/src/Symfony/Component/Intl/Collator/Collator.php
@@ -70,7 +70,7 @@ class Collator
const SORT_STRING = 1;
/**
- * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
+ * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
*
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
*/
@@ -84,7 +84,7 @@ public function __construct($locale)
/**
* Static constructor.
*
- * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
+ * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
*
* @return self
*
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
index 13854ff719ef8..6edae72fc3719 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
@@ -69,16 +69,6 @@ public function __construct($pattern, $timezone)
];
}
- /**
- * Return the array of Transformer objects.
- *
- * @return Transformer[] Associative array of Transformer objects (format char => Transformer)
- */
- public function getTransformers()
- {
- return $this->transformers;
- }
-
/**
* Format a DateTime using ICU dateformat pattern.
*
@@ -105,7 +95,7 @@ public function format(\DateTime $dateTime)
*
* @throws NotImplementedException When it encounters a not implemented date character
*/
- public function formatReplace($dateChars, $dateTime)
+ private function formatReplace($dateChars, \DateTime $dateTime)
{
$length = \strlen($dateChars);
@@ -172,7 +162,7 @@ public function parse(\DateTime $dateTime, $value)
* @return string The reverse matching regular expression with named captures being formed by the
* transformer index in the $transformer array
*/
- public function getReverseMatchingRegExp($pattern)
+ private function getReverseMatchingRegExp($pattern)
{
$escapedPattern = preg_quote($pattern, '/');
@@ -189,9 +179,8 @@ public function getReverseMatchingRegExp($pattern)
return $this->replaceQuoteMatch($dateChars);
}
- $transformers = $this->getTransformers();
- if (isset($transformers[$transformerIndex])) {
- $transformer = $transformers[$transformerIndex];
+ if (isset($this->transformers[$transformerIndex])) {
+ $transformer = $this->transformers[$transformerIndex];
$captureName = str_repeat($transformerIndex, $length);
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
@@ -208,7 +197,7 @@ public function getReverseMatchingRegExp($pattern)
*
* @return bool true if matches, false otherwise
*/
- public function isQuoteMatch($quoteMatch)
+ private function isQuoteMatch($quoteMatch)
{
return "'" === $quoteMatch[0];
}
@@ -220,7 +209,7 @@ public function isQuoteMatch($quoteMatch)
*
* @return string A string with the single quotes replaced
*/
- public function replaceQuoteMatch($quoteMatch)
+ private function replaceQuoteMatch($quoteMatch)
{
if (preg_match("/^'+$/", $quoteMatch)) {
return str_replace("''", "'", $quoteMatch);
@@ -236,7 +225,7 @@ public function replaceQuoteMatch($quoteMatch)
*
* @return string The chars match regular expression
*/
- protected function buildCharsMatch($specialChars)
+ private function buildCharsMatch($specialChars)
{
$specialCharsArray = str_split($specialChars);
@@ -253,7 +242,7 @@ protected function buildCharsMatch($specialChars)
*
* @return array
*/
- protected function normalizeArray(array $data)
+ private function normalizeArray(array $data)
{
$ret = [];
@@ -280,7 +269,7 @@ protected function normalizeArray(array $data)
*
* @return bool|int The calculated timestamp or false if matched date is invalid
*/
- protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
+ private function calculateUnixTimestamp(\DateTime $dateTime, array $options)
{
$options = $this->getDefaultValueForOptions($options);
diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
index 197a2e3db06f1..c5e60aee632df 100644
--- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
@@ -118,7 +118,7 @@ class IntlDateFormatter
private $timeZoneId;
/**
- * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
+ * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param int|null $datetype Type of date formatting, one of the format type constants
* @param int|null $timetype Type of time formatting, one of the format type constants
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
@@ -152,7 +152,7 @@ public function __construct($locale, $datetype, $timetype, $timezone = null, $ca
/**
* Static constructor.
*
- * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
+ * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param int|null $datetype Type of date formatting, one of the format type constants
* @param int|null $timetype Type of time formatting, one of the format type constants
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
index 9ba821eac8009..5c31bdf554215 100644
--- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
+++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
@@ -241,13 +241,13 @@ class NumberFormatter
];
/**
- * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
- * @param int $style Style of the formatting, one of the format style constants.
- * The only supported styles are NumberFormatter::DECIMAL
- * and NumberFormatter::CURRENCY.
- * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
- * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
- * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
+ * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
+ * @param int $style Style of the formatting, one of the format style constants.
+ * The only supported styles are NumberFormatter::DECIMAL
+ * and NumberFormatter::CURRENCY.
+ * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
+ * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
+ * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
*
* @see http://www.php.net/manual/en/numberformatter.create.php
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
From 4ee54f0e84cb1a7ecc52264c4a7665d50c492601 Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Thu, 8 Aug 2019 08:39:07 +0200
Subject: [PATCH 067/147] [HttpKernel] Clarify error handler restoring process
again
---
src/Symfony/Component/HttpKernel/Kernel.php | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 9e283b47717f9..6d71214f1be70 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -597,10 +597,9 @@ protected function initializeContainer()
return;
}
- if ($this->debug) {
+ if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
$collectedLogs = [];
- $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
- $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
+ $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
}
@@ -636,7 +635,7 @@ protected function initializeContainer()
$container = $this->buildContainer();
$container->compile();
} finally {
- if ($this->debug && true !== $previousHandler) {
+ if ($collectDeprecations) {
restore_error_handler();
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
From 12b8c942eb0eedab0a960bd473102f145e7bef44 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Thu, 8 Aug 2019 08:47:22 +0200
Subject: [PATCH 068/147] consistently throw NotSupportException
---
src/Symfony/Component/Lock/Store/CombinedStore.php | 2 +-
src/Symfony/Component/Lock/Store/MemcachedStore.php | 3 ++-
src/Symfony/Component/Lock/Store/RedisStore.php | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/Lock/Store/CombinedStore.php b/src/Symfony/Component/Lock/Store/CombinedStore.php
index 6038b3be93d31..01c8785d01b56 100644
--- a/src/Symfony/Component/Lock/Store/CombinedStore.php
+++ b/src/Symfony/Component/Lock/Store/CombinedStore.php
@@ -94,7 +94,7 @@ public function save(Key $key)
public function waitAndSave(Key $key)
{
- throw new NotSupportedException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
+ throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
}
/**
diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php
index 7a51d6149b301..2ad920313dfd7 100644
--- a/src/Symfony/Component/Lock/Store/MemcachedStore.php
+++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php
@@ -13,6 +13,7 @@
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockConflictedException;
+use Symfony\Component\Lock\Exception\NotSupportedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\StoreInterface;
@@ -70,7 +71,7 @@ public function save(Key $key)
public function waitAndSave(Key $key)
{
- throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
+ throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
}
/**
diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php
index 6070c2e74e760..6ad47a33378ca 100644
--- a/src/Symfony/Component/Lock/Store/RedisStore.php
+++ b/src/Symfony/Component/Lock/Store/RedisStore.php
@@ -14,6 +14,7 @@
use Symfony\Component\Cache\Traits\RedisProxy;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockConflictedException;
+use Symfony\Component\Lock\Exception\NotSupportedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\StoreInterface;
@@ -72,7 +73,7 @@ public function save(Key $key)
public function waitAndSave(Key $key)
{
- throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
+ throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
}
/**
From e95b8a3291f95f47b6c638f237c4af752679552f Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 8 Aug 2019 14:31:29 +0200
Subject: [PATCH 069/147] [Cache] cs fix
---
src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php | 2 +-
.../Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php | 2 +-
src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
index 7b43c61c6a6fb..6aadbf266e9ce 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php
@@ -18,7 +18,7 @@ class PredisAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
{
- parent::setupBeforeClass();
+ parent::setUpBeforeClass();
self::$redis = new \Predis\Client(['host' => getenv('REDIS_HOST')]);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
index cd0dfb7a59090..1afabaf1d071c 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php
@@ -15,7 +15,7 @@ class PredisClusterAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
{
- parent::setupBeforeClass();
+ parent::setUpBeforeClass();
self::$redis = new \Predis\Client([['host' => getenv('REDIS_HOST')]]);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
index 0ab893a28ac31..edc6a9934f3e9 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
@@ -19,7 +19,7 @@ class RedisAdapterTest extends AbstractRedisAdapterTest
{
public static function setUpBeforeClass()
{
- parent::setupBeforeClass();
+ parent::setUpBeforeClass();
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]);
}
From f019b5214d4df69b6ff5d8c9461ed801c1e9c2f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 8 Aug 2019 14:51:39 +0200
Subject: [PATCH 070/147] Fix s-maxage=3 transient test
---
.../HttpKernel/Tests/HttpCache/HttpCacheTest.php | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
index 7b3cac78c734b..a50e09fb14f93 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
@@ -660,7 +660,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('miss');
$this->assertTraceContains('store');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
$this->request('GET', '/');
$this->assertHttpKernelIsNotCalled();
@@ -668,7 +668,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('fresh');
$this->assertTraceNotContains('store');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
// expires the cache
$values = $this->getMetaStorageValues();
@@ -688,7 +688,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('invalid');
$this->assertTraceContains('store');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
$this->setNextResponse();
@@ -698,7 +698,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('fresh');
$this->assertTraceNotContains('store');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
}
public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpiredWithStatus304()
@@ -711,7 +711,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('miss');
$this->assertTraceContains('store');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
$this->request('GET', '/');
$this->assertHttpKernelIsNotCalled();
@@ -739,7 +739,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('store');
$this->assertTraceNotContains('miss');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
$this->request('GET', '/');
$this->assertHttpKernelIsNotCalled();
@@ -747,7 +747,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
$this->assertTraceContains('fresh');
$this->assertTraceNotContains('store');
$this->assertEquals('Hello World', $this->response->getContent());
- $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
+ $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
}
public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirective()
From bb3cb64e64074ebd0c7d633aaf33cb08b1eddc27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 8 Aug 2019 15:49:16 +0200
Subject: [PATCH 071/147] Fix test compatibility with 4.x components
---
.../FormExtensionBootstrap3HorizontalLayoutTest.php | 7 ++++---
.../Tests/Extension/FormExtensionBootstrap3LayoutTest.php | 7 ++++---
.../FormExtensionBootstrap4HorizontalLayoutTest.php | 7 ++++---
.../Tests/Extension/FormExtensionBootstrap4LayoutTest.php | 7 ++++---
.../Twig/Tests/Extension/FormExtensionDivLayoutTest.php | 7 ++++---
.../Twig/Tests/Extension/FormExtensionTableLayoutTest.php | 7 ++++---
.../Tests/Templating/Helper/FormHelperDivLayoutTest.php | 7 ++++---
.../Tests/Templating/Helper/FormHelperTableLayoutTest.php | 7 ++++---
8 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
index 02f6ac9b1e269..b11d1720be0ba 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php
@@ -33,10 +33,11 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
*/
private $renderer;
- protected function setUp()
+ /**
+ * @before
+ */
+ public function doSetUp()
{
- parent::setUp();
-
$loader = new StubFilesystemLoader([
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
index 0c2ef171b254b..0bb5a7b6ce6bc 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
@@ -29,10 +29,11 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
*/
private $renderer;
- protected function setUp()
+ /**
+ * @before
+ */
+ public function doSetUp()
{
- parent::setUp();
-
$loader = new StubFilesystemLoader([
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
index 319c0e57308a2..02ab01fc573af 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php
@@ -35,10 +35,11 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori
private $renderer;
- protected function setUp()
+ /**
+ * @before
+ */
+ public function doSetUp()
{
- parent::setUp();
-
$loader = new StubFilesystemLoader([
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
index ea36552d85b71..cb2328b51fd45 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php
@@ -33,10 +33,11 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
*/
private $renderer;
- protected function setUp()
+ /**
+ * @before
+ */
+ public function doSetUp()
{
- parent::setUp();
-
$loader = new StubFilesystemLoader([
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
index 214df3c7f6b18..51e587411869f 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
@@ -33,10 +33,11 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
protected static $supportedFeatureSetVersion = 304;
- protected function setUp()
+ /**
+ * @before
+ */
+ public function doSetUp()
{
- parent::setUp();
-
$loader = new StubFilesystemLoader([
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
index f956767363a97..0676dffd57341 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
@@ -32,10 +32,11 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
protected static $supportedFeatureSetVersion = 304;
- protected function setUp()
+ /**
+ * @before
+ */
+ public function doSetUp()
{
- parent::setUp();
-
$loader = new StubFilesystemLoader([
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
index 03b2ed6961b7d..3ac44156292ef 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
@@ -52,11 +52,12 @@ protected function getExtensions()
]);
}
- protected function tearDown()
+ /**
+ * @after
+ */
+ public function doTearDown()
{
$this->engine = null;
-
- parent::tearDown();
}
public function testStartTagHasNoActionAttributeWhenActionIsEmpty()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
index bd088078c32d1..e7555b2341a9e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
@@ -77,11 +77,12 @@ protected function getExtensions()
]);
}
- protected function tearDown()
+ /**
+ * @after
+ */
+ public function doTearDown()
{
$this->engine = null;
-
- parent::tearDown();
}
protected function renderForm(FormView $view, array $vars = [])
From fab17a448720db8106134be2a6ce6c4177127d76 Mon Sep 17 00:00:00 2001
From: Arman Hosseini <44655055+Arman-Hosseini@users.noreply.github.com>
Date: Mon, 29 Jul 2019 21:55:29 +0430
Subject: [PATCH 072/147] Improve some URLs
---
...gisterEventListenersAndSubscribersPass.php | 4 +-
.../Bridge/Twig/Extension/CodeExtension.php | 2 +-
.../FrameworkExtension.php | 2 +-
.../Templating/Helper/CodeHelper.php | 2 +-
.../Tests/Controller/ControllerTraitTest.php | 4 +-
.../Command/ServerRunCommand.php | 2 +-
.../Command/ServerStartCommand.php | 2 +-
.../WebServerBundle/Resources/router.php | 2 +-
.../Component/Console/Command/Command.php | 2 +-
.../Component/Console/Input/ArgvInput.php | 2 +-
.../Console/Logger/ConsoleLogger.php | 2 +-
.../Debug/Tests/ExceptionHandlerTest.php | 2 +-
.../Compiler/PriorityTaggedServiceTrait.php | 4 +-
.../Tests/AbstractEventDispatcherTest.php | 2 +-
.../Component/Filesystem/Filesystem.php | 4 +-
.../Filesystem/Tests/FilesystemTestCase.php | 2 +-
.../DateTimeToLocalizedStringTransformer.php | 4 +-
.../DateTimeToStringTransformer.php | 2 +-
.../Form/Extension/Core/Type/BaseType.php | 2 +-
.../Form/Extension/Core/Type/DateType.php | 4 +-
.../Component/HttpFoundation/CHANGELOG.md | 2 +-
.../File/MimeType/FileinfoMimeTypeGuesser.php | 2 +-
.../Component/HttpFoundation/JsonResponse.php | 2 +-
.../Component/HttpFoundation/ParameterBag.php | 2 +-
.../HttpFoundation/RedirectResponse.php | 2 +-
.../Component/HttpFoundation/Request.php | 10 ++---
.../Component/HttpFoundation/Response.php | 6 +--
.../Component/HttpFoundation/ServerBag.php | 2 +-
.../Handler/MemcachedSessionHandler.php | 2 +-
.../Storage/Handler/MongoDbSessionHandler.php | 2 +-
.../Handler/NativeFileSessionHandler.php | 2 +-
.../Storage/Handler/NativeSessionHandler.php | 2 +-
.../Storage/Handler/PdoSessionHandler.php | 8 ++--
.../Session/Storage/NativeSessionStorage.php | 14 +++---
.../Storage/SessionStorageInterface.php | 2 +-
.../EventListener/SaveSessionListener.php | 2 +-
.../HttpKernel/Profiler/Profiler.php | 2 +-
.../Component/Intl/Collator/Collator.php | 16 +++----
.../Data/Generator/LanguageDataGenerator.php | 2 +-
.../Util/ArrayAccessibleResourceBundle.php | 2 +-
.../DateFormat/TimezoneTransformer.php | 3 +-
.../Intl/DateFormatter/IntlDateFormatter.php | 44 +++++++++----------
src/Symfony/Component/Intl/Locale/Locale.php | 34 +++++++-------
.../Intl/NumberFormatter/NumberFormatter.php | 36 +++++++--------
src/Symfony/Component/Intl/README.md | 2 +-
.../Component/Process/Pipes/WindowsPipes.php | 10 ++---
src/Symfony/Component/Process/Process.php | 8 ++--
.../Component/Process/ProcessUtils.php | 4 +-
.../Component/Process/Tests/ProcessTest.php | 2 +-
.../Serializer/Encoder/JsonDecode.php | 2 +-
.../Normalizer/DateTimeNormalizer.php | 2 +-
.../AbstractComparisonValidator.php | 2 +-
.../Validator/Constraints/RangeValidator.php | 2 +-
.../Tests/Constraints/IpValidatorTest.php | 2 +-
.../Component/VarDumper/Caster/DateCaster.php | 4 +-
.../Workflow/Dumper/GraphvizDumper.php | 2 +-
56 files changed, 147 insertions(+), 148 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
index f602d28766aec..3b7714f44d9ad 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
@@ -120,8 +120,8 @@ private function getEventManagerDef(ContainerBuilder $container, $name)
* and knowing that the \SplPriorityQueue class does not respect the FIFO method,
* we should not use this class.
*
- * @see https://bugs.php.net/bug.php?id=53710
- * @see https://bugs.php.net/bug.php?id=60926
+ * @see https://bugs.php.net/53710
+ * @see https://bugs.php.net/60926
*
* @param string $tagName
* @param ContainerBuilder $container
diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
index 55855427e99ac..717d4de697986 100644
--- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
@@ -136,7 +136,7 @@ public function fileExcerpt($file, $line, $srcContext = 3)
{
if (is_file($file) && is_readable($file)) {
// highlight_file could throw warnings
- // see https://bugs.php.net/bug.php?id=25725
+ // see https://bugs.php.net/25725
$code = @highlight_file($file, true);
// remove main code/span tags
$code = preg_replace('#^\s*(.*)\s*#s', '\\1', $code);
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 8243ac65fd864..32ec7933ca669 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -234,7 +234,7 @@ public function load(array $configs, ContainerBuilder $container)
if ($this->isConfigEnabled($container, $config['session'])) {
if (!\extension_loaded('session')) {
- throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://www.php.net/session.installation for instructions.');
+ throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://php.net/session.installation for instructions.');
}
$this->sessionConfigEnabled = true;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
index c8914c3a58580..a6c3668322edb 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
@@ -125,7 +125,7 @@ public function fileExcerpt($file, $line)
}
// highlight_file could throw warnings
- // see https://bugs.php.net/bug.php?id=25725
+ // see https://bugs.php.net/25725
$code = @highlight_file($file, true);
// remove main code/span tags
$code = preg_replace('#^\s*(.*)\s*#s', '\\1', $code);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
index da950ce0c8041..34242136b7b51 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
@@ -431,10 +431,10 @@ public function testGenerateUrl()
public function testRedirect()
{
$controller = $this->createController();
- $response = $controller->redirect('http://dunglas.fr', 301);
+ $response = $controller->redirect('https://dunglas.fr', 301);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response);
- $this->assertSame('http://dunglas.fr', $response->getTargetUrl());
+ $this->assertSame('https://dunglas.fr', $response->getTargetUrl());
$this->assertSame(301, $response->getStatusCode());
}
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php
index c5b0973320424..7ae1f419cd95f 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php
@@ -76,7 +76,7 @@ protected function configure()
%command.full_name% --router=app/config/router.php
-See also: http://www.php.net/manual/en/features.commandline.webserver.php
+See also: https://php.net/features.commandline.webserver
EOF
)
;
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
index 22447c66d9d26..415b372830345 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
@@ -76,7 +76,7 @@ protected function configure()
php %command.full_name% --router=app/config/router.php
-See also: http://www.php.net/manual/en/features.commandline.webserver.php
+See also: https://php.net/features.commandline.webserver
EOF
)
;
diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/router.php b/src/Symfony/Bundle/WebServerBundle/Resources/router.php
index 30d6b258a29de..d93ffef70ccef 100644
--- a/src/Symfony/Bundle/WebServerBundle/Resources/router.php
+++ b/src/Symfony/Bundle/WebServerBundle/Resources/router.php
@@ -12,7 +12,7 @@
/*
* This file implements rewrite rules for PHP built-in web server.
*
- * See: http://www.php.net/manual/en/features.commandline.webserver.php
+ * See: https://php.net/features.commandline.webserver
*
* If you have custom directory layout, then you have to write your own router
* and pass it as a value to 'router' option of server:run command.
diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php
index 5f30da7a2a5a9..3a1ba2e5aa08e 100644
--- a/src/Symfony/Component/Console/Command/Command.php
+++ b/src/Symfony/Component/Console/Command/Command.php
@@ -278,7 +278,7 @@ public function setCode(callable $code)
$r = new \ReflectionFunction($code);
if (null === $r->getClosureThis()) {
if (\PHP_VERSION_ID < 70000) {
- // Bug in PHP5: https://bugs.php.net/bug.php?id=64761
+ // Bug in PHP5: https://bugs.php.net/64761
// This means that we cannot bind static closures and therefore we must
// ignore any errors here. There is no way to test if the closure is
// bindable.
diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php
index f604057ec0255..cc1f6079e4535 100644
--- a/src/Symfony/Component/Console/Input/ArgvInput.php
+++ b/src/Symfony/Component/Console/Input/ArgvInput.php
@@ -148,7 +148,7 @@ private function parseLongOption($token)
if (false !== $pos = strpos($name, '=')) {
if (0 === \strlen($value = substr($name, $pos + 1))) {
// if no value after "=" then substr() returns "" since php7 only, false before
- // see http://php.net/manual/fr/migration70.incompatible.php#119151
+ // see https://php.net/migration70.incompatible.php#119151
if (\PHP_VERSION_ID < 70000 && false === $value) {
$value = '';
}
diff --git a/src/Symfony/Component/Console/Logger/ConsoleLogger.php b/src/Symfony/Component/Console/Logger/ConsoleLogger.php
index e531bb1ca56ce..b4821e0955aa2 100644
--- a/src/Symfony/Component/Console/Logger/ConsoleLogger.php
+++ b/src/Symfony/Component/Console/Logger/ConsoleLogger.php
@@ -22,7 +22,7 @@
*
* @author Kévin Dunglas
*
- * @see http://www.php-fig.org/psr/psr-3/
+ * @see https://www.php-fig.org/psr/psr-3/
*/
class ConsoleLogger extends AbstractLogger
{
diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
index 8a196649503c3..58abc3d76e122 100644
--- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
@@ -116,7 +116,7 @@ public function testHandleWithACustomHandlerThatOutputsSomething()
});
$handler->handle(new \Exception());
- ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/bug.php?id=76563
+ ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/76563
$this->assertSame('ccc', ob_get_clean());
}
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
index daff3495acdb7..5b7475b394d29 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
@@ -28,8 +28,8 @@ trait PriorityTaggedServiceTrait
* and knowing that the \SplPriorityQueue class does not respect the FIFO method,
* we should not use that class.
*
- * @see https://bugs.php.net/bug.php?id=53710
- * @see https://bugs.php.net/bug.php?id=60926
+ * @see https://bugs.php.net/53710
+ * @see https://bugs.php.net/60926
*
* @param string $tagName
* @param ContainerBuilder $container
diff --git a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
index b157659dc0846..359e6005febce 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
@@ -267,7 +267,7 @@ public function testEventReceivesTheDispatcherInstanceAsArgument()
}
/**
- * @see https://bugs.php.net/bug.php?id=62976
+ * @see https://bugs.php.net/62976
*
* This bug affects:
* - The PHP 5.3 branch for versions < 5.3.18
diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php
index a6e372ebf15a3..cd4e2b9811697 100644
--- a/src/Symfony/Component/Filesystem/Filesystem.php
+++ b/src/Symfony/Component/Filesystem/Filesystem.php
@@ -52,7 +52,7 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
}
if ($doCopy) {
- // https://bugs.php.net/bug.php?id=64634
+ // https://bugs.php.net/64634
if (false === $source = @fopen($originFile, 'r')) {
throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
}
@@ -280,7 +280,7 @@ public function rename($origin, $target, $overwrite = false)
if (true !== @rename($origin, $target)) {
if (is_dir($origin)) {
- // See https://bugs.php.net/bug.php?id=54097 & http://php.net/manual/en/function.rename.php#113943
+ // See https://bugs.php.net/54097 & https://php.net/rename#113943
$this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
$this->remove($origin);
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
index eb6b35ddfd621..0948bc1857f1a 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
@@ -144,7 +144,7 @@ protected function markAsSkippedIfSymlinkIsMissing($relative = false)
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
}
- // https://bugs.php.net/bug.php?id=69473
+ // https://bugs.php.net/69473
if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
$this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions');
}
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
index 6ca20106fa399..9b5e4f4f5a538 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
@@ -136,7 +136,7 @@ public function reverseTransform($value)
$dateTime = new \DateTime(sprintf('@%s', $timestamp));
}
// set timezone separately, as it would be ignored if set via the constructor,
- // see http://php.net/manual/en/datetime.construct.php
+ // see https://php.net/datetime.construct
$dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
} catch (\Exception $e) {
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
@@ -169,7 +169,7 @@ protected function getIntlDateFormatter($ignoreTimezone = false)
$intlDateFormatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormat, $timeFormat, $timezone, $calendar, $pattern);
- // new \intlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
+ // new \intlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/66323
if (!$intlDateFormatter) {
throw new TransformationFailedException(intl_get_error_message(), intl_get_error_code());
}
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
index 55501298b224f..cb4b4db73356f 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
@@ -57,7 +57,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $form
$this->generateFormat = $this->parseFormat = $format;
- // See http://php.net/manual/en/datetime.createfromformat.php
+ // See https://php.net/datetime.createfromformat
// The character "|" in the format makes sure that the parts of a date
// that are *not* specified in the format are reset to the corresponding
// values from 1970-01-01 00:00:00 instead of the current time.
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
index 32825ab7af9cf..05d215f63c8ee 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
@@ -71,7 +71,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
// Strip leading underscores and digits. These are allowed in
// form names, but not in HTML4 ID attributes.
- // http://www.w3.org/TR/html401/struct/global.html#adef-id
+ // https://www.w3.org/TR/html401/struct/global#adef-id
$id = ltrim($id, '_0123456789');
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
index 8ab5e9cc8a57b..464c262c13680 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
@@ -107,13 +107,13 @@ public function buildForm(FormBuilderInterface $builder, array $options)
\Locale::getDefault(),
$dateFormat,
$timeFormat,
- // see https://bugs.php.net/bug.php?id=66323
+ // see https://bugs.php.net/66323
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
$calendar,
$pattern
);
- // new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
+ // new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/66323
if (!$formatter) {
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
}
diff --git a/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/src/Symfony/Component/HttpFoundation/CHANGELOG.md
index 7bfde80ff1290..c0d8901677917 100644
--- a/src/Symfony/Component/HttpFoundation/CHANGELOG.md
+++ b/src/Symfony/Component/HttpFoundation/CHANGELOG.md
@@ -21,7 +21,7 @@ CHANGELOG
-----
* the `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument,
- see http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html for more info,
+ see https://symfony.com/doc/current/deployment/proxies.html for more info,
* deprecated the `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods,
* added `File\Stream`, to be passed to `BinaryFileResponse` when the size of the served file is unknown,
disabling `Range` and `Content-Length` handling, switching to chunked encoding instead
diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php
index bf1ee9f5db620..62feda2eefc57 100644
--- a/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php
+++ b/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php
@@ -26,7 +26,7 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
/**
* @param string $magicFile A magic file to use with the finfo instance
*
- * @see http://www.php.net/manual/en/function.finfo-open.php
+ * @see https://php.net/finfo-open
*/
public function __construct($magicFile = null)
{
diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php
index a9bdac30f8956..b0e76516759de 100644
--- a/src/Symfony/Component/HttpFoundation/JsonResponse.php
+++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php
@@ -100,7 +100,7 @@ public static function fromJsonString($data = null, $status = 200, $headers = []
public function setCallback($callback = null)
{
if (null !== $callback) {
- // partially taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
+ // partially taken from https://geekality.net/2011/08/03/valid-javascript-identifier/
// partially taken from https://github.com/willdurand/JsonpCallbackValidator
// JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details.
// (c) William Durand
diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php
index f05e4a2154ecb..194ba2c6c57ef 100644
--- a/src/Symfony/Component/HttpFoundation/ParameterBag.php
+++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php
@@ -191,7 +191,7 @@ public function getBoolean($key, $default = false)
* @param int $filter FILTER_* constant
* @param mixed $options Filter options
*
- * @see http://php.net/manual/en/function.filter-var.php
+ * @see https://php.net/filter-var
*
* @return mixed
*/
diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php
index 51fd869abea25..4e3cb4f77b28b 100644
--- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php
+++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php
@@ -30,7 +30,7 @@ class RedirectResponse extends Response
*
* @throws \InvalidArgumentException
*
- * @see http://tools.ietf.org/html/rfc2616#section-10.3
+ * @see https://tools.ietf.org/html/rfc2616#section-10.3
*/
public function __construct($url, $status = 302, $headers = [])
{
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 7185d75e92209..2dd250b80cd9c 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -915,7 +915,7 @@ public function getClientIps()
* @return string|null The client IP address
*
* @see getClientIps()
- * @see http://en.wikipedia.org/wiki/X-Forwarded-For
+ * @see https://wikipedia.org/wiki/X-Forwarded-For
*/
public function getClientIp()
{
@@ -1204,7 +1204,7 @@ public function getRelativeUriForPath($path)
// A reference to the same base directory or an empty subdirectory must be prefixed with "./".
// This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
// as the first segment of a relative-path reference, as it would be mistaken for a scheme name
- // (see http://tools.ietf.org/html/rfc3986#section-4.2).
+ // (see https://tools.ietf.org/html/rfc3986#section-4.2).
return !isset($path[0]) || '/' === $path[0]
|| false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos)
? "./$path" : $path;
@@ -1823,7 +1823,7 @@ public function getAcceptableContentTypes()
* It works if your JavaScript library sets an X-Requested-With HTTP header.
* It is known to work with common JavaScript frameworks:
*
- * @see http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript
+ * @see https://wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript
*
* @return bool true if the request is an XMLHttpRequest, false otherwise
*/
@@ -1835,9 +1835,9 @@ public function isXmlHttpRequest()
/*
* The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24)
*
- * Code subject to the new BSD license (http://framework.zend.com/license/new-bsd).
+ * Code subject to the new BSD license (https://framework.zend.com/license).
*
- * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * Copyright (c) 2005-2010 Zend Technologies USA Inc. (https://www.zend.com/)
*/
protected function prepareRequestUri()
diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index 4ab05066f4745..47dae95345cd4 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -121,7 +121,7 @@ class Response
* Status codes translation table.
*
* The list of codes is complete according to the
- * {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry}
+ * {@link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Hypertext Transfer Protocol (HTTP) Status Code Registry}
* (last updated 2016-03-01).
*
* Unless otherwise noted, the status code is defined in RFC2616.
@@ -1025,7 +1025,7 @@ public function setCache(array $options)
*
* @return $this
*
- * @see http://tools.ietf.org/html/rfc2616#section-10.3.5
+ * @see https://tools.ietf.org/html/rfc2616#section-10.3.5
*
* @final since version 3.3
*/
@@ -1133,7 +1133,7 @@ public function isNotModified(Request $request)
*
* @return bool
*
- * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
+ * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
*
* @final since version 3.2
*/
diff --git a/src/Symfony/Component/HttpFoundation/ServerBag.php b/src/Symfony/Component/HttpFoundation/ServerBag.php
index 90da49fae5dbe..4c82b1774873f 100644
--- a/src/Symfony/Component/HttpFoundation/ServerBag.php
+++ b/src/Symfony/Component/HttpFoundation/ServerBag.php
@@ -79,7 +79,7 @@ public function getHeaders()
/*
* XXX: Since there is no PHP_AUTH_BEARER in PHP predefined variables,
* I'll just set $headers['AUTHORIZATION'] here.
- * http://php.net/manual/en/reserved.variables.server.php
+ * https://php.net/reserved.variables.server
*/
$headers['AUTHORIZATION'] = $authorizationHeader;
}
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
index 1db590b360783..8965c089c15de 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
@@ -15,7 +15,7 @@
* Memcached based session storage handler based on the Memcached class
* provided by the PHP memcached extension.
*
- * @see http://php.net/memcached
+ * @see https://php.net/memcached
*
* @author Drak
*/
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php
index ddedacffbce4e..1dd72406699df 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php
@@ -56,7 +56,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
* { "expireAfterSeconds": 0 }
* )
*
- * More details on: http://docs.mongodb.org/manual/tutorial/expire-data/
+ * More details on: https://docs.mongodb.org/manual/tutorial/expire-data/
*
* If you use such an index, you can drop `gc_probability` to 0 since
* no garbage-collection is required.
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php
index 04bcbbfe320b3..8b7615ec10e08 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php
@@ -23,7 +23,7 @@ class NativeFileSessionHandler extends NativeSessionHandler
* Default null will leave setting as defined by PHP.
* '/path', 'N;/path', or 'N;octal-mode;/path
*
- * @see https://php.net/manual/session.configuration.php#ini.session.save-path for further details.
+ * @see https://php.net/session.configuration#ini.session.save-path for further details.
*
* @throws \InvalidArgumentException On invalid $savePath
* @throws \RuntimeException When failing to create the save directory
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
index 9be4528aeb436..5159b1e359a0f 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
@@ -13,7 +13,7 @@
/**
* @deprecated since version 3.4, to be removed in 4.0. Use \SessionHandler instead.
- * @see http://php.net/sessionhandler
+ * @see https://php.net/sessionhandler
*/
class NativeSessionHandler extends \SessionHandler
{
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
index 9369740eb6dd5..9a50377bcb0d1 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -32,7 +32,7 @@
* Saving it in a character column could corrupt the data. You can use createTable()
* to initialize a correctly defined table.
*
- * @see http://php.net/sessionhandlerinterface
+ * @see https://php.net/sessionhandlerinterface
*
* @author Fabien Potencier
* @author Michael Williams
@@ -538,7 +538,7 @@ private function buildDsnFromUrl($dsnOrUrl)
* PDO::rollback or PDO::inTransaction for SQLite.
*
* Also MySQLs default isolation, REPEATABLE READ, causes deadlock for different sessions
- * due to http://www.mysqlperformanceblog.com/2013/12/12/one-more-innodb-gap-lock-to-avoid/ .
+ * due to https://percona.com/blog/2013/12/12/one-more-innodb-gap-lock-to-avoid/ .
* So we change it to READ COMMITTED.
*/
private function beginTransaction()
@@ -864,7 +864,7 @@ private function getMergeStatement($sessionId, $data, $maxlifetime)
break;
case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='):
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon
- // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
+ // It also requires HOLDLOCK according to https://weblogs.sqlteam.com/dang/2009/01/31/upsert-race-condition-with-merge/
$mergeSql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ".
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ".
"WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;";
@@ -877,7 +877,7 @@ private function getMergeStatement($sessionId, $data, $maxlifetime)
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)";
break;
default:
- // MERGE is not supported with LOBs: http://www.oracle.com/technetwork/articles/fuecks-lobs-095315.html
+ // MERGE is not supported with LOBs: https://oracle.com/technetwork/articles/fuecks-lobs-095315.html
return null;
}
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
index 809d7002cf1cb..4f1c30ef523f6 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
@@ -54,7 +54,7 @@ class NativeSessionStorage implements SessionStorageInterface
*
* List of options for $options array with their defaults.
*
- * @see http://php.net/session.configuration for options
+ * @see https://php.net/session.configuration for options
* but we omit 'session.' from the beginning of the keys for convenience.
*
* ("auto_start", is not supported as it tells PHP to start a session before
@@ -212,7 +212,7 @@ public function regenerate($destroy = false, $lifetime = null)
$isRegenerated = session_regenerate_id($destroy);
// The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
- // @see https://bugs.php.net/bug.php?id=70013
+ // @see https://bugs.php.net/70013
$this->loadSession();
return $isRegenerated;
@@ -337,7 +337,7 @@ public function isStarted()
*
* @param array $options Session ini directives [key => value]
*
- * @see http://php.net/session.configuration
+ * @see https://php.net/session.configuration
*/
public function setOptions(array $options)
{
@@ -378,10 +378,10 @@ public function setOptions(array $options)
* constructor, for a template see NativeFileSessionHandler or use handlers in
* composer package drak/native-session
*
- * @see http://php.net/session-set-save-handler
- * @see http://php.net/sessionhandlerinterface
- * @see http://php.net/sessionhandler
- * @see http://github.com/drak/NativeSession
+ * @see https://php.net/session-set-save-handler
+ * @see https://php.net/sessionhandlerinterface
+ * @see https://php.net/sessionhandler
+ * @see https://github.com/zikula/NativeSession
*
* @param \SessionHandlerInterface|null $saveHandler
*
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php
index 66e8b33dd2bed..eeb396a2f131c 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php
@@ -77,7 +77,7 @@ public function setName($name);
* only delete the session data from persistent storage.
*
* Care: When regenerating the session ID no locking is involved in PHP's
- * session design. See https://bugs.php.net/bug.php?id=61470 for a discussion.
+ * session design. See https://bugs.php.net/61470 for a discussion.
* So you must make sure the regenerated session is saved BEFORE sending the
* headers with the new ID. Symfony's HttpKernel offers a listener for this.
* See Symfony\Component\HttpKernel\EventListener\SaveSessionListener.
diff --git a/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php
index 5901200a70f72..5f5cd24801f7f 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php
@@ -29,7 +29,7 @@
* the one above. But by saving the session before long-running things in the terminate event,
* we ensure the session is not blocked longer than needed.
* * When regenerating the session ID no locking is involved in PHPs session design. See
- * https://bugs.php.net/bug.php?id=61470 for a discussion. So in this case, the session must
+ * https://bugs.php.net/61470 for a discussion. So in this case, the session must
* be saved anyway before sending the headers with the new session ID. Otherwise session
* data could get lost again for concurrent requests with the new ID. One result could be
* that you get logged out after just logging in.
diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php
index edf6cb833017d..db85a9d1155f0 100644
--- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php
+++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php
@@ -130,7 +130,7 @@ public function purge()
*
* @return array An array of tokens
*
- * @see http://php.net/manual/en/datetime.formats.php for the supported date/time formats
+ * @see https://php.net/datetime.formats for the supported date/time formats
*/
public function find($ip, $url, $limit, $method, $start, $end, $statusCode = null)
{
diff --git a/src/Symfony/Component/Intl/Collator/Collator.php b/src/Symfony/Component/Intl/Collator/Collator.php
index 62b1ddc9953e1..4c57003336071 100644
--- a/src/Symfony/Component/Intl/Collator/Collator.php
+++ b/src/Symfony/Component/Intl/Collator/Collator.php
@@ -130,7 +130,7 @@ public function asort(&$array, $sortFlag = self::SORT_REGULAR)
* 0 if $str1 is equal than $str2
* -1 if $str1 is less than $str2
*
- * @see http://www.php.net/manual/en/collator.compare.php
+ * @see https://php.net/collator.compare
*
* @throws MethodNotImplementedException
*/
@@ -146,7 +146,7 @@ public function compare($str1, $str2)
*
* @return bool|int The attribute value on success or false on error
*
- * @see http://www.php.net/manual/en/collator.getattribute.php
+ * @see https://php.net/collator.getattribute
*
* @throws MethodNotImplementedException
*/
@@ -195,7 +195,7 @@ public function getLocale($type = Locale::ACTUAL_LOCALE)
*
* @return string The collation key for $string
*
- * @see http://www.php.net/manual/en/collator.getsortkey.php
+ * @see https://php.net/collator.getsortkey
*
* @throws MethodNotImplementedException
*/
@@ -209,7 +209,7 @@ public function getSortKey($string)
*
* @return bool|int The current collator's strength or false on failure
*
- * @see http://www.php.net/manual/en/collator.getstrength.php
+ * @see https://php.net/collator.getstrength
*
* @throws MethodNotImplementedException
*/
@@ -226,7 +226,7 @@ public function getStrength()
*
* @return bool True on success or false on failure
*
- * @see http://www.php.net/manual/en/collator.setattribute.php
+ * @see https://php.net/collator.setattribute
*
* @throws MethodNotImplementedException
*/
@@ -248,7 +248,7 @@ public function setAttribute($attr, $val)
*
* @return bool True on success or false on failure
*
- * @see http://www.php.net/manual/en/collator.setstrength.php
+ * @see https://php.net/collator.setstrength
*
* @throws MethodNotImplementedException
*/
@@ -264,7 +264,7 @@ public function setStrength($strength)
*
* @return bool True on success or false on failure
*
- * @see http://www.php.net/manual/en/collator.sortwithsortkeys.php
+ * @see https://php.net/collator.sortwithsortkeys
*
* @throws MethodNotImplementedException
*/
@@ -284,7 +284,7 @@ public function sortWithSortKeys(&$arr)
*
* @return bool True on success or false on failure
*
- * @see http://www.php.net/manual/en/collator.sort.php
+ * @see https://php.net/collator.sort
*
* @throws MethodNotImplementedException
*/
diff --git a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
index e8695e19319d5..ceb57360b0e12 100644
--- a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
+++ b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
@@ -27,7 +27,7 @@
class LanguageDataGenerator extends AbstractDataGenerator
{
/**
- * Source: http://www-01.sil.org/iso639-3/codes.asp.
+ * Source: https://iso639-3.sil.org/code_tables/639/data
*/
private static $preferredAlpha2ToAlpha3Mapping = [
'ak' => 'aka',
diff --git a/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php b/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php
index dcc2befde6f73..d1de8d5b096e7 100644
--- a/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php
+++ b/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php
@@ -16,7 +16,7 @@
/**
* Work-around for a bug in PHP's \ResourceBundle implementation.
*
- * More information can be found on https://bugs.php.net/bug.php?id=64356.
+ * More information can be found on https://bugs.php.net/64356.
* This class can be removed once that bug is fixed.
*
* @author Bernhard Schussek
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
index c77fbc160b5bb..0b347c3930731 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
@@ -92,8 +92,7 @@ public function extractDateOptions($matched, $length)
*
* @return string A timezone identifier
*
- * @see http://php.net/manual/en/timezones.others.php
- * @see http://www.twinsun.com/tz/tz-link.htm
+ * @see https://php.net/timezones.others
*
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
* @throws \InvalidArgumentException When the value can not be matched with pattern
diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
index 0f19310f22bff..e7fabfeab0209 100644
--- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
@@ -126,7 +126,7 @@ class IntlDateFormatter
* supported value is IntlDateFormatter::GREGORIAN (or null using the default calendar, i.e. "GREGORIAN")
* @param string|null $pattern Optional pattern to use when formatting
*
- * @see http://www.php.net/manual/en/intldateformatter.create.php
+ * @see https://php.net/intldateformatter.create
* @see http://userguide.icu-project.org/formatparse/datetime
*
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
@@ -162,7 +162,7 @@ public function __construct($locale, $datetype, $timetype, $timezone = null, $ca
*
* @return self
*
- * @see http://www.php.net/manual/en/intldateformatter.create.php
+ * @see https://php.net/intldateformatter.create
* @see http://userguide.icu-project.org/formatparse/datetime
*
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
@@ -180,7 +180,7 @@ public static function create($locale, $datetype, $timetype, $timezone = null, $
*
* @return string|bool The formatted value or false if formatting failed
*
- * @see http://www.php.net/manual/en/intldateformatter.format.php
+ * @see https://php.net/intldateformatter.format
*
* @throws MethodArgumentValueNotImplementedException If one of the formatting characters is not implemented
*/
@@ -231,7 +231,7 @@ public function format($timestamp)
*
* @return string The formatted value
*
- * @see http://www.php.net/manual/en/intldateformatter.formatobject.php
+ * @see https://php.net/intldateformatter.formatobject
*
* @throws MethodNotImplementedException
*/
@@ -246,7 +246,7 @@ public function formatObject($object, $format = null, $locale = null)
* @return int The calendar being used by the formatter. Currently always returns
* IntlDateFormatter::GREGORIAN.
*
- * @see http://www.php.net/manual/en/intldateformatter.getcalendar.php
+ * @see https://php.net/intldateformatter.getcalendar
*/
public function getCalendar()
{
@@ -258,7 +258,7 @@ public function getCalendar()
*
* @return object The calendar's object being used by the formatter
*
- * @see http://www.php.net/manual/en/intldateformatter.getcalendarobject.php
+ * @see https://php.net/intldateformatter.getcalendarobject
*
* @throws MethodNotImplementedException
*/
@@ -272,7 +272,7 @@ public function getCalendarObject()
*
* @return int The current value of the formatter
*
- * @see http://www.php.net/manual/en/intldateformatter.getdatetype.php
+ * @see https://php.net/intldateformatter.getdatetype
*/
public function getDateType()
{
@@ -284,7 +284,7 @@ public function getDateType()
*
* @return int The error code from last formatter call
*
- * @see http://www.php.net/manual/en/intldateformatter.geterrorcode.php
+ * @see https://php.net/intldateformatter.geterrorcode
*/
public function getErrorCode()
{
@@ -296,7 +296,7 @@ public function getErrorCode()
*
* @return string The error message from last formatter call
*
- * @see http://www.php.net/manual/en/intldateformatter.geterrormessage.php
+ * @see https://php.net/intldateformatter.geterrormessage
*/
public function getErrorMessage()
{
@@ -311,7 +311,7 @@ public function getErrorMessage()
* @return string The locale used to create the formatter. Currently always
* returns "en".
*
- * @see http://www.php.net/manual/en/intldateformatter.getlocale.php
+ * @see https://php.net/intldateformatter.getlocale
*/
public function getLocale($type = Locale::ACTUAL_LOCALE)
{
@@ -323,7 +323,7 @@ public function getLocale($type = Locale::ACTUAL_LOCALE)
*
* @return string The pattern string used by the formatter
*
- * @see http://www.php.net/manual/en/intldateformatter.getpattern.php
+ * @see https://php.net/intldateformatter.getpattern
*/
public function getPattern()
{
@@ -335,7 +335,7 @@ public function getPattern()
*
* @return int The time type used by the formatter
*
- * @see http://www.php.net/manual/en/intldateformatter.gettimetype.php
+ * @see https://php.net/intldateformatter.gettimetype
*/
public function getTimeType()
{
@@ -347,7 +347,7 @@ public function getTimeType()
*
* @return string The timezone identifier used by the formatter
*
- * @see http://www.php.net/manual/en/intldateformatter.gettimezoneid.php
+ * @see https://php.net/intldateformatter.gettimezoneid
*/
public function getTimeZoneId()
{
@@ -363,7 +363,7 @@ public function getTimeZoneId()
*
* @return mixed The timezone used by the formatter
*
- * @see http://www.php.net/manual/en/intldateformatter.gettimezone.php
+ * @see https://php.net/intldateformatter.gettimezone
*
* @throws MethodNotImplementedException
*/
@@ -377,7 +377,7 @@ public function getTimeZone()
*
* @return bool Currently always returns false
*
- * @see http://www.php.net/manual/en/intldateformatter.islenient.php
+ * @see https://php.net/intldateformatter.islenient
*
* @throws MethodNotImplementedException
*/
@@ -397,7 +397,7 @@ public function isLenient()
*
* @return string Localtime compatible array of integers: contains 24 hour clock value in tm_hour field
*
- * @see http://www.php.net/manual/en/intldateformatter.localtime.php
+ * @see https://php.net/intldateformatter.localtime
*
* @throws MethodNotImplementedException
*/
@@ -417,7 +417,7 @@ public function localtime($value, &$position = 0)
*
* @return int Parsed value as a timestamp
*
- * @see http://www.php.net/manual/en/intldateformatter.parse.php
+ * @see https://php.net/intldateformatter.parse
*
* @throws MethodArgumentNotImplementedException When $position different than null, behavior not implemented
*/
@@ -447,7 +447,7 @@ public function parse($value, &$position = null)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/intldateformatter.setcalendar.php
+ * @see https://php.net/intldateformatter.setcalendar
*
* @throws MethodNotImplementedException
*/
@@ -469,7 +469,7 @@ public function setCalendar($calendar)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/intldateformatter.setlenient.php
+ * @see https://php.net/intldateformatter.setlenient
*
* @throws MethodArgumentValueNotImplementedException When $lenient is true
*/
@@ -489,7 +489,7 @@ public function setLenient($lenient)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/intldateformatter.setpattern.php
+ * @see https://php.net/intldateformatter.setpattern
* @see http://userguide.icu-project.org/formatparse/datetime
*/
public function setPattern($pattern)
@@ -512,7 +512,7 @@ public function setPattern($pattern)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/intldateformatter.settimezoneid.php
+ * @see https://php.net/intldateformatter.settimezoneid
*/
public function setTimeZoneId($timeZoneId)
{
@@ -556,7 +556,7 @@ public function setTimeZoneId($timeZoneId)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/intldateformatter.settimezone.php
+ * @see https://php.net/intldateformatter.settimezone
*/
public function setTimeZone($timeZone)
{
diff --git a/src/Symfony/Component/Intl/Locale/Locale.php b/src/Symfony/Component/Intl/Locale/Locale.php
index 2aa9eb7b090af..b228a90dae1d5 100644
--- a/src/Symfony/Component/Intl/Locale/Locale.php
+++ b/src/Symfony/Component/Intl/Locale/Locale.php
@@ -48,7 +48,7 @@ class Locale
*
* @return string The corresponding locale code
*
- * @see http://www.php.net/manual/en/locale.acceptfromhttp.php
+ * @see https://php.net/locale.acceptfromhttp
*
* @throws MethodNotImplementedException
*/
@@ -64,7 +64,7 @@ public static function acceptFromHttp($header)
*
* @return string The corresponding locale code
*
- * @see http://www.php.net/manual/en/locale.composelocale.php
+ * @see https://php.net/locale.composelocale
*
* @throws MethodNotImplementedException
*/
@@ -82,7 +82,7 @@ public static function composeLocale(array $subtags)
*
* @return string The corresponding locale code
*
- * @see http://www.php.net/manual/en/locale.filtermatches.php
+ * @see https://php.net/locale.filtermatches
*
* @throws MethodNotImplementedException
*/
@@ -98,7 +98,7 @@ public static function filterMatches($langtag, $locale, $canonicalize = false)
*
* @return array The locale variants
*
- * @see http://www.php.net/manual/en/locale.getallvariants.php
+ * @see https://php.net/locale.getallvariants
*
* @throws MethodNotImplementedException
*/
@@ -112,7 +112,7 @@ public static function getAllVariants($locale)
*
* @return string The default locale code. Always returns 'en'
*
- * @see http://www.php.net/manual/en/locale.getdefault.php
+ * @see https://php.net/locale.getdefault
*/
public static function getDefault()
{
@@ -127,7 +127,7 @@ public static function getDefault()
*
* @return string The localized language display name
*
- * @see http://www.php.net/manual/en/locale.getdisplaylanguage.php
+ * @see https://php.net/locale.getdisplaylanguage
*
* @throws MethodNotImplementedException
*/
@@ -144,7 +144,7 @@ public static function getDisplayLanguage($locale, $inLocale = null)
*
* @return string The localized locale display name
*
- * @see http://www.php.net/manual/en/locale.getdisplayname.php
+ * @see https://php.net/locale.getdisplayname
*
* @throws MethodNotImplementedException
*/
@@ -161,7 +161,7 @@ public static function getDisplayName($locale, $inLocale = null)
*
* @return string The localized region display name
*
- * @see http://www.php.net/manual/en/locale.getdisplayregion.php
+ * @see https://php.net/locale.getdisplayregion
*
* @throws MethodNotImplementedException
*/
@@ -178,7 +178,7 @@ public static function getDisplayRegion($locale, $inLocale = null)
*
* @return string The localized script display name
*
- * @see http://www.php.net/manual/en/locale.getdisplayscript.php
+ * @see https://php.net/locale.getdisplayscript
*
* @throws MethodNotImplementedException
*/
@@ -195,7 +195,7 @@ public static function getDisplayScript($locale, $inLocale = null)
*
* @return string The localized variant display name
*
- * @see http://www.php.net/manual/en/locale.getdisplayvariant.php
+ * @see https://php.net/locale.getdisplayvariant
*
* @throws MethodNotImplementedException
*/
@@ -211,7 +211,7 @@ public static function getDisplayVariant($locale, $inLocale = null)
*
* @return array Associative array with the extracted variants
*
- * @see http://www.php.net/manual/en/locale.getkeywords.php
+ * @see https://php.net/locale.getkeywords
*
* @throws MethodNotImplementedException
*/
@@ -227,7 +227,7 @@ public static function getKeywords($locale)
*
* @return string|null The extracted language code or null in case of error
*
- * @see http://www.php.net/manual/en/locale.getprimarylanguage.php
+ * @see https://php.net/locale.getprimarylanguage
*
* @throws MethodNotImplementedException
*/
@@ -243,7 +243,7 @@ public static function getPrimaryLanguage($locale)
*
* @return string|null The extracted region code or null if not present
*
- * @see http://www.php.net/manual/en/locale.getregion.php
+ * @see https://php.net/locale.getregion
*
* @throws MethodNotImplementedException
*/
@@ -259,7 +259,7 @@ public static function getRegion($locale)
*
* @return string|null The extracted script code or null if not present
*
- * @see http://www.php.net/manual/en/locale.getscript.php
+ * @see https://php.net/locale.getscript
*
* @throws MethodNotImplementedException
*/
@@ -276,7 +276,7 @@ public static function getScript($locale)
* @param bool $canonicalize If true, the arguments will be converted to canonical form before matching
* @param string $default The locale to use if no match is found
*
- * @see http://www.php.net/manual/en/locale.lookup.php
+ * @see https://php.net/locale.lookup
*
* @throws MethodNotImplementedException
*/
@@ -292,7 +292,7 @@ public static function lookup(array $langtag, $locale, $canonicalize = false, $d
*
* @return array Associative array with the extracted subtags
*
- * @see http://www.php.net/manual/en/locale.parselocale.php
+ * @see https://php.net/locale.parselocale
*
* @throws MethodNotImplementedException
*/
@@ -308,7 +308,7 @@ public static function parseLocale($locale)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/locale.setdefault.php
+ * @see https://php.net/locale.setdefault
*
* @throws MethodNotImplementedException
*/
diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
index 9ba821eac8009..e57d0f3240463 100644
--- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
+++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
@@ -198,7 +198,7 @@ class NumberFormatter
* The mapping between NumberFormatter rounding modes to the available
* modes in PHP's round() function.
*
- * @see http://www.php.net/manual/en/function.round.php
+ * @see https://php.net/round
*/
private static $phpRoundingMap = [
self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN,
@@ -249,7 +249,7 @@ class NumberFormatter
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
*
- * @see http://www.php.net/manual/en/numberformatter.create.php
+ * @see https://php.net/numberformatter.create
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
* @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details
*
@@ -288,7 +288,7 @@ public function __construct($locale = 'en', $style = null, $pattern = null)
*
* @return self
*
- * @see http://www.php.net/manual/en/numberformatter.create.php
+ * @see https://php.net/numberformatter.create
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
* @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details
*
@@ -309,7 +309,7 @@ public static function create($locale = 'en', $style = null, $pattern = null)
*
* @return string The formatted currency value
*
- * @see http://www.php.net/manual/en/numberformatter.formatcurrency.php
+ * @see https://php.net/numberformatter.formatcurrency
* @see https://en.wikipedia.org/wiki/ISO_4217#Active_codes
*/
public function formatCurrency($value, $currency)
@@ -346,7 +346,7 @@ public function formatCurrency($value, $currency)
*
* @return bool|string The formatted value or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.format.php
+ * @see https://php.net/numberformatter.format
*
* @throws NotImplementedException If the method is called with the class $style 'CURRENCY'
* @throws MethodArgumentValueNotImplementedException If the $type is different than TYPE_DEFAULT
@@ -387,7 +387,7 @@ public function format($value, $type = self::TYPE_DEFAULT)
*
* @return bool|int The attribute value on success or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.getattribute.php
+ * @see https://php.net/numberformatter.getattribute
*/
public function getAttribute($attr)
{
@@ -399,7 +399,7 @@ public function getAttribute($attr)
*
* @return int The error code from last formatter call
*
- * @see http://www.php.net/manual/en/numberformatter.geterrorcode.php
+ * @see https://php.net/numberformatter.geterrorcode
*/
public function getErrorCode()
{
@@ -411,7 +411,7 @@ public function getErrorCode()
*
* @return string The error message from last formatter call
*
- * @see http://www.php.net/manual/en/numberformatter.geterrormessage.php
+ * @see https://php.net/numberformatter.geterrormessage
*/
public function getErrorMessage()
{
@@ -428,7 +428,7 @@ public function getErrorMessage()
* @return string The locale used to create the formatter. Currently always
* returns "en".
*
- * @see http://www.php.net/manual/en/numberformatter.getlocale.php
+ * @see https://php.net/numberformatter.getlocale
*/
public function getLocale($type = Locale::ACTUAL_LOCALE)
{
@@ -440,7 +440,7 @@ public function getLocale($type = Locale::ACTUAL_LOCALE)
*
* @return bool|string The pattern string used by the formatter or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.getpattern.php
+ * @see https://php.net/numberformatter.getpattern
*
* @throws MethodNotImplementedException
*/
@@ -456,7 +456,7 @@ public function getPattern()
*
* @return bool|string The symbol value or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.getsymbol.php
+ * @see https://php.net/numberformatter.getsymbol
*/
public function getSymbol($attr)
{
@@ -470,7 +470,7 @@ public function getSymbol($attr)
*
* @return bool|string The attribute value or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.gettextattribute.php
+ * @see https://php.net/numberformatter.gettextattribute
*/
public function getTextAttribute($attr)
{
@@ -486,7 +486,7 @@ public function getTextAttribute($attr)
*
* @return bool|string The parsed numeric value or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.parsecurrency.php
+ * @see https://php.net/numberformatter.parsecurrency
*
* @throws MethodNotImplementedException
*/
@@ -504,7 +504,7 @@ public function parseCurrency($value, &$currency, &$position = null)
*
* @return int|float|false The parsed value or false on error
*
- * @see http://www.php.net/manual/en/numberformatter.parse.php
+ * @see https://php.net/numberformatter.parse
*/
public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
{
@@ -558,7 +558,7 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/numberformatter.setattribute.php
+ * @see https://php.net/numberformatter.setattribute
*
* @throws MethodArgumentValueNotImplementedException When the $attr is not supported
* @throws MethodArgumentValueNotImplementedException When the $value is not supported
@@ -608,7 +608,7 @@ public function setAttribute($attr, $value)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/numberformatter.setpattern.php
+ * @see https://php.net/numberformatter.setpattern
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
*
* @throws MethodNotImplementedException
@@ -626,7 +626,7 @@ public function setPattern($pattern)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/numberformatter.setsymbol.php
+ * @see https://php.net/numberformatter.setsymbol
*
* @throws MethodNotImplementedException
*/
@@ -643,7 +643,7 @@ public function setSymbol($attr, $value)
*
* @return bool true on success or false on failure
*
- * @see http://www.php.net/manual/en/numberformatter.settextattribute.php
+ * @see https://php.net/numberformatter.settextattribute
*
* @throws MethodNotImplementedException
*/
diff --git a/src/Symfony/Component/Intl/README.md b/src/Symfony/Component/Intl/README.md
index 9a9cb9b45614e..03b50c91a048f 100644
--- a/src/Symfony/Component/Intl/README.md
+++ b/src/Symfony/Component/Intl/README.md
@@ -18,4 +18,4 @@ Resources
* [Docker images with intl support](https://hub.docker.com/r/jakzal/php-intl)
(for the Intl component development)
-[0]: http://www.php.net/manual/en/intl.setup.php
+[0]: https://php.net/intl.setup
diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php
index 1619e632f134a..e8e6f139e55b3 100644
--- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php
+++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php
@@ -17,8 +17,8 @@
/**
* WindowsPipes implementation uses temporary files as handles.
*
- * @see https://bugs.php.net/bug.php?id=51800
- * @see https://bugs.php.net/bug.php?id=65650
+ * @see https://bugs.php.net/51800
+ * @see https://bugs.php.net/65650
*
* @author Romain Neutron
*
@@ -43,7 +43,7 @@ public function __construct($input, $haveReadSupport)
// Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
//
- // @see https://bugs.php.net/bug.php?id=51800
+ // @see https://bugs.php.net/51800
$pipes = [
Process::STDOUT => Process::OUT,
Process::STDERR => Process::ERR,
@@ -105,8 +105,8 @@ public function getDescriptors()
];
}
- // We're not using pipe on Windows platform as it hangs (https://bugs.php.net/bug.php?id=51800)
- // We're not using file handles as it can produce corrupted output https://bugs.php.net/bug.php?id=65650
+ // We're not using pipe on Windows platform as it hangs (https://bugs.php.net/51800)
+ // We're not using file handles as it can produce corrupted output https://bugs.php.net/65650
// So we redirect output within the commandline and pass the nul device to the process
return [
['pipe', 'r'],
diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php
index 68cc6c65ae5a9..d592be27cf461 100644
--- a/src/Symfony/Component/Process/Process.php
+++ b/src/Symfony/Component/Process/Process.php
@@ -152,8 +152,8 @@ public function __construct($commandline, $cwd = null, array $env = null, $input
// on Windows, if the cwd changed via chdir(), proc_open defaults to the dir where PHP was started
// on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
- // @see : https://bugs.php.net/bug.php?id=51800
- // @see : https://bugs.php.net/bug.php?id=50524
+ // @see : https://bugs.php.net/51800
+ // @see : https://bugs.php.net/50524
if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
$this->cwd = getcwd();
}
@@ -451,7 +451,7 @@ public function getPid()
/**
* Sends a POSIX signal to the process.
*
- * @param int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
+ * @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants)
*
* @return $this
*
@@ -1578,7 +1578,7 @@ private function resetProcessData()
/**
* Sends a POSIX signal to the process.
*
- * @param int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
+ * @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants)
* @param bool $throwException Whether to throw exception in case signal failed
*
* @return bool True if the signal was sent successfully, false otherwise
diff --git a/src/Symfony/Component/Process/ProcessUtils.php b/src/Symfony/Component/Process/ProcessUtils.php
index c06aa247aad9d..00acde0a196e0 100644
--- a/src/Symfony/Component/Process/ProcessUtils.php
+++ b/src/Symfony/Component/Process/ProcessUtils.php
@@ -44,8 +44,8 @@ public static function escapeArgument($argument)
//Fix for PHP bug #43784 escapeshellarg removes % from given string
//Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
- //@see https://bugs.php.net/bug.php?id=43784
- //@see https://bugs.php.net/bug.php?id=49446
+ //@see https://bugs.php.net/43784
+ //@see https://bugs.php.net/49446
if ('\\' === \DIRECTORY_SEPARATOR) {
if ('' === $argument) {
return escapeshellarg($argument);
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 18fef4ff5ff17..ab6f0b0063650 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -1178,7 +1178,7 @@ public function pipesCodeProvider()
];
if ('\\' === \DIRECTORY_SEPARATOR) {
- // Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650
+ // Avoid XL buffers on Windows because of https://bugs.php.net/65650
$sizes = [1, 2, 4, 8];
} else {
$sizes = [1, 16, 64, 1024, 4096];
diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
index a55f1232e7e98..e4f6795a6a4f2 100644
--- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
+++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
@@ -62,7 +62,7 @@ public function __construct($associative = false, $depth = 512)
*
* @throws NotEncodableValueException
*
- * @see http://php.net/json_decode json_decode
+ * @see https://php.net/json_decode
*/
public function decode($data, $format, array $context = [])
{
diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php
index a36549c3b225c..86c3b8d0293aa 100644
--- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php
@@ -90,7 +90,7 @@ public function denormalize($data, $class, $format = null, array $context = [])
if (null !== $dateTimeFormat) {
if (null === $timezone && \PHP_VERSION_ID < 70000) {
- // https://bugs.php.net/bug.php?id=68669
+ // https://bugs.php.net/68669
$object = \DateTime::class === $class ? \DateTime::createFromFormat($dateTimeFormat, $data) : \DateTimeImmutable::createFromFormat($dateTimeFormat, $data);
} else {
$object = \DateTime::class === $class ? \DateTime::createFromFormat($dateTimeFormat, $data, $timezone) : \DateTimeImmutable::createFromFormat($dateTimeFormat, $data, $timezone);
diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
index 3c95c097e8e9a..e5c3fd5ea619e 100644
--- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
+++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
@@ -64,7 +64,7 @@ public function validate($value, Constraint $constraint)
// Convert strings to DateTimes if comparing another DateTime
// This allows to compare with any date/time value supported by
// the DateTime constructor:
- // http://php.net/manual/en/datetime.formats.php
+ // https://php.net/datetime.formats
if (\is_string($comparedValue)) {
if ($value instanceof \DateTimeImmutable) {
// If $value is immutable, convert the compared value to a
diff --git a/src/Symfony/Component/Validator/Constraints/RangeValidator.php b/src/Symfony/Component/Validator/Constraints/RangeValidator.php
index e0cb92a93e9ec..c7cb859a5af62 100644
--- a/src/Symfony/Component/Validator/Constraints/RangeValidator.php
+++ b/src/Symfony/Component/Validator/Constraints/RangeValidator.php
@@ -48,7 +48,7 @@ public function validate($value, Constraint $constraint)
// Convert strings to DateTimes if comparing another DateTime
// This allows to compare with any date/time value supported by
// the DateTime constructor:
- // http://php.net/manual/en/datetime.formats.php
+ // https://php.net/datetime.formats
if ($value instanceof \DateTimeInterface) {
if (\is_string($min)) {
$min = new \DateTime($min);
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
index 1ee44e7c518d6..7e5a97ce3c0e2 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
@@ -330,7 +330,7 @@ public function getInvalidReservedIpsV6()
{
// Quoting after official filter documentation:
// "FILTER_FLAG_NO_RES_RANGE = This flag does not apply to IPv6 addresses."
- // Full description: http://php.net/manual/en/filter.filters.flags.php
+ // Full description: https://php.net/filter.filters.flags
return $this->getInvalidIpsV6();
}
diff --git a/src/Symfony/Component/VarDumper/Caster/DateCaster.php b/src/Symfony/Component/VarDumper/Caster/DateCaster.php
index 40289a930b7be..f3258b19a6f28 100644
--- a/src/Symfony/Component/VarDumper/Caster/DateCaster.php
+++ b/src/Symfony/Component/VarDumper/Caster/DateCaster.php
@@ -85,12 +85,12 @@ public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stu
public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter)
{
- if (\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { // see https://bugs.php.net/bug.php?id=71635
+ if (\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { // see https://bugs.php.net/71635
return $a;
}
$dates = [];
- if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/bug.php?id=74639
+ if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/74639
foreach (clone $p as $i => $d) {
if (3 === $i) {
$now = new \DateTimeImmutable();
diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
index 6f98350aa329b..c3d673fa91e58 100644
--- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
+++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
@@ -17,7 +17,7 @@
/**
* GraphvizDumper dumps a workflow as a graphviz file.
*
- * You can convert the generated dot file with the dot utility (http://www.graphviz.org/):
+ * You can convert the generated dot file with the dot utility (https://graphviz.org/):
*
* dot -Tpng workflow.dot > workflow.png
*
From 02a90d2066d3a8c924a139a6cc4422d118179ae8 Mon Sep 17 00:00:00 2001
From: Tobias Schultze
Date: Thu, 8 Aug 2019 18:50:30 +0200
Subject: [PATCH 073/147] [Intl] use strict comparisons
---
.../DateFormat/Hour1200Transformer.php | 2 +-
.../DateFormat/Hour2400Transformer.php | 6 +-
.../DateFormat/Hour2401Transformer.php | 4 +-
.../DateFormat/TimezoneTransformer.php | 2 +-
.../Intl/NumberFormatter/NumberFormatter.php | 58 +++++++++++--------
5 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour1200Transformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour1200Transformer.php
index 157d242875ef7..70cf965b28698 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour1200Transformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour1200Transformer.php
@@ -26,7 +26,7 @@ class Hour1200Transformer extends HourTransformer
public function format(\DateTime $dateTime, $length)
{
$hourOfDay = $dateTime->format('g');
- $hourOfDay = '12' == $hourOfDay ? '0' : $hourOfDay;
+ $hourOfDay = '12' === $hourOfDay ? '0' : $hourOfDay;
return $this->padLeft($hourOfDay, $length);
}
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2400Transformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2400Transformer.php
index 904a03691f373..1904c958bfbea 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2400Transformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2400Transformer.php
@@ -33,9 +33,11 @@ public function format(\DateTime $dateTime, $length)
*/
public function normalizeHour($hour, $marker = null)
{
- if ('AM' == $marker) {
+ $marker = (string) $marker;
+
+ if ('AM' === $marker) {
$hour = 0;
- } elseif ('PM' == $marker) {
+ } elseif ('PM' === $marker) {
$hour = 12;
}
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2401Transformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2401Transformer.php
index e2988d852a653..f289bd129540e 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2401Transformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Hour2401Transformer.php
@@ -26,7 +26,7 @@ class Hour2401Transformer extends HourTransformer
public function format(\DateTime $dateTime, $length)
{
$hourOfDay = $dateTime->format('G');
- $hourOfDay = ('0' == $hourOfDay) ? '24' : $hourOfDay;
+ $hourOfDay = '0' === $hourOfDay ? '24' : $hourOfDay;
return $this->padLeft($hourOfDay, $length);
}
@@ -36,7 +36,7 @@ public function format(\DateTime $dateTime, $length)
*/
public function normalizeHour($hour, $marker = null)
{
- if ((null === $marker && 24 === $hour) || 'AM' == $marker) {
+ if ((null === $marker && 24 == $hour) || 'AM' == $marker) {
$hour = 0;
} elseif ('PM' == $marker) {
$hour = 12;
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
index 0b347c3930731..e024951cb328c 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php
@@ -102,7 +102,7 @@ public static function getEtcTimeZoneId($formattedTimeZone)
if (preg_match('/GMT(?P[+-])(?P\d{2}):?(?P\d{2})/', $formattedTimeZone, $matches)) {
$hours = (int) $matches['hours'];
$minutes = (int) $matches['minutes'];
- $signal = '-' == $matches['signal'] ? '+' : '-';
+ $signal = '-' === $matches['signal'] ? '+' : '-';
if (0 < $minutes) {
throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.', $formattedTimeZone));
diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
index 5ff5e35391816..e0426b364bd63 100644
--- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
+++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
@@ -272,19 +272,19 @@ public function __construct($locale = 'en', $style = null, $pattern = null)
throw new MethodArgumentNotImplementedException(__METHOD__, 'pattern');
}
- $this->style = $style;
+ $this->style = null !== $style ? (int) $style : null;
}
/**
* Static constructor.
*
- * @param string $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
- * @param int $style Style of the formatting, one of the format style constants.
- * The only currently supported styles are NumberFormatter::DECIMAL
- * and NumberFormatter::CURRENCY.
- * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
- * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
- * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
+ * @param string|null $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
+ * @param int $style Style of the formatting, one of the format style constants.
+ * The only currently supported styles are NumberFormatter::DECIMAL
+ * and NumberFormatter::CURRENCY.
+ * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
+ * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
+ * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
*
* @return self
*
@@ -314,7 +314,7 @@ public static function create($locale = 'en', $style = null, $pattern = null)
*/
public function formatCurrency($value, $currency)
{
- if (self::DECIMAL == $this->style) {
+ if (self::DECIMAL === $this->style) {
return $this->format($value);
}
@@ -353,19 +353,21 @@ public function formatCurrency($value, $currency)
*/
public function format($value, $type = self::TYPE_DEFAULT)
{
+ $type = (int) $type;
+
// The original NumberFormatter does not support this format type
- if (self::TYPE_CURRENCY == $type) {
+ if (self::TYPE_CURRENCY === $type) {
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
return false;
}
- if (self::CURRENCY == $this->style) {
+ if (self::CURRENCY === $this->style) {
throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
}
// Only the default type is supported.
- if (self::TYPE_DEFAULT != $type) {
+ if (self::TYPE_DEFAULT !== $type) {
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'type', $type, 'Only TYPE_DEFAULT is supported');
}
@@ -385,7 +387,7 @@ public function format($value, $type = self::TYPE_DEFAULT)
*
* @param int $attr An attribute specifier, one of the numeric attribute constants
*
- * @return bool|int The attribute value on success or false on error
+ * @return int|false The attribute value on success or false on error
*
* @see https://php.net/numberformatter.getattribute
*/
@@ -438,7 +440,7 @@ public function getLocale($type = Locale::ACTUAL_LOCALE)
/**
* Not supported. Returns the formatter's pattern.
*
- * @return bool|string The pattern string used by the formatter or false on error
+ * @return string|false The pattern string used by the formatter or false on error
*
* @see https://php.net/numberformatter.getpattern
*
@@ -454,7 +456,7 @@ public function getPattern()
*
* @param int $attr A symbol specifier, one of the format symbol constants
*
- * @return bool|string The symbol value or false on error
+ * @return string|false The symbol value or false on error
*
* @see https://php.net/numberformatter.getsymbol
*/
@@ -468,7 +470,7 @@ public function getSymbol($attr)
*
* @param int $attr An attribute specifier, one of the text attribute constants
*
- * @return bool|string The attribute value or false on error
+ * @return string|false The attribute value or false on error
*
* @see https://php.net/numberformatter.gettextattribute
*/
@@ -484,7 +486,7 @@ public function getTextAttribute($attr)
* @param string $currency Parameter to receive the currency name (reference)
* @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended
*
- * @return bool|string The parsed numeric value or false on error
+ * @return float|false The parsed numeric value or false on error
*
* @see https://php.net/numberformatter.parsecurrency
*
@@ -508,7 +510,9 @@ public function parseCurrency($value, &$currency, &$position = null)
*/
public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
{
- if (self::TYPE_DEFAULT == $type || self::TYPE_CURRENCY == $type) {
+ $type = (int) $type;
+
+ if (self::TYPE_DEFAULT === $type || self::TYPE_CURRENCY === $type) {
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
return false;
@@ -565,6 +569,8 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
*/
public function setAttribute($attr, $value)
{
+ $attr = (int) $attr;
+
if (!\in_array($attr, self::$supportedAttributes)) {
$message = sprintf(
'The available attributes are: %s',
@@ -574,7 +580,7 @@ public function setAttribute($attr, $value)
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'attr', $value, $message);
}
- if (self::$supportedAttributes['ROUNDING_MODE'] == $attr && $this->isInvalidRoundingMode($value)) {
+ if (self::$supportedAttributes['ROUNDING_MODE'] === $attr && $this->isInvalidRoundingMode($value)) {
$message = sprintf(
'The supported values for ROUNDING_MODE are: %s',
implode(', ', array_keys(self::$roundingModes))
@@ -583,11 +589,11 @@ public function setAttribute($attr, $value)
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'attr', $value, $message);
}
- if (self::$supportedAttributes['GROUPING_USED'] == $attr) {
+ if (self::$supportedAttributes['GROUPING_USED'] === $attr) {
$value = $this->normalizeGroupingUsedValue($value);
}
- if (self::$supportedAttributes['FRACTION_DIGITS'] == $attr) {
+ if (self::$supportedAttributes['FRACTION_DIGITS'] === $attr) {
$value = $this->normalizeFractionDigitsValue($value);
if ($value < 0) {
// ignore negative values but do not raise an error
@@ -763,7 +769,7 @@ private function formatNumber($value, $precision)
*/
private function getUninitializedPrecision($value, $precision)
{
- if (self::CURRENCY == $this->style) {
+ if (self::CURRENCY === $this->style) {
return $precision;
}
@@ -799,11 +805,13 @@ private function isInitializedAttribute($attr)
*/
private function convertValueDataType($value, $type)
{
- if (self::TYPE_DOUBLE == $type) {
+ $type = (int) $type;
+
+ if (self::TYPE_DOUBLE === $type) {
$value = (float) $value;
- } elseif (self::TYPE_INT32 == $type) {
+ } elseif (self::TYPE_INT32 === $type) {
$value = $this->getInt32Value($value);
- } elseif (self::TYPE_INT64 == $type) {
+ } elseif (self::TYPE_INT64 === $type) {
$value = $this->getInt64Value($value);
}
From abb8a676ba782ea41afae738c8db2e7a6c28345b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 8 Aug 2019 19:35:41 +0200
Subject: [PATCH 074/147] Fix negative DateInterval
---
.../Normalizer/DateIntervalNormalizer.php | 28 ++++++++++++++++--
.../Normalizer/DateIntervalNormalizerTest.php | 29 ++++++++++++++++---
2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php
index 56527a8eb4ecf..bd43091bf1ac4 100644
--- a/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php
@@ -29,7 +29,7 @@ class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterfa
/**
* @param string $format
*/
- public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS')
+ public function __construct($format = '%rP%yY%mM%dDT%hH%iM%sS')
{
$this->format = $format;
}
@@ -76,12 +76,34 @@ public function denormalize($data, $class, $format = null, array $context = [])
$dateIntervalFormat = isset($context[self::FORMAT_KEY]) ? $context[self::FORMAT_KEY] : $this->format;
- $valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $dateIntervalFormat).'$/';
+ $signPattern = '';
+ switch (substr($dateIntervalFormat, 0, 2)) {
+ case '%R':
+ $signPattern = '[-+]';
+ $dateIntervalFormat = substr($dateIntervalFormat, 2);
+ break;
+ case '%r':
+ $signPattern = '-?';
+ $dateIntervalFormat = substr($dateIntervalFormat, 2);
+ break;
+ }
+ $valuePattern = '/^'.$signPattern.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $dateIntervalFormat).'$/';
if (!preg_match($valuePattern, $data)) {
throw new UnexpectedValueException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $data, $dateIntervalFormat));
}
try {
+ if ('-' === $data[0]) {
+ $interval = new \DateInterval(substr($data, 1));
+ $interval->invert = 1;
+
+ return $interval;
+ }
+
+ if ('+' === $data[0]) {
+ return new \DateInterval(substr($data, 1));
+ }
+
return new \DateInterval($data);
} catch (\Exception $e) {
throw new UnexpectedValueException($e->getMessage(), $e->getCode(), $e);
@@ -98,6 +120,6 @@ public function supportsDenormalization($data, $type, $format = null)
private function isISO8601($string)
{
- return preg_match('/^P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
+ return preg_match('/^[\-+]?P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
index efe34c6e9510e..f0bcdef161da3 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php
@@ -29,6 +29,11 @@ public function dataProviderISO()
['P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT16H5M'],
['P%yY%mM%dDT%hH', 'P10Y2M3DT16H', 'P10Y2M3DT16H'],
['P%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'],
+ ['%RP%yY%mM%dD', '-P10Y2M3D', '-P10Y2M3DT0H'],
+ ['%RP%yY%mM%dD', '+P10Y2M3D', '+P10Y2M3DT0H'],
+ ['%RP%yY%mM%dD', '+P10Y2M3D', 'P10Y2M3DT0H'],
+ ['%rP%yY%mM%dD', '-P10Y2M3D', '-P10Y2M3DT0H'],
+ ['%rP%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'],
];
return $data;
@@ -50,7 +55,7 @@ public function testNormalize()
*/
public function testNormalizeUsingFormatPassedInContext($format, $output, $input)
{
- $this->assertEquals($output, $this->normalizer->normalize(new \DateInterval($input), null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
+ $this->assertEquals($output, $this->normalizer->normalize($this->getInterval($input), null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
}
/**
@@ -58,7 +63,7 @@ public function testNormalizeUsingFormatPassedInContext($format, $output, $input
*/
public function testNormalizeUsingFormatPassedInConstructor($format, $output, $input)
{
- $this->assertEquals($output, (new DateIntervalNormalizer($format))->normalize(new \DateInterval($input)));
+ $this->assertEquals($output, (new DateIntervalNormalizer($format))->normalize($this->getInterval($input)));
}
public function testNormalizeInvalidObjectThrowsException()
@@ -84,7 +89,7 @@ public function testDenormalize()
*/
public function testDenormalizeUsingFormatPassedInContext($format, $input, $output)
{
- $this->assertDateIntervalEquals(new \DateInterval($output), $this->normalizer->denormalize($input, \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
+ $this->assertDateIntervalEquals($this->getInterval($input), $this->normalizer->denormalize($input, \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
}
/**
@@ -92,7 +97,7 @@ public function testDenormalizeUsingFormatPassedInContext($format, $input, $outp
*/
public function testDenormalizeUsingFormatPassedInConstructor($format, $input, $output)
{
- $this->assertDateIntervalEquals(new \DateInterval($output), (new DateIntervalNormalizer($format))->denormalize($input, \DateInterval::class));
+ $this->assertDateIntervalEquals($this->getInterval($input), (new DateIntervalNormalizer($format))->denormalize($input, \DateInterval::class));
}
public function testDenormalizeExpectsString()
@@ -124,4 +129,20 @@ private function assertDateIntervalEquals(\DateInterval $expected, \DateInterval
{
$this->assertEquals($expected->format('%RP%yY%mM%dDT%hH%iM%sS'), $actual->format('%RP%yY%mM%dDT%hH%iM%sS'));
}
+
+ private function getInterval($data)
+ {
+ if ('-' === $data[0]) {
+ $interval = new \DateInterval(substr($data, 1));
+ $interval->invert = 1;
+
+ return $interval;
+ }
+
+ if ('+' === $data[0]) {
+ return new \DateInterval(substr($data, 1));
+ }
+
+ return new \DateInterval($data);
+ }
}
From 9c45a8e093e47e4fbb27b299aadda9364d651dec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Thu, 8 Aug 2019 21:45:19 +0200
Subject: [PATCH 075/147] Replace warning by isolated test
---
.../CacheWarmer/ValidatorCacheWarmerTest.php | 8 +++----
.../Resource/ClassExistenceResourceTest.php | 14 +++++-------
.../Tests/Compiler/AutowirePassTest.php | 20 ++++++++---------
.../Compiler/ResolveBindingsPassTest.php | 7 +++---
.../Tests/Dumper/PhpDumperTest.php | 8 +++----
.../Tests/Loader/FileLoaderTest.php | 22 ++++++++-----------
6 files changed, 33 insertions(+), 46 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
index 9923b032c048d..1fa8883a7833e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
-use PHPUnit\Framework\Warning;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -22,12 +21,11 @@
class ValidatorCacheWarmerTest extends TestCase
{
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testWarmUp()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$validatorBuilder = new ValidatorBuilder();
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');
diff --git a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
index 5b1ec6461f416..44450c32b785c 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
-use PHPUnit\Framework\Warning;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fixtures\BadParent;
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
@@ -76,23 +75,22 @@ public function testExistsKo()
}
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testBadParentWithTimestamp()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$res = new ClassExistenceResource(BadParent::class, false);
$this->assertTrue($res->isFresh(time()));
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testBadParentWithNoTimestamp()
{
$this->expectException('ReflectionException');
$this->expectExceptionMessage('Class Symfony\Component\Config\Tests\Fixtures\MissingParent not found');
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
$res = new ClassExistenceResource(BadParent::class, false);
$res->isFresh(0);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
index 84d396bebaedd..e84968100736a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use PHPUnit\Framework\Warning;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
@@ -378,13 +377,13 @@ public function testClassNotFoundThrowsException()
$pass->process($container);
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testParentClassNotFoundThrowsException()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
$this->expectExceptionMessage('Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found).');
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
$container = new ContainerBuilder();
@@ -692,12 +691,11 @@ public function getCreateResourceTests()
];
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testIgnoreServiceWithClassNotExisting()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$container = new ContainerBuilder();
$container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass');
@@ -894,13 +892,13 @@ public function testExceptionWhenAliasExists()
$pass->process($container);
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testExceptionWhenAliasDoesNotExist()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
$this->expectExceptionMessage('Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. You should maybe alias this class to one of these existing services: "i", "i2".');
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
index 85d6e02622f43..c91eeadfd99a4 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
-use PHPUnit\Framework\Warning;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
@@ -62,13 +61,13 @@ public function testUnusedBinding()
$pass->process($container);
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testMissingParent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectExceptionMessageRegExp('/Unused binding "\$quz" in service [\s\S]+/');
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index 1d3aa33978f4e..20f9da9e145f3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
-use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -894,12 +893,11 @@ public function testInlineSelfRef()
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_inline_self_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref']));
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testHotPathOptimizations()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$container = include self::$fixturesPath.'/containers/container_inline_requires.php';
$container->setParameter('inline_requires', true);
$container->compile();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index 7d002ff030931..3a2b5931502b7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase;
-use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
@@ -108,12 +107,11 @@ public function testRegisterClasses()
);
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testRegisterClassesWithExclude()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$container = new ContainerBuilder();
$container->setParameter('other_dir', 'OtherDir');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@@ -141,12 +139,11 @@ public function testRegisterClassesWithExclude()
);
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testNestedRegisterClasses()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$container = new ContainerBuilder();
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@@ -173,12 +170,11 @@ public function testNestedRegisterClasses()
$this->assertFalse($alias->isPrivate());
}
+ /**
+ * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
+ */
public function testMissingParentClass()
{
- if (\PHP_VERSION_ID >= 70400) {
- throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
- }
-
$container = new ContainerBuilder();
$container->setParameter('bad_classes_dir', 'BadClasses');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
From 32a085a75fa7f66fd3c032761f6942e6834fd44a Mon Sep 17 00:00:00 2001
From: Jan Vernarsky
Date: Fri, 9 Aug 2019 10:35:07 +0200
Subject: [PATCH 076/147] Added the missing translations for the Slovak 'sk'
locale.
---
.../Resources/translations/validators.sk.xlf | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf
index 8ddb66d9c0b6f..a161ddbfe8845 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf
@@ -314,6 +314,58 @@
This is not a valid Business Identifier Code (BIC).Táto hodnota nie je platný identifikačný kód podniku (BIC).
+
+ Error
+ Chyba
+
+
+ This is not a valid UUID.
+ Táto hodnota nie je platný UUID.
+
+
+ This value should be a multiple of {{ compared_value }}.
+ Táto hodnota by mala byť násobkom {{ compared_value }}.
+
+
+ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
+ Tento identifikačný kód podniku (BIC) nie je spojený s IBAN {{ iban }}.
+
+
+ This value should be valid JSON.
+ Táto hodnota by mala byť platný JSON.
+
+
+ This collection should contain only unique elements.
+ Táto kolekcia by mala obsahovať len unikátne prkvy.
+
+
+ This value should be positive.
+ Táto hodnota by mala byť kladná.
+
+
+ This value should be either positive or zero.
+ Táto hodnota by mala byť kladná alebo nulová.
+
+
+ This value should be negative.
+ Táto hodnota by mala byť záporná.
+
+
+ This value should be either negative or zero.
+ Táto hodnota by mala byť záporná alebo nulová.
+
+
+ This value is not a valid timezone.
+ Táto hodnota nie je platné časové pásmo.
+
+
+ This password has been leaked in a data breach, it must not be used. Please use another password.
+ Toto heslo uniklo pri narušení ochrany dát, nie je možné ho použiť. Prosím, použite iné heslo.
+
+
+ This value should be between {{ min }} and {{ max }}.
+ Táto hodnota by mala byť medzi {{ min }} a {{ max }}.
+
From 6e0c916eaf2e0fed1059c95c0de0d74bcfabd6e8 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Fri, 9 Aug 2019 11:33:27 +0200
Subject: [PATCH 077/147] fix Danish translations
---
.../Resources/translations/validators.da.xlf | 116 ------------------
.../Resources/translations/validators.da.xlf | 116 ++++++++++++++++++
2 files changed, 116 insertions(+), 116 deletions(-)
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.da.xlf b/src/Symfony/Component/Form/Resources/translations/validators.da.xlf
index 346e7cf5746fd..f52f4e0a30db9 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.da.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.da.xlf
@@ -14,122 +14,6 @@
The CSRF token is invalid. Please try to resubmit the form.CSRF-token er ugyldig.
-
- This value is not a valid currency.
- Denne værdi er ikke en gyldig valuta.
-
-
- This value should be equal to {{ compared_value }}.
- Denne værdi skal være lig med {{ compared_value }}.
-
-
- This value should be greater than {{ compared_value }}.
- Denne værdi skal være større end {{ compared_value }}.
-
-
- This value should be greater than or equal to {{ compared_value }}.
- Denne værdi skal være større end eller lig med {{ compared_value }}.
-
-
- This value should be identical to {{ compared_value_type }} {{ compared_value }}.
- Denne værdi skal være identisk med {{ compared_value_type }} {{ compared_value }}.
-
-
- This value should be less than {{ compared_value }}.
- Denne værdi skal være mindre end {{ compared_value }}.
-
-
- This value should be less than or equal to {{ compared_value }}.
- Denne værdi skal være mindre end eller lig med {{ compared_value }}.
-
-
- This value should not be equal to {{ compared_value }}.
- Denne værdi bør ikke være lig med {{ compared_value }}.
-
-
- This value should not be identical to {{ compared_value_type }} {{ compared_value }}.
- Denne værdi bør ikke være identisk med {{ compared_value_type }} {{ compared_value }}.
-
-
- The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
- Billedforholdet er for stort ({{ratio}}). Tilladt maksimumsforhold er {{ max_ratio }}.
-
-
- The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
- Billedforholdet er for lille ({{ ratio }}). Minimumsforventet forventet er {{ min_ratio }}.
-
-
- The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
- Billedet er firkantet ({{ width }} x {{ height }} px). Firkantede billeder er ikke tilladt.
-
-
- The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.
- Billedet er landskabsorienteret ({{width}} x {{height}} px). Landskabsorienterede billeder er ikke tilladt
-
-
- The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.
- Billedet er portrætorienteret ({{ width }}x{{ height }}px). Portrætorienterede billeder er ikke tilladt.
-
-
- An empty file is not allowed.
- En tom fil er ikke tilladt.
-
-
- The host could not be resolved.
- Værten kunne ikke løses.
-
-
- This value does not match the expected {{ charset }} charset.
- Denne værdi stemmer ikke overens med den forventede {{ charset }} charset.
-
-
- This is not a valid Business Identifier Code (BIC).
- Dette er ikke en gyldig Business Identifier Code (BIC).a
-
-
- This is not a valid UUID.
- Dette er ikke en gyldig UUID.
-
-
- This value should be a multiple of {{ compared_value }}.
- Denne værdi skal være et flertal af {{ compared_value }}.
-
-
- This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
- Denne Business Identifier Code (BIC) er ikke forbundet med IBAN {{ iban }}.
-
-
- This value should be valid JSON.
- Denne værdi skal være gyldig JSON.
-
-
- This collection should contain only unique elements.
- Denne samling bør kun indeholde unikke elementer.
-
-
- This value should be positive.
- Denne værdi skal være positiv.
-
-
- This value should be either positive or zero.
- Denne værdi skal være enten positiv eller nul.
-
-
- This value should be negative.
- Denne værdi skal være negativ.
-
-
- This value should be either negative or zero.
- Denne værdi skal være enten negativ eller nul.
-
-
- This value is not a valid timezone.
- Denne værdi er ikke en gyldig tidszone.
-
-
- This password has been leaked in a data breach, it must not be used. Please use another password.
- Denne adgangskode er blevet lækket i et databrud, det må ikke bruges. Brug venligst en anden adgangskode.
-