8000 Improve a test · symfony/symfony@f6128ad · GitHub
[go: up one dir, main page]

Skip to content

Commit f6128ad

Browse files
committed
Improve a test
1 parent 6f36577 commit f6128ad

File tree

1 file changed

+10
-1
lines changed
  • src/Symfony/Bundle/WebProfilerBundle/Tests/Resources

1 file changed

+10
-1
lines changed

src/Symfony/Bundle/WebProfilerBundle/Tests/Resources/IconTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ class IconTest extends TestCase
2020
*/
2121
public function testIconFileContents($iconFilePath)
2222
{
23-
$this->assertMatchesRegularExpression('~<svg xmlns="http://www.w3.org/2000/svg" width="\d+" height="\d+" viewBox="0 0 \d+ \d+"[^>]*+>.*</svg>~s', file_get_contents($iconFilePath), sprintf('The SVG metadata of the %s icon is different than expected (use the same as the other icons).', $iconFilePath));
23+
$iconFilePath = realpath($iconFilePath);
24+
$svgFileContents = file_get_contents($iconFilePath);
25+
26+
$this->assertStringContainsString('xmlns="http://www.w3.org/2000/svg"', $svgFileContents, sprintf('The SVG metadata of the "%s" icon must use "http://www.w3.org/2000/svg" as its "xmlns" value.', $iconFilePath));
27+
28+
$this->assertMatchesRegularExpression('~<svg .* width="\d+".+>.*</svg>~s', file_get_contents($iconFilePath), sprintf('The SVG file of the "%s" icon must include a "width" attribute.', $iconFilePath));
29+
30+
$this->assertMatchesRegularExpression('~<svg .* height="\d+".+>.*</svg>~s', file_get_contents($iconFilePath), sprintf('The SVG file of the "%s" icon must include a "height" attribute.', $iconFilePath));
31+
32+
$this->assertMatchesRegularExpression('~<svg .* viewBox="0 0 \d+ \d+".+>.*</svg>~s', file_get_contents($iconFilePath), sprintf('The SVG file of the "%s" icon must include a "viewBox" attribute.', $iconFilePath));
2433
}
2534

2635
public function provideIconFilePaths()

0 commit comments

Comments
 (0)
0