File tree Expand file tree Collapse file tree 3 files changed +34
-10
lines changed
Expand file tree Collapse file tree 3 files changed +34
-10
lines changed Original file line number Diff line number Diff line change 1010
1111use LeanPHP \Behat \CodeCoverage \Common \ReportInterface ;
1212use SebastianBergmann \CodeCoverage \CodeCoverage ;
13- use SebastianBergmann \CodeCoverage \Report \XML as XMLCC ;
13+ use SebastianBergmann \CodeCoverage \Report \Xml \ Facade ; ;
1414
1515/**
1616 * XML report
@@ -34,15 +34,15 @@ class Xml implements ReportInterface
3434 */
3535 public function __construct (array $ options )
3636 {
37- if ( ! class_exists ('XMLCC ' )) {
37+ if ( ! class_exists ('SebastianBergmann\CodeCoverage\Report\Xml\Facade ' )) {
3838 throw new \Exception ('XML requires CodeCoverage 4.0+ ' );
3939 }
4040
4141 if ( ! isset ($ options ['target ' ])) {
4242 $ options ['target ' ] = null ;
4343 }
4444
45- $ this ->report = new XMLCC ( );
45+ $ this ->report = new Facade ( array () );
4646 $ this ->options = $ options ;
4747 }
4848
Original file line number Diff line number Diff line change 1212use LeanPHP \Behat \CodeCoverage \Common \Report \Factory ;
1313use SebastianBergmann \CodeCoverage \Filter ;
1414use SebastianBergmann \CodeCoverage \CodeCoverage ;
15+ use SebastianBergmann \CodeCoverage \Report \Php ;
16+
1517/**
1618 * PHP report test
1719 *
@@ -32,7 +34,7 @@ public function testProcess()
3234 ->will ($ this ->returnValue ($ filter ));
3335
3436
35- $ report = new PHP (array ());
37+ $ report = new Php (array ());
3638 $ result = $ report ->process ($ coverage );
3739
3840 $ this ->assertTrue (strncmp ($ result , '<?php ' , 2 ) === 0 );
Original file line number Diff line number Diff line change 1010
1111use VIPSoft \TestCase ;
1212use LeanPHP \Behat \CodeCoverage \Common \Report \Factory ;
13- use SebastianBergmann \CodeCoverage \Report \XML ;
13+ use SebastianBergmann \CodeCoverage \Report \Xml \Facade ;
14+ use org \bovigo \vfs \vfsStream ;
1415
1516/**
1617 * XML report test
@@ -21,12 +22,33 @@ class XmlTest extends TestCase
2122{
2223 public function testProcess ()
2324 {
24- if ( ! class_exists ('XML ' )) {
25- $ this ->markTestSkipped ();
25+ vfsStream::setup ('tmp ' );
26+ $ target = vfsStream::url ('tmp ' );
27+
28+ file_put_contents ($ target . '/file ' , "test \n" );
29+
30+ $ report = new \SebastianBergmann \CodeCoverage \Node \Directory ($ target );
31+ $ report ->addFile ('file ' , array ('class ' => array (1 => 1 )), array (), false );
32+
33+ $ coverage = $ this ->createMock ('SebastianBergmann\CodeCoverage\CodeCoverage ' );
34+ $ coverage ->expects ($ this ->atLeast (1 ))
35+ ->method ('getReport ' )
36+ ->will ($ this ->returnValue ($ report ));
37+ $ coverage ->expects ($ this ->once ())
38+ ->method ('getTests ' )
39+ ->will ($ this ->returnValue (array ()));
2640
27- return ;
28- }
2941
30- $ this ->markTestIncomplete ();
42+
43+ $ report = new Xml (array (
44+ 'target ' => $ target ,
45+ ));
46+
47+ try {
48+ $ result = $ report ->process ($ coverage );
49+ } catch (\Exception $ e ) {
50+ print_r ($ e ->getMessage ());
51+ $ this ->fail ();
52+ }
3153 }
3254}
You can’t perform that action at this time.
0 commit comments