8000 [VarDumper] Add test dump image · symfony/symfony@8393a9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8393a9b

Browse files
ismail1432fabpot
authored andcommitted
[VarDumper] Add test dump image
1 parent 26cc652 commit 8393a9b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\VarDumper\Tests\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\VarDumper\Caster\ImgStub;
1516
use Symfony\Component\VarDumper\Cloner\VarCloner;
1617
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
1718

@@ -160,4 +161,27 @@ public function testAppend()
160161
$out
161162
);
162163
}
164+
165+
/**
166+
* @dataProvider varToDumpProvider
167+
*/
168+
public function testDumpString($var, $needle)
169+
{
170+
$dumper = new HtmlDumper();
171+
$cloner = new VarCloner();
172+
173+
ob_start();
174+
$dumper->dump($cloner->cloneVar($var));
175+
$out = ob_get_clean();
176+
177+
$this->assertStringContainsString($needle, $out);
178+
}
179+
180+
public function varToDumpProvider()
181+
{
182+
return [
183+
[['dummy' => new ImgStub('dummy', 'img/png', '100em')], '<img src="data:img/png;base64,ZHVtbXk=" />'],
184+
['foo', '<span class=sf-dump-str title="3 characters">foo</span>'],
185+
];
186+
}
163187
}

0 commit comments

Comments
 (0)
0