@@ -28,7 +28,8 @@ final class AssertBackwardsCompatibleTest extends TestCase
28
28
29
29
JSON;
30
30
31
- private const CLASS_V1 = <<<'PHP'
31
+ private const CLASS_VERSIONS = [
32
+ <<<'PHP'
32
33
<?php
33
34
34
35
namespace TestArtifact;
@@ -40,9 +41,9 @@ public function method(A $a)
40
41
}
41
42
}
42
43
43
- PHP;
44
-
45
- private const CLASS_V2 = <<<'PHP'
44
+ PHP
45
+ ,
46
+ <<<'PHP'
46
47
<?php
47
48
48
49
namespace TestArtifact;
@@ -54,9 +55,9 @@ public function method(B $a)
54
55
}
55
56
}
56
57
57
- PHP;
58
-
59
- private const CLASS_V3 = <<<'PHP'
58
+ PHP
59
+ ,
60
+ <<<'PHP'
60
61
<?php
61
62
62
63
namespace TestArtifact;
@@ -68,9 +69,10 @@ public function method(C $a)
68
69
}
69
70
}
70
71
71
- PHP;
72
-
73
- private const CLASS_V4 = <<<'PHP'
72
+ PHP
73
+ ,
74
+ // The last version resets the class to its initial state
75
+ <<<'PHP'
74
76
<?php
75
77
76
78
namespace TestArtifact;
@@ -82,7 +84,8 @@ public function method(A $a)
82
84
}
83
85
}
84
86
85
- PHP;
87
+ PHP
88
+ ];
86
89
87
90
/** @var string path to the sources that should be checked */
88
91
private $ sourcesRepository ;
@@ -114,7 +117,7 @@ protected function setUp() : void
114
117
(new Process ('git add -A ' , $ this ->sourcesRepository ))->mustRun ();
115
118
(new Process ('git commit -am "Initial commit with composer manifest" ' , $ this ->sourcesRepository ))->mustRun ();
116
119
117
- foreach ([ self ::CLASS_V1 , self :: CLASS_V2 , self :: CLASS_V3 , self :: CLASS_V4 ] as $ key => $ classCode ) {
120
+ foreach (self ::CLASS_VERSIONS as $ key => $ classCode ) {
118
121
file_put_contents ($ this ->sourcesRepository . '/src/TheClass.php ' , $ classCode );
119
122
120
123
(new Process ('git add -A ' , $ this ->sourcesRepository ))->mustRun ();
@@ -131,7 +134,7 @@ protected function tearDown() : void
131
134
self ::assertDirectoryExists ($ this ->sourcesRepository );
132
135
133
136
// Need to be extremely careful with this stuff - skipping it for now
134
- // (new Process(['rm', '-r', $this->sourcesRepository]))->mustRun();
137
+ (new Process (['rm ' , '-r ' , $ this ->sourcesRepository ]))->mustRun ();
135
138
136
139
parent ::tearDown ();
137
140
}
0 commit comments