diff --git a/tests/Utils/FileSystem.phpt b/tests/Utils/FileSystem.phpt index ac34b4962..75be57c11 100644 --- a/tests/Utils/FileSystem.phpt +++ b/tests/Utils/FileSystem.phpt @@ -40,12 +40,14 @@ Assert::exception(function () { test(function () { // copy + Assert::false(stream_is_local('remote://example.com')); + FileSystem::write(TEMP_DIR . '/3/file', 'Hello'); FileSystem::copy(TEMP_DIR . '/3/file', TEMP_DIR . '/3/x/file'); Assert::same('Hello', FileSystem::read(TEMP_DIR . '/3/x/file')); - FileSystem::copy('http://example.com', TEMP_DIR . '/3/x/y/file'); + FileSystem::copy('remote://example.com', TEMP_DIR . '/3/x/y/file'); Assert::true(is_file(TEMP_DIR . '/3/x/y/file')); FileSystem::write(TEMP_DIR . '/5/newfile', 'World'); @@ -56,7 +58,7 @@ test(function () { // copy Assert::same('Hello', FileSystem::read(TEMP_DIR . '/3/x/file')); Assert::exception(function () { - FileSystem::copy('http://example.com', TEMP_DIR . '/3/x/file', FALSE); + FileSystem::copy('remote://example.com', TEMP_DIR . '/3/x/file', FALSE); }, Nette\InvalidStateException::class, "File or directory '%a%' already exists."); Assert::same('Hello', FileSystem::read(TEMP_DIR . '/3/x/file')); @@ -135,4 +137,5 @@ test(function () { // isAbsolute Assert::true(FileSystem::isAbsolute('d:\file')); Assert::true(FileSystem::isAbsolute('D:\file')); Assert::true(FileSystem::isAbsolute('http://file')); + Assert::true(FileSystem::isAbsolute('remote://file')); }); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index d5af950ff..629536303 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -38,3 +38,12 @@ function test(\Closure $function) before(); $function(); } + + +class RemoteStream /* extends \streamWrapper */ +{ + public function stream_open() { return TRUE; } + public function url_stat() { return FALSE; } +} + +stream_wrapper_register('remote', RemoteStream::class, STREAM_IS_URL);