Skip to content

Commit b86307d

Browse files
Minor fixes
1 parent 8d09841 commit b86307d

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/Php73/bootstrap.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
if (PHP_VERSION_ID < 70300) {
1313
if (!function_exists('is_countable')) {
14-
function is_countable($var) {
15-
return is_array($var) || $var instanceof Countable;
16-
}
14+
function is_countable($var) { return is_array($var) || $var instanceof Countable; }
1715
}
1816
}

tests/Php72/Php72Test.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testSapiWindowsVt100SupportWarnsOnInvalidInputType()
8787
$this->markTestSkipped('Windows only test');
8888
}
8989

90-
$this->setExpectedException('PHPUnit_Framework_Error_Warning', 'expects parameter 1 to be resource');
90+
$this->setExpectedException('PHPUnit\Framework\Error\Warning', 'expects parameter 1 to be resource');
9191
sapi_windows_vt100_support('foo', true);
9292
}
9393

@@ -100,7 +100,7 @@ public function testSapiWindowsVt100SupportWarnsOnInvalidStream()
100100
$this->markTestSkipped('Windows only test');
101101
}
102102

103-
$this->setExpectedException('PHPUnit_Framework_Error_Warning', 'was not able to analyze the specified stream');
103+
$this->setExpectedException('PHPUnit\Framework\Error\Warning', 'was not able to analyze the specified stream');
104104
sapi_windows_vt100_support(fopen('php://memory', 'wb'), true);
105105
}
106106

@@ -119,7 +119,20 @@ public function testStreamIsatty()
119119
*/
120120
public function testStreamIsattyWarnsOnInvalidInputType()
121121
{
122-
$this->setExpectedException('PHPUnit_Framework_Error_Warning', 'expects parameter 1 to be resource');
122+
$this->setExpectedException('PHPUnit\Framework\Error\Warning', 'expects parameter 1 to be resource');
123123
stream_isatty('foo');
124124
}
125+
126+
public function setExpectedException($exception, $message = '', $code = null)
127+
{
128+
if (!class_exists('PHPUnit\Framework\Error\Notice')) {
129+
$exception = str_replace('PHPUnit\\Framework\\Error\\', 'PHPUnit_Framework_Error_', $exception);
130+
}
131+
if (method_exists($this, 'expectException')) {
132+
$this->expectException($exception);
133+
$this->expectExceptionMessage($message);
134+
} else {
135+
parent::setExpectedException($exception, $message, $code);
136+
}
137+
}
125138
}

tests/Php73/Php73Test.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
*/
1919
class Php73Test extends TestCase
2020
{
21-
/**
22-
* @covers Symfony\Polyfill\Php73\Php73::is_countable
23-
*/
2421
public function testIsCountable()
2522
{
2623
$this->assertTrue(is_countable(array(1, 2, '3')));
@@ -30,7 +27,6 @@ public function testIsCountable()
3027
}
3128

3229
/**
33-
* @covers Symfony\Polyfill\Php73\Php73::is_countable
3430
* @requires PHP 5.5
3531
*/
3632
public function testIsCountableForGenerator()

0 commit comments

Comments
 (0)