mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 08:34:09 +02:00
Improve PHPUnit assertions
This commit is contained in:
parent
77d750ccc6
commit
14e0915e28
6 changed files with 36 additions and 36 deletions
|
|
@ -20,9 +20,9 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
|
|||
rewind($source);
|
||||
|
||||
$wrapped = $this->wrapSource($source);
|
||||
$this->assertEquals('foo', fread($wrapped, 3));
|
||||
$this->assertEquals('bar', fread($wrapped, 3));
|
||||
$this->assertEquals('', fread($wrapped, 3));
|
||||
$this->assertSame('foo', fread($wrapped, 3));
|
||||
$this->assertSame('bar', fread($wrapped, 3));
|
||||
$this->assertSame('', fread($wrapped, 3));
|
||||
}
|
||||
|
||||
public function testWrite() {
|
||||
|
|
@ -31,9 +31,9 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
$wrapped = $this->wrapSource($source);
|
||||
|
||||
$this->assertEquals(6, fwrite($wrapped, 'foobar'));
|
||||
$this->assertSame(6, fwrite($wrapped, 'foobar'));
|
||||
rewind($source);
|
||||
$this->assertEquals('foobar', stream_get_contents($source));
|
||||
$this->assertSame('foobar', stream_get_contents($source));
|
||||
}
|
||||
|
||||
public function testClose() {
|
||||
|
|
@ -53,19 +53,19 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
$wrapped = $this->wrapSource($source);
|
||||
|
||||
$this->assertEquals(0, ftell($wrapped));
|
||||
$this->assertSame(0, ftell($wrapped));
|
||||
|
||||
fseek($wrapped, 2);
|
||||
$this->assertEquals(2, ftell($source));
|
||||
$this->assertEquals(2, ftell($wrapped));
|
||||
$this->assertSame(2, ftell($source));
|
||||
$this->assertSame(2, ftell($wrapped));
|
||||
|
||||
fseek($wrapped, 2, SEEK_CUR);
|
||||
$this->assertEquals(4, ftell($source));
|
||||
$this->assertEquals(4, ftell($wrapped));
|
||||
$this->assertSame(4, ftell($source));
|
||||
$this->assertSame(4, ftell($wrapped));
|
||||
|
||||
fseek($wrapped, -1, SEEK_END);
|
||||
$this->assertEquals(5, ftell($source));
|
||||
$this->assertEquals(5, ftell($wrapped));
|
||||
$this->assertSame(5, ftell($source));
|
||||
$this->assertSame(5, ftell($wrapped));
|
||||
}
|
||||
|
||||
public function testStat() {
|
||||
|
|
@ -84,7 +84,7 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
|
|||
$wrapped = $this->wrapSource($source);
|
||||
|
||||
ftruncate($wrapped, 2);
|
||||
$this->assertEquals('fo', fread($wrapped, 10));
|
||||
$this->assertSame('fo', fread($wrapped, 10));
|
||||
}
|
||||
|
||||
public function testLock() {
|
||||
|
|
@ -130,10 +130,10 @@ abstract class WrapperTest extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
$source = opendir(__DIR__);
|
||||
$wrapped = $this->wrapSource($source);
|
||||
$this->assertEquals($content[0], readdir($wrapped));
|
||||
$this->assertEquals($content[1], readdir($wrapped));
|
||||
$this->assertEquals($content[2], readdir($wrapped));
|
||||
$this->assertSame($content[0], readdir($wrapped));
|
||||
$this->assertSame($content[1], readdir($wrapped));
|
||||
$this->assertSame($content[2], readdir($wrapped));
|
||||
rewinddir($wrapped);
|
||||
$this->assertEquals($content[0], readdir($wrapped));
|
||||
$this->assertSame($content[0], readdir($wrapped));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue