adjust tests to new phpunit

This commit is contained in:
Robin Appelman 2021-03-02 19:25:27 +01:00
commit a0abe86651
9 changed files with 97 additions and 23 deletions

View file

@ -22,10 +22,8 @@ class CallbackWrapperTest extends WrapperTest {
return \Icewind\Streams\CallbackWrapper::wrap($source, $read, $write, $close, $readDir, $preClose);
}
/**
* @expectedException \BadMethodCallException
*/
public function testWrapInvalidSource() {
$this->expectException(\BadMethodCallException::class);
$this->wrapSource('foo');
}

View file

@ -23,7 +23,9 @@
namespace Icewind\Streams\Tests;
class HashWrapperTest extends \PHPUnit_Framework_TestCase {
use PHPUnit\Framework\TestCase;
class HashWrapperTest extends TestCase {
const DATA = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
/**

View file

@ -17,10 +17,8 @@ class NullWrapperTest extends WrapperTest {
return \Icewind\Streams\NullWrapper::wrap($source);
}
/**
* @expectedException \BadMethodCallException
*/
public function testNoContext() {
$this->expectException(\BadMethodCallException::class);
stream_wrapper_register('null', '\Icewind\Streams\NullWrapper');
$context = stream_context_create(array());
try {
@ -32,10 +30,8 @@ class NullWrapperTest extends WrapperTest {
}
}
/**
* @expectedException \BadMethodCallException
*/
public function testNoSource() {
$this->expectException(\BadMethodCallException::class);
stream_wrapper_register('null', '\Icewind\Streams\NullWrapper');
$context = stream_context_create(array(
'null' => array(
@ -50,10 +46,8 @@ class NullWrapperTest extends WrapperTest {
}
}
/**
* @expectedException \BadMethodCallException
*/
public function testWrapInvalidSource() {
$this->expectException(\BadMethodCallException::class);
$this->wrapSource('foo');
}
}

View file

@ -7,7 +7,9 @@
namespace Icewind\Streams\Tests;
abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
use PHPUnit\Framework\TestCase;
abstract class WrapperTest extends TestCase {
/**
* @param resource $source
* @return resource
@ -93,6 +95,7 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
if (!flock($wrapped, LOCK_EX)) {
$this->fail('Unable to acquire lock');
}
$this->assertTrue(true);
}
public function testStreamOptions() {
@ -101,6 +104,7 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
stream_set_blocking($wrapped, 0);
stream_set_timeout($wrapped, 1, 0);
stream_set_write_buffer($wrapped, 0);
$this->assertTrue(true);
}
public function testReadDir() {

View file

@ -3,10 +3,4 @@
<testsuite name='Stream'>
<directory suffix='.php'>./</directory>
</testsuite>
<filter>
<whitelist Stream="true">
<directory suffix=".php">../src</directory>
</whitelist>
</filter>
</phpunit>