minor #33212 [VarDumper] Add test dump image (ismail1432)
This PR was squashed before being merged into the 4.4 branch (closes #33212).
Discussion
----------
[VarDumper] Add test dump image
| Q | A
| ------------- | ---
| Branch? | 4.4 <!-- see below -->
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | <!-- please add some, will be required by reviewers -->
| Fixed tickets | #33107. <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/roadmap):
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against branch 4.4.
- Legacy code removals go to the master branch.
-->
Commits
-------
8393a9b5c1
[VarDumper] Add test dump image
This commit is contained in:
commit
63272d61d0
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\VarDumper\Tests\Dumper;
|
namespace Symfony\Component\VarDumper\Tests\Dumper;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Component\VarDumper\Caster\ImgStub;
|
||||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||||
|
|
||||||
@ -160,4 +161,27 @@ EOTXT
|
|||||||
$out
|
$out
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider varToDumpProvider
|
||||||
|
*/
|
||||||
|
public function testDumpString($var, $needle)
|
||||||
|
{
|
||||||
|
$dumper = new HtmlDumper();
|
||||||
|
$cloner = new VarCloner();
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$dumper->dump($cloner->cloneVar($var));
|
||||||
|
$out = ob_get_clean();
|
||||||
|
|
||||||
|
$this->assertStringContainsString($needle, $out);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function varToDumpProvider()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['dummy' => new ImgStub('dummy', 'img/png', '100em')], '<img src="data:img/png;base64,ZHVtbXk=" />'],
|
||||||
|
['foo', '<span class=sf-dump-str title="3 characters">foo</span>'],
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user