Skip to content

Commit 63272d6

Browse files
committed
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 ------- 8393a9b [VarDumper] Add test dump image
2 parents 2a1647a + 8393a9b commit 63272d6

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy