From 3c9588ee93acf5b9a605be28025d01c80abea5b6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Apr 2017 18:35:55 +0200 Subject: [PATCH] use namespaced PHPUnit TestCase class --- components/phpunit_bridge.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 782895bf4c0..fe03309a9d6 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -183,9 +183,10 @@ Use Case If you have this kind of time-related tests:: + use PHPUnit\Framework\TestCase; use Symfony\Component\Stopwatch\Stopwatch; - class MyTest extends \PHPUnit_Framework_TestCase + class MyTest extends TestCase { public function testSomething() { @@ -238,12 +239,13 @@ following listener in your PHPUnit configuration: As a result, the following is guaranteed to work and is no longer a transient test:: + use PHPUnit\Framework\TestCase; use Symfony\Component\Stopwatch\Stopwatch; /** * @group time-sensitive */ - class MyTest extends \PHPUnit_Framework_TestCase + class MyTest extends TestCase { public function testSomething() { @@ -294,9 +296,10 @@ Use Case Consider the following example that uses the ``checkMX`` option of the ``Email`` constraint to test the validity of the email domain:: + use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Email; - class MyTest extends \PHPUnit_Framework_TestCase + class MyTest extends TestCase { public function testEmail() { @@ -312,12 +315,13 @@ In order to avoid making a real network connection, add the ``@dns-sensitive`` annotation to the class and use the ``DnsMock::withMockedHosts()`` to configure the data you expect to get for the given hosts:: + use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Email; /** * @group dns-sensitive */ - class MyTest extends \PHPUnit_Framework_TestCase + class MyTest extends TestCase { public function testEmails() {