Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Apr 25, 2018
1 parent 8d09841 commit b86307d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/Php73/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

if (PHP_VERSION_ID < 70300) {
if (!function_exists('is_countable')) {
function is_countable($var) {
return is_array($var) || $var instanceof Countable;
}
function is_countable($var) { return is_array($var) || $var instanceof Countable; }
}
}
19 changes: 16 additions & 3 deletions tests/Php72/Php72Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testSapiWindowsVt100SupportWarnsOnInvalidInputType()
$this->markTestSkipped('Windows only test');
}

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

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

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

Expand All @@ -119,7 +119,20 @@ public function testStreamIsatty()
*/
public function testStreamIsattyWarnsOnInvalidInputType()
{
$this->setExpectedException('PHPUnit_Framework_Error_Warning', 'expects parameter 1 to be resource');
$this->setExpectedException('PHPUnit\Framework\Error\Warning', 'expects parameter 1 to be resource');
stream_isatty('foo');
}

public function setExpectedException($exception, $message = '', $code = null)
{
if (!class_exists('PHPUnit\Framework\Error\Notice')) {
$exception = str_replace('PHPUnit\\Framework\\Error\\', 'PHPUnit_Framework_Error_', $exception);
}
if (method_exists($this, 'expectException')) {
$this->expectException($exception);
$this->expectExceptionMessage($message);
} else {
parent::setExpectedException($exception, $message, $code);
}
}
}
4 changes: 0 additions & 4 deletions tests/Php73/Php73Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
class Php73Test extends TestCase
{
/**
* @covers Symfony\Polyfill\Php73\Php73::is_countable
*/
public function testIsCountable()
{
$this->assertTrue(is_countable(array(1, 2, '3')));
Expand All @@ -30,7 +27,6 @@ public function testIsCountable()
}

/**
* @covers Symfony\Polyfill\Php73\Php73::is_countable
* @requires PHP 5.5
*/
public function testIsCountableForGenerator()
Expand Down

0 comments on commit b86307d

Please sign in to comment.