namespace Symfony\Component\VarDumper\Tests\Caster;
-use Symfony\Component\VarDumper\Test\VarDumperTestCase;
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\VarDumper\Caster\Caster;
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
-class ReflectionCasterTest extends VarDumperTestCase
+class ReflectionCasterTest extends TestCase
{
+ use VarDumperTestTrait;
+
public function testReflectionCaster()
{
$var = new \ReflectionClass('ReflectionClass');
\$b: & 123
}
file: "%sReflectionCasterTest.php"
- line: "64 to 64"
+ line: "68 to 68"
}
EOTXT
, $var
);
}
+ public function testClosureCasterExcludingVerbosity()
+ {
+ $var = function () {};
+
+ $expectedDump = <<<EOTXT
+Closure {
+ class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
+ this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
+}
+EOTXT;
+
+ $this->assertDumpEquals($expectedDump, $var, Caster::EXCLUDE_VERBOSE);
+ }
+
public function testReflectionParameter()
{
$var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0);
Generator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
executing: {
- Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz(): {
- %sGeneratorDemo.php:14: """
- {\n
- yield from bar();\n
- }\n
- """
+ Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {
+ %sGeneratorDemo.php:14 {
+ › {
+ › yield from bar();
+ › }
+ }
}
}
closed: false
0 => ReflectionGenerator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
trace: {
- 3. Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() ==> yield(): {
- src: {
- %sGeneratorDemo.php:9: """
- {\n
- yield 1;\n
- }\n
- """
- }
- }
- 2. Symfony\Component\VarDumper\Tests\Fixtures\bar() ==> Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
- src: {
- %sGeneratorDemo.php:20: """
- {\n
- yield from GeneratorDemo::foo();\n
- }\n
- """
- }
- }
- 1. Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() ==> Symfony\Component\VarDumper\Tests\Fixtures\bar(): {
- src: {
- %sGeneratorDemo.php:14: """
- {\n
- yield from bar();\n
- }\n
- """
- }
+ %s%eTests%eFixtures%eGeneratorDemo.php:9 {
+ › {
+ › yield 1;
+ › }
}
+ %s%eTests%eFixtures%eGeneratorDemo.php:20 { …}
+ %s%eTests%eFixtures%eGeneratorDemo.php:14 { …}
}
closed: false
}
1 => Generator {
executing: {
- Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
- %sGeneratorDemo.php:10: """
- yield 1;\n
- }\n
- \n
- """
+ Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() {
+ %sGeneratorDemo.php:10 {
+ › yield 1;
+ › }
+ ›
+ }
}
}
closed: false