8000 [VarDumper] replace VarDumperTestCase by trait · symfony/symfony@2309901 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2309901

Browse files
committed
[VarDumper] replace VarDumperTestCase by trait
1 parent 24ff770 commit 2309901

File tree

7 files changed

+44
-99
lines changed

7 files changed

+44
-99
lines changed

src/Symfony/Component/VarDumper/Test/VarDumperTestCase.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

1414
use Symfony\Component\VarDumper\Caster\Caster;
15-
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
15+
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1616

1717
/**
1818
* @author Nicolas Grekas <p@tchwork.com>
1919
*/
20-
class CasterTest extends VarDumperTestCase
20+
class CasterTest extends \PHPUnit_Framework_TestCase
2121
{
22+
use VarDumperTestTrait;
23+
2224
private $referenceArray = array(
2325
'null' => null,
2426
'empty' => false,

src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111

1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

14-
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
14+
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1515
use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
1616

1717
/**
1818
* @author Nicolas Grekas <p@tchwork.com>
1919
*/
20-
class ReflectionCasterTest extends VarDumperTestCase
20+
class ReflectionCasterTest extends \PHPUnit_Framework_TestCase
2121
{
22+
use VarDumperTestTrait;
23+
2224
public function testReflectionCaster()
2325
{
2426
$var = new \ReflectionClass('ReflectionClass');

src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

14-
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
14+
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1515

1616
/**
1717
* @author Grégoire Pineau <lyrixx@lyrixx.info>
1818
*/
19-
class SplCasterTest extends VarDumperTestCase
19+
class SplCasterTest extends \PHPUnit_Framework_TestCase
2020
{
21+
use VarDumperTestTrait;
22+
2123
public function getCastFileInfoTests()
2224
{
2325
return array(

src/Symfony/Component/VarDumper/Tests/CliDumperTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313

1414
use Symfony\Component\VarDumper\Cloner\VarCloner;
1515
use Symfony\Component\VarDumper\Dumper\CliDumper;
16-
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
16+
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1717

1818
/**
1919
* @author Nicolas Grekas <p@tchwork.com>
2020
*/
21-
class CliDumperTest extends VarDumperTestCase
21+
class CliDumperTest extends \PHPUnit_Framework_TestCase
2222
{
23+
use VarDumperTestTrait;
24+
2325
public function testGet()
2426
{
2527
require __DIR__.'/Fixtures/dumb-var.php';

src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitRequire54.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitTest.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,32 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
// Skipping trait tests for PHP < 5.4
13-
if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) {
14-
require 'VarDumpTestTraitRequire54.php';
15-
}
12+
namespace Symfony\Component\VarDumper\Tests\Test;
13+
14+
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
15+
16+
class VarDumperTestTraitTest extends \PHPUnit_Framework_TestCase
17+
{
18+
use VarDumperTestTrait;
1619

20+
public function testItComparesLargeData()
21+
{
22+
$howMany = 700;
23+
$data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd'));
24+
25+
$expected = sprintf("array:%d [\n", $howMany + 1);
26+
for ($i = 0; $i <= $howMany; ++$i) {
27+
$expected .= <<<EODUMP
28+
$i => array:4 [
29+
0 => "a"
30+
1 => "b"
31+
2 => "c"
32+
3 => "d"
33+
]\n
34+
EODUMP;
35+
}
36+
$expected .= "]\n";
37+
38+
$this->assertDumpEquals($expected, $data);
39+
}
40+
}

0 commit comments

Comments
 (0)
0