|
8 | 8 |
|
9 | 9 | class GenDiffTests extends TestCase |
10 | 10 | { |
| 11 | + public function setUp(): void |
| 12 | + { |
| 13 | + $this->path1 = "tests/fixtures/nestedBefore.json"; |
| 14 | + $this->path2 = "tests/fixtures/nestedAfter.json"; |
| 15 | + $this->path3 = "tests/fixtures/nestedBefore.yaml"; |
| 16 | + $this->path4 = "tests/fixtures/nestedAfter.yaml"; |
| 17 | + } |
| 18 | + |
11 | 19 | public function testPrettyResult() |
12 | 20 | { |
13 | | - $path1 = "tests/fixtures/flatBefore.json"; |
14 | | - $path2 = "tests/fixtures/flatAfter.json"; |
15 | | - $path3 = "tests/fixtures/flatBefore.yaml"; |
16 | | - $path4 = "tests/fixtures/flatAfter.yaml"; |
17 | | - $path5 = "tests/fixtures/nestedBefore.json"; |
18 | | - $path6 = "tests/fixtures/nestedAfter.json"; |
19 | | - $path7 = "tests/fixtures/nestedBefore.yaml"; |
20 | | - $path8 = "tests/fixtures/nestedAfter.yaml"; |
21 | | - $expected1 = file_get_contents("tests/fixtures/expected/prettyFlatResult.txt"); |
22 | | - $expected2 = file_get_contents("tests/fixtures/expected/prettyNestedResult.txt"); |
23 | | - $this->assertEquals($expected1, render($path1, $path2, "pretty")); |
24 | | - $this->assertEquals($expected1, render($path3, $path4, "pretty")); |
25 | | - $this->assertEquals($expected2, render($path5, $path6, "pretty")); |
26 | | - $this->assertEquals($expected2, render($path7, $path8, "pretty")); |
| 21 | + $expected = file_get_contents("tests/fixtures/expected/prettyNestedResult.txt"); |
| 22 | + $this->assertEquals($expected, render($this->path1, $this->path2, "pretty")); |
| 23 | + $this->assertEquals($expected, render($this->path3, $this->path4, "pretty")); |
27 | 24 | } |
28 | 25 | public function testPlainResult() |
29 | 26 | { |
30 | | - $path1 = "tests/fixtures/flatBefore.json"; |
31 | | - $path2 = "tests/fixtures/flatAfter.json"; |
32 | | - $path3 = "tests/fixtures/flatBefore.yaml"; |
33 | | - $path4 = "tests/fixtures/flatAfter.yaml"; |
34 | | - $path5 = "tests/fixtures/nestedBefore.json"; |
35 | | - $path6 = "tests/fixtures/nestedAfter.json"; |
36 | | - $path7 = "tests/fixtures/nestedBefore.yaml"; |
37 | | - $path8 = "tests/fixtures/nestedAfter.yaml"; |
38 | | - $expected1 = file_get_contents("tests/fixtures/expected/plainFlatResult.txt"); |
39 | | - $expected2 = file_get_contents("tests/fixtures/expected/plainNestedResult.txt"); |
40 | | - $this->assertEquals($expected1, render($path1, $path2, "plain")); |
41 | | - $this->assertEquals($expected1, render($path3, $path4, "plain")); |
42 | | - $this->assertEquals($expected2, render($path5, $path6, "plain")); |
43 | | - $this->assertEquals($expected2, render($path7, $path8, "plain")); |
| 27 | + $expected = file_get_contents("tests/fixtures/expected/plainNestedResult.txt"); |
| 28 | + $this->assertEquals($expected, render($this->path1, $this->path2, "plain")); |
| 29 | + $this->assertEquals($expected, render($this->path3, $this->path4, "plain")); |
44 | 30 | } |
45 | 31 | public function testJsonResult() |
46 | 32 | { |
47 | | - $path1 = "tests/fixtures/flatBefore.json"; |
48 | | - $path2 = "tests/fixtures/flatAfter.json"; |
49 | | - $path3 = "tests/fixtures/flatBefore.yaml"; |
50 | | - $path4 = "tests/fixtures/flatAfter.yaml"; |
51 | | - $path5 = "tests/fixtures/nestedBefore.json"; |
52 | | - $path6 = "tests/fixtures/nestedAfter.json"; |
53 | | - $path7 = "tests/fixtures/nestedBefore.yaml"; |
54 | | - $path8 = "tests/fixtures/nestedAfter.yaml"; |
55 | | - $expected1 = file_get_contents("tests/fixtures/expected/jsonFlatResult.txt"); |
56 | | - $expected2 = file_get_contents("tests/fixtures/expected/jsonNestedResult.txt"); |
57 | | - $this->assertEquals($expected1, render($path1, $path2, "json")); |
58 | | - $this->assertEquals($expected1, render($path3, $path4, "json")); |
59 | | - $this->assertEquals($expected2, render($path5, $path6, "json")); |
60 | | - $this->assertEquals($expected2, render($path7, $path8, "json")); |
| 33 | + $expected = file_get_contents("tests/fixtures/expected/jsonNestedResult.txt"); |
| 34 | + $this->assertEquals($expected, render($this->path1, $this->path2, "json")); |
| 35 | + $this->assertEquals($expected, render($this->path3, $this->path4, "json")); |
61 | 36 | } |
62 | 37 | } |
0 commit comments