Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f68235c

Browse files
committed
use namespaced PHPUnit classes
1 parent 2ac669f commit f68235c

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

components/phpunit_bridge.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ Use Case
163163

164164
If you have this kind of time-related tests::
165165

166+
use PHPUnit\Framework\TestCase;
166167
use Symfony\Component\Stopwatch\Stopwatch;
167168

168-
class MyTest extends \PHPUnit_Framework_TestCase
169+
class MyTest extends TestCase
169170
{
170171
public function testSomething()
171172
{
@@ -207,12 +208,13 @@ To use the ``ClockMock`` class in your test, you can:
207208
As a result, the following is guaranteed to work and is no longer a transient
208209
test::
209210

211+
use PHPUnit\Framework\TestCase;
210212
use Symfony\Component\Stopwatch\Stopwatch;
211213

212214
/**
213215
* @group time-sensitive
214216
*/
215-
class MyTest extends \PHPUnit_Framework_TestCase
217+
class MyTest extends TestCase
216218
{
217219
public function testSomething()
218220
{
@@ -263,9 +265,10 @@ Use Case
263265
Consider the following example that uses the ``checkMX`` option of the ``Email``
264266
constraint to test the validity of the email domain::
265267

268+
use PHPUnit\Framework\TestCase;
266269
use Symfony\Component\Validator\Constraints\Email;
267270

268-
class MyTest extends \PHPUnit_Framework_TestCase
271+
class MyTest extends TestCase
269272
{
270273
public function testEmail()
271274
{
@@ -281,12 +284,13 @@ In order to avoid making a real network connection, add the ``@dns-sensitive``
281284
annotation to the class and use the ``DnsMock::withMockedHosts()`` to configure
282285
the data you expect to get for the given hosts::
283286

287+
use PHPUnit\Framework\TestCase;
284288
use Symfony\Component\Validator\Constraints\Email;
285289

286290
/**
287291
* @group dns-sensitive
288292
*/
289-
class MyTest extends \PHPUnit_Framework_TestCase
293+
class MyTest extends TestCase
290294
{
291295
public function testEmails()
292296
{

components/var_dumper.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ This will provide you with two new assertions:
124124

125125
Example::
126126

127-
class ExampleTest extends \PHPUnit_Framework_TestCase
127+
use PHPUnit\Framework\TestCase;
128+
129+
class ExampleTest extends TestCase
128130
{
129131
use \Symfony\Component\VarDumper\Test\VarDumperTestTrait;
130132

console.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ console::
258258

259259
When using the Console component in a standalone project, use
260260
:class:`Symfony\\Component\\Console\\Application <Symfony\\Component\\Console\\Application>`
261-
and extend the normal ``\PHPUnit_Framework_TestCase``.
261+
and extend the normal ``\PHPUnit\Framework\TestCase``.
262262

263263
To be able to use the fully set up service container for your console tests
264264
you can extend your test from

create_framework/http_foundation.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ snippet of PHP code is not natural and feels ugly. Here is a tentative PHPUnit
5858
unit test for the above code::
5959

6060
// framework/test.php
61-
class IndexTest extends \PHPUnit_Framework_TestCase
61+
use PHPUnit\Framework\TestCase;
62+
63+
class IndexTest extends TestCase
6264
{
6365
public function testHello()
6466
{

create_framework/unit_testing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,15 @@ We are now ready to write our first test::
7575
// example.com/tests/Simplex/Tests/FrameworkTest.php
7676
namespace Simplex\Tests;
7777

78+
use PHPUnit\Framework\TestCase;
7879
use Simplex\Framework;
7980
use Symfony\Component\HttpFoundation\Request;
8081
use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;
8182
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
8283
use Symfony\Component\Routing;
8384
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
8485

85-
class FrameworkTest extends \PHPUnit_Framework_TestCase
86+
class FrameworkTest extends TestCase
8687
{
8788
public function testNotFoundHandling()
8889
{

testing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ of your application::
6969
namespace Tests\AppBundle\Util;
7070

7171
use AppBundle\Util\Calculator;
72+
use PHPUnit\Framework\TestCase;
7273

73-
class CalculatorTest extends \PHPUnit_Framework_TestCase
74+
class CalculatorTest extends TestCase
7475
{
7576
public function testAdd()
7677
{

testing/database.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ it's easy to pass a mock object within a test::
6767
use AppBundle\Salary\SalaryCalculator;
6868
use Doctrine\ORM\EntityRepository;
6969
use Doctrine\Common\Persistence\ObjectManager;
70+
use PHPUnit\Framework\TestCase;
7071

71-
class SalaryCalculatorTest extends \PHPUnit_Framework_TestCase
72+
class SalaryCalculatorTest extends TestCase
7273
{
7374
public function testCalculateTotalSalary()
7475
{

0 commit comments

Comments
 (0)