From 9b7a5fc2a5f72989505278b95c4dba4b3d45d027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 7 Aug 2017 12:39:42 +0200 Subject: [PATCH] [ticket/15305] Add tests PHPBB3-15305 --- tests/storage/adapter/local_test.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/storage/adapter/local_test.php b/tests/storage/adapter/local_test.php index a2725cd387..0eeb3f2b31 100644 --- a/tests/storage/adapter/local_test.php +++ b/tests/storage/adapter/local_test.php @@ -103,4 +103,23 @@ unlink($this->path . 'file2.txt'); } + public function test_read_stream() + { + file_put_contents($this->path . 'file.txt', ''); + $stream = $this->adapter->read_stream($this->path . 'file.txt'); + $this->assertTrue(is_resource($stream)); + fclose($stream); + unlink($this->path . 'file.txt'); + } + + public function test_write_stream() + { + file_put_contents($this->path . 'file.txt', 'abc'); + $stream = fopen($this->path . 'file.txt', 'r'); + $this->adapter->write_stream($this->path . 'file2.txt', $stream); + fclose($stream); + $this->assertEquals(file_get_contents($this->path . 'file2.txt'), 'abc'); + unlink($this->path . 'file.txt'); + unlink($this->path . 'file2.txt'); + } }