-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathPathTest.php
86 lines (81 loc) · 2.31 KB
/
PathTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php declare(strict_types=1);
namespace Svg\Tests;
use Exception;
use PHPUnit\Framework\TestCase;
use Svg\Document;
use Svg\Surface\SurfaceCpdf;
use Svg\Tag\Path;
final class PathTest extends TestCase
{
public static function commandProvider(): array
{
return [
'parse a relative arc with the shorthand format' => [
'a12.083 12.083 0 01.665 6.479',
[
[
'a',
'12.083',
'12.083',
'0',
'0',
'1',
'.665',
'6.479',
],
],
],
'parse an absolute arc with the shorthand format' => [
'A12.083 12.083 0 01.665 6.479',
[
[
'A',
'12.083',
'12.083',
'0',
'0',
'1',
'.665',
'6.479',
],
],
],
'parse two relative arcs that occur in sequence' => [
'a2.43,2.43,0,0,1,.65-1.57,5.91,5.91,0,0,0,1-2.78',
[
[
'a',
'2.43',
'2.43',
'0',
'0',
'1',
'.65',
'-1.57',
],
[
'a',
'5.91',
'5.91',
'0',
'0',
'0',
'1',
'-2.78',
],
],
],
];
}
/**
* @dataProvider commandProvider
* @param string $commandSequence
* @param array $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('commandProvider')]
public function testParseCommands(string $commandSequence, array $expected)
{
$result = Path::parse($commandSequence);
$this->assertSame($expected, $result);
}
}