@@ -37,6 +37,7 @@ public function testNotifyWithAtLeastOneFailedRule(): void
3737 'tests/clover.xml ' ,
3838 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-with-failed-rule.php ' ),
3939 true ,
40+ false ,
4041 $ exitter ,
4142 new ConsoleOutput ($ spyOutput ),
4243 );
@@ -67,6 +68,7 @@ public function testNotifyWithAWarning(): void
6768 'tests/clover.xml ' ,
6869 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-with-warning.php ' ),
6970 false ,
71+ false ,
7072 new Exitter (),
7173 new ConsoleOutput ($ spyOutput ),
7274 );
@@ -97,6 +99,7 @@ public function testNotifyWhenCoverageIsOk(): void
9799 'tests/clover.xml ' ,
98100 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-success.php ' ),
99101 false ,
102+ false ,
100103 new Exitter (),
101104 new ConsoleOutput ($ spyOutput ),
102105 );
@@ -127,6 +130,7 @@ public function testNotifyWhitOnlyTotal(): void
127130 'tests/clover.xml ' ,
128131 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-total-only.php ' ),
129132 false ,
133+ false ,
130134 new Exitter (),
131135 new ConsoleOutput ($ spyOutput ),
132136 );
@@ -161,6 +165,7 @@ public function testNotifyWhitInvalidRules(): void
161165 'tests/clover.xml ' ,
162166 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-invalid.php ' ),
163167 false ,
168+ false ,
164169 new Exitter (),
165170 new ConsoleOutput ($ spyOutput ),
166171 );
@@ -173,6 +178,7 @@ public function testNotifyWithNonExistingCloverFile(): void
173178 'tests/clover-wrong.xml ' ,
174179 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-success.php ' ),
175180 false ,
181+ false ,
176182 new Exitter (),
177183 new ConsoleOutput ($ spyOutput ),
178184 );
@@ -203,6 +209,7 @@ public function testNotifyWithInvalidCloverFile(): void
203209 'tests/clover-invalid.xml ' ,
204210 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-success.php ' ),
205211 false ,
212+ false ,
206213 new Exitter (),
207214 new ConsoleOutput ($ spyOutput ),
208215 );
@@ -227,13 +234,53 @@ public function testNotifyWithInvalidCloverFile(): void
227234 ));
228235 }
229236
237+ public function testNotifyWithCleanUpCloverFile (): void
238+ {
239+ copy (dirname (__DIR__ , 2 ).'/clover.xml ' , dirname (__DIR__ , 2 ).'/clover-to-delete.xml ' );
240+ $ exitter = $ this ->createMock (Exitter::class);
241+
242+ $ exitter
243+ ->expects ($ this ->once ())
244+ ->method ('exit ' )
245+ ->with (1 );
246+
247+ $ spyOutput = new SpyOutput ();
248+ $ subscriber = new ApplicationFinishedSubscriber (
249+ 'tests/clover-to-delete.xml ' ,
250+ MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-with-failed-rule.php ' ),
251+ true ,
252+ true ,
253+ $ exitter ,
254+ new ConsoleOutput ($ spyOutput ),
255+ );
256+
257+ $ subscriber ->notify (new Finished (
258+ new Info (
259+ new Snapshot (
260+ HRTime::fromSecondsAndNanoseconds (1 , 0 ),
261+ MemoryUsage::fromBytes (100 ),
262+ MemoryUsage::fromBytes (100 ),
263+ new GarbageCollectorStatus (0 , 0 , 0 , 0 , null , null , null , null )
264+ ),
265+ Duration::fromSecondsAndNanoseconds (1 , 0 ),
266+ MemoryUsage::fromBytes (100 ),
267+ Duration::fromSecondsAndNanoseconds (1 , 0 ),
268+ MemoryUsage::fromBytes (100 ),
269+ ),
270+ 0
271+ ));
272+
273+ $ this ->assertFileDoesNotExist (dirname (__DIR__ , 2 ).'/clover-to-delete.xml ' );
274+ }
275+
230276 public function testFromConfigurationAndParameters (): void
231277 {
232278 $ this ->assertEquals (
233279 new ApplicationFinishedSubscriber (
234280 'tests/clover.xml ' ,
235281 MinCoverageRules::fromInt (90 ),
236282 false ,
283+ false ,
237284 new Exitter (),
238285 new ConsoleOutput (new \Symfony \Component \Console \Output \ConsoleOutput ()),
239286 ),
@@ -254,6 +301,7 @@ public function testFromConfigurationAndParametersFromFile(): void
254301 'tests/clover.xml ' ,
255302 MinCoverageRules::fromConfigFile ('tests/Subscriber/Application/min-coverage-rules-success.php ' ),
256303 false ,
304+ false ,
257305 new Exitter (),
258306 new ConsoleOutput (new \Symfony \Component \Console \Output \ConsoleOutput ()),
259307 ),
0 commit comments