66
77use Nimut \PhpunitMerger \Command \CoverageCommand ;
88use Nimut \PhpunitMerger \Tests \Command \AbstractCommandTestCase ;
9- use Prophecy \Argument ;
109use Symfony \Component \Console \Input \ArgvInput ;
1110use Symfony \Component \Console \Output \OutputInterface ;
1211
@@ -28,11 +27,12 @@ public function testCoverageWritesOutputFile()
2827 $ this ->logDirectory . $ this ->outputFile ,
2928 ]
3029 );
31- $ output = $ this ->prophesize (OutputInterface::class);
32- $ output ->write (Argument::any ())->shouldNotBeCalled ();
30+ $ output = $ this ->getMockBuilder (OutputInterface::class)
31+ ->getMock ();
32+ $ output ->method ('write ' )->willThrowException (new \Exception ());
3333
3434 $ command = new CoverageCommand ();
35- $ command ->run ($ input , $ output-> reveal () );
35+ $ command ->run ($ input , $ output );
3636
3737 $ this ->assertFileExists ($ this ->logDirectory . $ this ->outputFile );
3838 }
@@ -47,11 +47,11 @@ public function testCoverageWritesStandardOutput()
4747 $ this ->logDirectory . 'coverage/ ' ,
4848 ]
4949 );
50- $ output = $ this ->prophesize (OutputInterface::class);
51- $ output -> write (Argument:: type ( ' string ' ))-> shouldBeCalled ();
50+ $ output = $ this ->getMockBuilder (OutputInterface::class)
51+ -> getMock ();
5252
5353 $ command = new CoverageCommand ();
54- $ command ->run ($ input , $ output-> reveal () );
54+ $ command ->run ($ input , $ output );
5555 }
5656
5757 public function testCoverageWritesHtmlReport ()
@@ -66,11 +66,11 @@ public function testCoverageWritesHtmlReport()
6666 '--html= ' . $ this ->logDirectory . dirname ($ this ->outputFile ),
6767 ]
6868 );
69- $ output = $ this ->prophesize (OutputInterface::class);
70- $ output -> write (Argument:: type ( ' string ' ))-> shouldBeCalled ();
69+ $ output = $ this ->getMockBuilder (OutputInterface::class)
70+ -> getMock ();
7171
7272 $ command = new CoverageCommand ();
73- $ command ->run ($ input , $ output-> reveal () );
73+ $ command ->run ($ input , $ output );
7474
7575 $ this ->assertFileExists ($ this ->logDirectory . $ this ->outputFile );
7676 }
@@ -89,11 +89,11 @@ public function testCoverageWritesHtmlReportWithCustomBounds()
8989 '--highLowerBound=70 ' ,
9090 ]
9191 );
92- $ output = $ this ->prophesize (OutputInterface::class);
93- $ output -> write (Argument:: type ( ' string ' ))-> shouldBeCalled ();
92+ $ output = $ this ->getMockBuilder (OutputInterface::class)
93+ -> getMock ();
9494
9595 $ command = new CoverageCommand ();
96- $ command ->run ($ input , $ output-> reveal () );
96+ $ command ->run ($ input , $ output );
9797
9898 $ this ->assertFileExists ($ this ->logDirectory . $ this ->outputFile );
9999
@@ -122,11 +122,12 @@ public function testCoverageWritesOutputFileAndHtmlReport()
122122 $ this ->logDirectory . $ this ->outputFile ,
123123 ]
124124 );
125- $ output = $ this ->prophesize (OutputInterface::class);
126- $ output ->write (Argument::any ())->shouldNotBeCalled ();
125+ $ output = $ this ->getMockBuilder (OutputInterface::class)
126+ ->getMock ();
127+ $ output ->method ('write ' )->willThrowException (new \Exception ());
127128
128129 $ command = new CoverageCommand ();
129- $ command ->run ($ input , $ output-> reveal () );
130+ $ command ->run ($ input , $ output );
130131
131132 $ this ->assertFileExists ($ this ->logDirectory . $ this ->outputFile );
132133 $ this ->assertFileExists ($ this ->logDirectory . dirname ($ this ->outputFile ) . '/index.html ' );
0 commit comments