File tree 2 files changed +35
-13
lines changed
2 files changed +35
-13
lines changed Original file line number Diff line number Diff line change @@ -23,21 +23,10 @@ final class PHP
23
23
*/
24
24
public function process (CodeCoverage $ coverage , ?string $ target = null ): string
25
25
{
26
- $ filter = $ coverage ->filter ();
27
-
28
26
$ buffer = \sprintf (
29
27
'<?php
30
- $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage;
31
- $coverage->setData(%s);
32
- $coverage->setTests(%s);
33
-
34
- $filter = $coverage->filter();
35
- $filter->setWhitelistedFiles(%s);
36
-
37
- return $coverage; ' ,
38
- \var_export ($ coverage ->getData (true ), true ),
39
- \var_export ($ coverage ->getTests (), true ),
40
- \var_export ($ filter ->getWhitelistedFiles (), true )
28
+ return \unserialize( \'%s \'); ' ,
29
+ \serialize ($ coverage )
41
30
);
42
31
43
32
if ($ target !== null ) {
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+ /*
3
+ * This file is part of phpunit/php-code-coverage.
4
+ *
5
+ * (c) Sebastian Bergmann <[email protected] >
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ namespace SebastianBergmann \CodeCoverage \Report ;
11
+
12
+ use SebastianBergmann \CodeCoverage \TestCase ;
13
+
14
+ class PHPTest extends TestCase
15
+ {
16
+ protected function tearDown (): void
17
+ {
18
+ parent ::tearDown ();
19
+
20
+ $ this ->removeTemporaryFiles ();
21
+ }
22
+
23
+ public function testPHPSerialisationProducesValidCode (): void
24
+ {
25
+ $ coverage = $ this ->getCoverageForBankAccount ();
26
+
27
+ (new PHP ())->process ($ coverage , self ::$ TEST_TMP_PATH . '/serialised.php ' );
28
+
29
+ $ unserialised = require self ::$ TEST_TMP_PATH . '/serialised.php ' ;
30
+
31
+ $ this ->assertEquals ($ coverage , $ unserialised );
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments