Skip to content

Commit 1a83af6

Browse files
Add setForceCoversAnnotation().
1 parent 4d4b323 commit 1a83af6

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

PHP/CodeCoverage.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ class PHP_CodeCoverage
126126
*
127127
* @param PHP_CodeCoverage_Driver $driver
128128
* @param PHP_CodeCoverage_Filter $filter
129-
* @param boolean $forceCoversAnnotation
130129
* @throws InvalidArgumentException
131130
*/
132-
public function __construct(PHP_CodeCoverage_Driver $driver = NULL, PHP_CodeCoverage_Filter $filter = NULL, $forceCoversAnnotation = FALSE)
131+
public function __construct(PHP_CodeCoverage_Driver $driver = NULL, PHP_CodeCoverage_Filter $filter = NULL)
133132
{
134133
if ($driver === NULL) {
135134
$driver = new PHP_CodeCoverage_Driver_Xdebug;
@@ -139,13 +138,8 @@ public function __construct(PHP_CodeCoverage_Driver $driver = NULL, PHP_CodeCove
139138
$filter = PHP_CodeCoverage_Filter::getInstance();
140139
}
141140

142-
if (!is_bool($forceCoversAnnotation)) {
143-
throw new InvalidArgumentException;
144-
}
145-
146-
$this->driver = $driver;
147-
$this->filter = $filter;
148-
$this->forceCoversAnnotation = $forceCoversAnnotation;
141+
$this->driver = $driver;
142+
$this->filter = $filter;
149143
}
150144

151145
/**
@@ -389,6 +383,19 @@ public function filter()
389383
return $this->filter;
390384
}
391385

386+
/**
387+
* @param boolean $flag
388+
* @throws InvalidArgumentException
389+
*/
390+
public function setForceCoversAnnotation($flag)
391+
{
392+
if (!is_bool($flag)) {
393+
throw new InvalidArgumentException;
394+
}
395+
396+
$this->forceCoversAnnotation = $flag;
397+
}
398+
392399
/**
393400
* @param boolean $flag
394401
* @throws InvalidArgumentException

Tests/PHP/CodeCoverageTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ public function testConstructor()
9090
$this->assertSame($filter, $coverage->filter());
9191
}
9292

93-
/**
94-
* @covers PHP_CodeCoverage::__construct
95-
* @expectedException InvalidArgumentException
96-
*/
97-
public function testConstructor2()
98-
{
99-
$coverage = new PHP_CodeCoverage(NULL, NULL, NULL);
100-
}
101-
10293
/**
10394
* @covers PHP_CodeCoverage::start
10495
* @covers PHP_CodeCoverage::stop

0 commit comments

Comments
 (0)