fix some ftp bugs

This commit is contained in:
Dennis Eichhorn 2022-12-24 23:58:30 +01:00
parent 0cf775c8dd
commit 7889f9ad7c
3 changed files with 8 additions and 12 deletions

View File

@ -482,7 +482,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
public function testStaticOwner() : void public function testStaticOwner() : void
{ {
$dirTestPath = __DIR__ . '/dirtest'; $dirTestPath = __DIR__ . '/dirtest';
self::assertNotEmpty(Directory::owner(self::$con, $dirTestPath)); self::assertTrue(!empty(Directory::owner(self::$con, $dirTestPath)));
} }
/** /**
@ -823,7 +823,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertNotEmpty($dir->getOwner()); self::assertTrue(!empty($dir->getOwner()));
} }
/** /**

View File

@ -615,7 +615,7 @@ final class FileTest extends \PHPUnit\Framework\TestCase
public function testStaticOwner() : void public function testStaticOwner() : void
{ {
$dirTestPath = __DIR__ . '/dirtest/test.txt'; $dirTestPath = __DIR__ . '/dirtest/test.txt';
self::assertNotEmpty(File::owner(self::$con, $dirTestPath)); self::assertTrue(!empty(File::owner(self::$con, $dirTestPath)));
} }
/** /**
@ -658,15 +658,13 @@ final class FileTest extends \PHPUnit\Framework\TestCase
} }
/** /**
* @testdox Reading the content of a none-existing file throws a PathException * @testdox Reading the content of a none-existing file returns an empty string
* @covers phpOMS\System\File\Ftp\File<extended> * @covers phpOMS\System\File\Ftp\File<extended>
* @group framework * @group framework
*/ */
public function testInvalidGetPath() : void public function testInvalidGetPath() : void
{ {
$this->expectException(\phpOMS\System\File\PathException::class); self::assertEquals('', File::get(self::$con, __DIR__ . '/invalid.txt'));
File::get(self::$con, __DIR__ . '/invalid.txt');
} }
/** /**
@ -855,7 +853,7 @@ final class FileTest extends \PHPUnit\Framework\TestCase
$testFile = __DIR__ . '/dirtest/test.txt'; $testFile = __DIR__ . '/dirtest/test.txt';
$file = new File(new HttpUri(self::BASE . $testFile), self::$con); $file = new File(new HttpUri(self::BASE . $testFile), self::$con);
self::assertNotEmpty($file->getOwner()); self::assertTrue(!empty($file->getOwner()));
} }
/** /**

View File

@ -1005,15 +1005,13 @@ final class FtpStorageTest extends \PHPUnit\Framework\TestCase
} }
/** /**
* @testdox Reading the content of a none-existing file throws a PathException * @testdox Reading the content of a none-existing file returns an empty result
* @covers phpOMS\System\File\Ftp\FtpStorage<extended> * @covers phpOMS\System\File\Ftp\FtpStorage<extended>
* @group framework * @group framework
*/ */
public function testInvalidGetPathFile() : void public function testInvalidGetPathFile() : void
{ {
$this->expectException(\phpOMS\System\File\PathException::class); self::assertEquals('', FtpStorage::get(__DIR__ . '/invalid.txt'));
FtpStorage::get(__DIR__ . '/invalid.txt');
} }
/** /**