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)
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