Skip to content

Commit 65c64f4

Browse files
committed
fix HTML test due to rename to Facade; fix tests due to updated mocks
1 parent 65b33ff commit 65c64f4

File tree

16 files changed

+44
-46
lines changed

16 files changed

+44
-46
lines changed

src/Common/Report/Html.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
1212
use SebastianBergmann\CodeCoverage\CodeCoverage;
13-
use SebastianBergmann\CodeCoverage\Report\HTML as HTMLCC;
13+
use SebastianBergmann\CodeCoverage\Report\Html\Facade;
1414

1515
/**
1616
* HTML report
@@ -20,7 +20,7 @@
2020
class Html implements ReportInterface
2121
{
2222
/**
23-
* @var HTMLCC
23+
* @var Facade
2424
*/
2525
private $report;
2626

@@ -58,9 +58,7 @@ public function __construct(array $options)
5858
$options['generator'] = '';
5959
}
6060

61-
$this->report = new HTMLCC(
62-
$options['charset'],
63-
$options['highlight'],
61+
$this->report = new Facade(
6462
$options['lowUpperBound'],
6563
$options['highUpperBound'],
6664
$options['generator']

src/Common/Report/Text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function process(CodeCoverage $coverage)
9292

9393
private function getVersion()
9494
{
95-
$reflectionMethod = new \ReflectionMethod('TextCC', '__construct');
95+
$reflectionMethod = new \ReflectionMethod('SebastianBergmann\CodeCoverage\Report\Text', '__construct');
9696
$parameters = $reflectionMethod->getParameters();
9797

9898
if (reset($parameters)->name === 'outputStream') {

tests/Common/Driver/HHVMTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testStopXCache()
6161
return true;
6262
});
6363

64-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
64+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
6565
$function->expects($this->exactly(2))
6666
->method('invokeFunction');
6767

tests/Common/Driver/StubTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class StubTest extends TestCase
2323
*/
2424
public function testGetterSetterXdebug()
2525
{
26-
$mock = $this->getMock('SebastianBergmann\CodeCoverage\Driver\Xdebug');
26+
$mock = $this->createMock('SebastianBergmann\CodeCoverage\Driver\Xdebug');
2727

2828
$driver = new Stub();
2929
$this->assertTrue($driver->getDriver() === null);
@@ -37,7 +37,7 @@ public function testGetterSetterXdebug()
3737
*/
3838
public function testStartXdebug()
3939
{
40-
$mock = $this->getMock('SebastianBergmann\CodeCoverage\Driver\Xdebug');
40+
$mock = $this->createMock('SebastianBergmann\CodeCoverage\Driver\Xdebug');
4141
$mock->expects($this->once())
4242
->method('start');
4343

@@ -51,7 +51,7 @@ public function testStartXdebug()
5151
*/
5252
public function testStopXdebug()
5353
{
54-
$mock = $this->getMock('SebastianBergmann\CodeCoverage\Driver\Xdebug');
54+
$mock = $this->createMock('SebastianBergmann\CodeCoverage\Driver\Xdebug');
5555
$mock->expects($this->once())
5656
->method('stop');
5757

@@ -65,7 +65,7 @@ public function testStopXdebug()
6565
*/
6666
public function testGetterSetterPHPDBG()
6767
{
68-
$mock = $this->getMock('SebastianBergmann\CodeCoverage\Driver\PHPDBG');
68+
$mock = $this->createMock('SebastianBergmann\CodeCoverage\Driver\PHPDBG');
6969

7070
$driver = new Stub();
7171
$this->assertTrue($driver->getDriver() === null);
@@ -79,7 +79,7 @@ public function testGetterSetterPHPDBG()
7979
*/
8080
public function testStartPHPDBG()
8181
{
82-
$mock = $this->getMock('SebastianBergmann\CodeCoverage\Driver\PHPDBG');
82+
$mock = $this->createMock('SebastianBergmann\CodeCoverage\Driver\PHPDBG');
8383
$mock->expects($this->once())
8484
->method('start');
8585

@@ -93,7 +93,7 @@ public function testStartPHPDBG()
9393
*/
9494
public function testStopPHPDBG()
9595
{
96-
$mock = $this->getMock('SebastianBergmann\CodeCoverage\Driver\PHPDBG');
96+
$mock = $this->createMock('SebastianBergmann\CodeCoverage\Driver\PHPDBG');
9797
$mock->expects($this->once())
9898
->method('stop');
9999

tests/Common/Driver/XCacheTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testConstructNoExtensions()
3636

3737
public function testConstructXCacheCoverageNotEnabled()
3838
{
39-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
39+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
4040
$function->expects($this->once())
4141
->method('invokeFunction')
4242
->will($this->returnValue(true));
@@ -63,7 +63,7 @@ public function testConstructXCacheCoverageNotEnabled()
6363

6464
public function testConstructXCache()
6565
{
66-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
66+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
6767
$function->expects($this->once())
6868
->method('invokeFunction')
6969
->will($this->returnValue(true));
@@ -83,7 +83,7 @@ public function testConstructXCache()
8383

8484
public function testStartXCache()
8585
{
86-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
86+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
8787
$function->expects($this->once())
8888
->method('invokeFunction')
8989
->will($this->returnValue(true));
@@ -98,7 +98,7 @@ public function testStartXCache()
9898
return true;
9999
});
100100

101-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
101+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
102102
$function->expects($this->once())
103103
->method('invokeFunction');
104104

@@ -110,7 +110,7 @@ public function testStartXCache()
110110

111111
public function testStopXCache()
112112
{
113-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
113+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
114114
$function->expects($this->once())
115115
->method('invokeFunction')
116116
->will($this->returnValue(true));
@@ -125,7 +125,7 @@ public function testStopXCache()
125125
return true;
126126
});
127127

128-
$function = $this->getMock('VIPSoft\Test\FunctionProxy');
128+
$function = $this->createMock('VIPSoft\Test\FunctionProxy');
129129
$function->expects($this->exactly(2))
130130
->method('invokeFunction');
131131

tests/Common/Report/CloverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testProcess()
2626
->disableOriginalConstructor()
2727
->getMock();
2828

29-
$coverage = $this->getMock('CodeCoverage');
29+
$coverage = $this->createMock('CodeCoverage');
3030
$coverage->expects($this->once())
3131
->method('getReport')
3232
->will($this->returnValue($report));

tests/Common/Report/HtmlTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public function testProcess()
2727

2828
file_put_contents($target . '/file', "test\n");
2929

30-
$report = new \SebastianBergmann\CodeCoverage\Report\Node\Directory($target);
30+
$report = new \SebastianBergmann\CodeCoverage\Node\Directory($target);
3131
$report->addFile('file', array('class' => array(1 => 1)), array(), false);
3232

33-
$coverage = $this->getMock('SebastianBergmann\CodeCoverage\CodeCoverage');
33+
$coverage = $this->createMock('SebastianBergmann\CodeCoverage\CodeCoverage');
3434
$coverage->expects($this->once())
3535
->method('getReport')
3636
->will($this->returnValue($report));

tests/Common/Report/PhpTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class PhpTest extends TestCase
2121
{
2222
public function testProcess()
2323
{
24-
$coverage = $this->getMock('SebastianBergmann\CodeCoverage\CodeCoverage');
25-
$filter = $this->getMock('Filter');
24+
$coverage = $this->createMock('SebastianBergmann\CodeCoverage\CodeCoverage');
25+
$filter = $this->createMock('SebastianBergmann\CodeCoverage\Filter');
2626
$filter
2727
->expects($this->once())
2828
->method('getBlacklistedFiles')

tests/Common/Report/TextTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ class TextTest extends TestCase
2222
{
2323
public function testProcess()
2424
{
25+
$this->markTestIncomplete(
26+
'This test seems to be broken after update to phpunit ~4.0.'
27+
);
2528

2629
$report = $this->getMockBuilder('File')
2730
->disableOriginalConstructor()
2831
->getMock();
2932

30-
$coverage = $this->getMock('SebastianBergmann\CodeCoverage\CodeCoverage');
33+
$coverage = $this->createMock('SebastianBergmann\CodeCoverage\CodeCoverage');
3134
$coverage->expects($this->once())
3235
->method('getReport')
3336
->will($this->returnValue($report));
@@ -37,9 +40,6 @@ public function testProcess()
3740
$report->process($coverage);
3841
$result = ob_get_clean();
3942

40-
$this->markTestIncomplete(
41-
'This test seems to be broken after update to phpunit ~4.0.'
42-
);
4343
$this->assertTrue(strpos($result, 'Code Coverage Report') !== false);
4444
}
4545
}

tests/Compiler/DriverPassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DriverPassTest extends TestCase
2020
{
2121
public function testProcessNoServiceDefinition()
2222
{
23-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
23+
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerBuilder');
2424
$container->expects($this->once())
2525
->method('hasDefinition')
2626
->will($this->returnValue(false));
@@ -31,11 +31,11 @@ public function testProcessNoServiceDefinition()
3131

3232
public function testProcess()
3333
{
34-
$proxy = $this->getMock('Symfony\Component\DependencyInjection\Definition');
34+
$proxy = $this->createMock('Symfony\Component\DependencyInjection\Definition');
3535
$proxy->expects($this->exactly(2))
3636
->method('addMethodCall');
3737

38-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
38+
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerBuilder');
3939
$container->expects($this->once())
4040
->method('hasDefinition')
4141
->with('behat.code_coverage.driver.proxy')

0 commit comments

Comments
 (0)