From 5bac9ec7256ccbc159e52b995a8adc2187d12a22 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Thu, 6 Jul 2017 16:51:20 -0500 Subject: [PATCH] Fix eof logic and remove seek tests for ParallelHandle --- lib/ParallelHandle.php | 2 +- test/ParallelHandleTest.php | 34 ---------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/lib/ParallelHandle.php b/lib/ParallelHandle.php index b1a8718..728ee95 100644 --- a/lib/ParallelHandle.php +++ b/lib/ParallelHandle.php @@ -96,7 +96,7 @@ class ParallelHandle implements Handle { * {@inheritdoc} */ public function eof(): bool { - return $this->pendingWrites > 0 && $this->size <= $this->position; + return $this->pendingWrites === 0 && $this->size <= $this->position; } public function read(int $length = self::DEFAULT_READ_LENGTH): Promise { diff --git a/test/ParallelHandleTest.php b/test/ParallelHandleTest.php index cbdef53..110ed54 100644 --- a/test/ParallelHandleTest.php +++ b/test/ParallelHandleTest.php @@ -19,38 +19,4 @@ class ParallelHandleTest extends AsyncHandleTest { yield $pool->shutdown(); }); } - - /** - * @expectedException \Amp\File\PendingOperationError - */ - public function testSimultaneousSeeks() { - $this->execute(function () { - /** @var \Amp\File\Handle $handle */ - $handle = yield File\open(__FILE__, "r"); - - $promise1 = $handle->seek(0); - $promise2 = $handle->seek(10); - - $this->assertSame(0, yield $promise1); - - yield $promise2; - }); - } - - /** - * @expectedException \Amp\File\PendingOperationError - */ - public function testReadWhileSeeking() { - $this->execute(function () { - /** @var \Amp\File\Handle $handle */ - $handle = yield File\open(__FILE__, "r"); - - $promise1 = $handle->seek(0); - $promise2 = $handle->read(); - - $this->assertSame(0, yield $promise1); - - yield $promise2; - }); - } }