7
7
8
8
class SvgImageTest extends TestCase
9
9
{
10
- private string $ svgPath ;
11
10
12
11
protected function setUp (): void
13
12
{
14
- $ this -> svgPath = __DIR__ . '/../_files/images/sample.svg ' ;
15
- if (!file_exists ($ this -> svgPath )) {
16
- $ this ->markTestSkipped ('SVG file not found: ' . $ this -> svgPath );
13
+ $ svgPath = __DIR__ . '/../_files/images/sample.svg ' ;
14
+ if (!file_exists ($ svgPath )) {
15
+ $ this ->markTestSkipped ('SVG file not found: ' . $ svgPath );
17
16
}
18
17
}
19
18
20
19
public function testAddSvgImageWithoutStyles (): void
21
20
{
21
+ $ svgPath = __DIR__ . '/../_files/images/sample.svg ' ;
22
22
$ phpWord = new PhpWord ();
23
23
$ section = $ phpWord ->addSection ();
24
- $ image = $ section ->addImage ($ this -> svgPath );
24
+ $ image = $ section ->addImage ($ svgPath );
25
25
26
- $ this ->assertEquals ($ this -> svgPath , $ image ->getSource ());
26
+ $ this ->assertEquals ($ svgPath , $ image ->getSource ());
27
27
$ this ->assertEquals ('image/svg+xml ' , $ image ->getImageType ());
28
28
}
29
29
30
30
public function testAddSvgImageWithStyles (): void
31
31
{
32
+ $ svgPath = __DIR__ . '/../_files/images/sample.svg ' ;
32
33
$ phpWord = new PhpWord ();
33
34
$ section = $ phpWord ->addSection ();
34
35
$ options = [
@@ -37,7 +38,7 @@ public function testAddSvgImageWithStyles(): void
37
38
'wrappingStyle ' => Image::WRAPPING_STYLE_BEHIND ,
38
39
];
39
40
40
- $ image = $ section ->addImage ($ this -> svgPath , $ options );
41
+ $ image = $ section ->addImage ($ svgPath , $ options );
41
42
42
43
$ this ->assertEquals (200 , $ image ->getStyle ()->getWidth ());
43
44
$ this ->assertEquals (200 , $ image ->getStyle ()->getHeight ());
0 commit comments