Skip to content

Commit d42da57

Browse files
Make tests support phpunit 8
1 parent 0c8d5ca commit d42da57

16 files changed

+66
-18
lines changed

Tests/Compiler/ExtensionCompilerPassTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1617
use Symfony\Component\DependencyInjection\Compiler\ExtensionCompilerPass;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -22,10 +23,12 @@
2223
*/
2324
class ExtensionCompilerPassTest extends TestCase
2425
{
26+
use ForwardCompatTestTrait;
27+
2528
private $container;
2629
private $pass;
2730

28-
protected function setUp()
31+
private function doSetUp()
2932
{
3033
$this->container = new ContainerBuilder();
3134
$this->pass = new ExtensionCompilerPass();

Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718

1819
class ResolveParameterPlaceHoldersPassTest extends TestCase
1920
{
21+
use ForwardCompatTestTrait;
22+
2023
private $compilerPass;
2124
private $container;
2225
private $fooDefinition;
2326

24-
protected function setUp()
27+
private function doSetUp()
2528
{
2629
$this->compilerPass = new ResolveParameterPlaceHoldersPass();
2730
$this->container = $this->createContainerBuilder();

Tests/Config/AutowireServiceResourceTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Config;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
1617
use Symfony\Component\DependencyInjection\Config\AutowireServiceResource;
1718

@@ -20,6 +21,8 @@
2021
*/
2122
class AutowireServiceResourceTest extends TestCase
2223
{
24+
use ForwardCompatTestTrait;
25+
2326
/**
2427
* @var AutowireServiceResource
2528
*/
@@ -28,7 +31,7 @@ class AutowireServiceResourceTest extends TestCase
2831
private $class;
2932
private $time;
3033

31-
protected function setUp()
34+
private function doSetUp()
3235
{
3336
$this->file = realpath(sys_get_temp_dir()).'/tmp.php';
3437
$this->time = time();
@@ -101,7 +104,7 @@ public function testNotFreshIfClassNotFound()
101104
$this->assertFalse($resource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the class no longer exists');
102105
}
103106

104-
protected function tearDown()
107+
private function doTearDown()
105108
{
106109
if (!file_exists($this->file)) {
107110
return;

Tests/Config/ContainerParametersResourceCheckerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Config;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Config\ResourceCheckerInterface;
1617
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
1718
use Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker;
1819
use Symfony\Component\DependencyInjection\ContainerInterface;
1920

2021
class ContainerParametersResourceCheckerTest extends TestCase
2122
{
23+
use ForwardCompatTestTrait;
24+
2225
/** @var ContainerParametersResource */
2326
private $resource;
2427

@@ -28,7 +31,7 @@ class ContainerParametersResourceCheckerTest extends TestCase
2831
/** @var ContainerInterface */
2932
private $container;
3033

31-
protected function setUp()
34+
private function doSetUp()
3235
{
3336
$this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']);
3437
$this->container = $this->getMockBuilder(ContainerInterface::class)->getMock();

Tests/Config/ContainerParametersResourceTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Config;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
1617

1718
class ContainerParametersResourceTest extends TestCase
1819
{
20+
use ForwardCompatTestTrait;
21+
1922
/** @var ContainerParametersResource */
2023
private $resource;
2124

22-
protected function setUp()
25+
private function doSetUp()
2326
{
2427
$this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']);
2528
}

Tests/CrossCheckTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
namespace Symfony\Component\DependencyInjection\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Config\FileLocator;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718

1819
class CrossCheckTest extends TestCase
1920
{
21+
use ForwardCompatTestTrait;
22+
2023
protected static $fixturesPath;
2124

22-
public static function setUpBeforeClass()
25+
private static function doSetUpBeforeClass()
2326
{
2427
self::$fixturesPath = __DIR__.'/Fixtures/';
2528

Tests/Dumper/GraphvizDumperTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Definition;
1718
use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper;
1819
use Symfony\Component\DependencyInjection\Reference;
1920

2021
class GraphvizDumperTest extends TestCase
2122
{
23+
use ForwardCompatTestTrait;
24+
2225
protected static $fixturesPath;
2326

24-
public static function setUpBeforeClass()
27+
private static function doSetUpBeforeClass()
2528
{
2629
self::$fixturesPath = __DIR__.'/../Fixtures/';
2730
}

Tests/Dumper/PhpDumperTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Psr\Container\ContainerInterface;
16+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1617
use Symfony\Component\Config\FileLocator;
1718
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1819
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
@@ -41,9 +42,11 @@
4142

4243
class PhpDumperTest extends TestCase
4344
{
45+
use ForwardCompatTestTrait;
46+
4447
protected static $fixturesPath;
4548

46-
public static function setUpBeforeClass()
49+
private static function doSetUpBeforeClass()
4750
{
4851
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
4952
}

Tests/Dumper/XmlDumperTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Config\FileLocator;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -21,9 +22,11 @@
2122

2223
class XmlDumperTest extends TestCase
2324
{
25+
use ForwardCompatTestTrait;
26+
2427
protected static $fixturesPath;
2528

26-
public static function setUpBeforeClass()
29+
private static function doSetUpBeforeClass()
2730
{
2831
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
2932
}

Tests/Dumper/YamlDumperTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Config\FileLocator;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -24,9 +25,11 @@
2425

2526
class YamlDumperTest extends TestCase
2627
{
28+
use ForwardCompatTestTrait;
29+
2730
protected static $fixturesPath;
2831

29-
public static function setUpBeforeClass()
32+
private static function doSetUpBeforeClass()
3033
{
3134
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
3235
}

0 commit comments

Comments
 (0)