diff --git a/Message/Console/ConsoleResponse.php b/Message/Console/ConsoleResponse.php index 2d82e8a2b..c954e77c5 100644 --- a/Message/Console/ConsoleResponse.php +++ b/Message/Console/ConsoleResponse.php @@ -98,13 +98,13 @@ final class ConsoleResponse extends ResponseAbstract implements RenderableInterf /** * Generate response based on header. * - * @param bool $optimize Optimize response / minify + * @param mixed $data Data passt to render function. (0 => bool: $optimize) * * @return string * * @since 1.0.0 */ - public function render(bool $optimize = false) : string + public function render(...$data) : string { $types = $this->header->get('Content-Type'); @@ -114,7 +114,7 @@ final class ConsoleResponse extends ResponseAbstract implements RenderableInterf } } - return $this->getRaw($optimize); + return $this->getRaw($data[0] ?? false); } /** diff --git a/Message/Http/HttpResponse.php b/Message/Http/HttpResponse.php index 7927d225d..8267650b3 100644 --- a/Message/Http/HttpResponse.php +++ b/Message/Http/HttpResponse.php @@ -100,7 +100,7 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface /** * Generate response based on header. * - * @param mixed $data Data passt to render function. (0 => bool: $optimize + * @param mixed $data Data passt to render function. (0 => bool: $optimize) * * @return string * @@ -196,7 +196,7 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface return $result; } - + /** * Ends the output buffering * diff --git a/Message/Socket/SocketResponse.php b/Message/Socket/SocketResponse.php index daa9f9336..24c8571b9 100644 --- a/Message/Socket/SocketResponse.php +++ b/Message/Socket/SocketResponse.php @@ -84,13 +84,13 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa /** * Generate response based on header. * - * @param bool $optimize Optimize response / minify + * @param mixed $data Data passt to render function. (0 => bool: $optimize) * * @return string * * @since 1.0.0 */ - public function render(bool $optimize = false) : string + public function render(...$data) : string { $types = $this->header->get('Content-Type'); @@ -100,7 +100,7 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa } } - return $this->getRaw($optimize); + return $this->getRaw($data[0] ?? false); } /** diff --git a/tests/Localization/L11nManagerTest.php b/tests/Localization/L11nManagerTest.php index f1fee47f4..338457a93 100644 --- a/tests/Localization/L11nManagerTest.php +++ b/tests/Localization/L11nManagerTest.php @@ -53,8 +53,8 @@ class L11nManagerTest extends \PHPUnit\Framework\TestCase self::assertFalse($this->l11nManager->isLanguageLoaded('en')); self::assertEquals([], $this->l11nManager->getModuleLanguage('en')); self::assertEquals([], $this->l11nManager->getModuleLanguage('en', 'Admin')); - self::assertEquals('ERROR', $this->l11nManager->getHtml('en', 'Admin', 'Backend', 'Test2')); - self::assertEquals('ERROR', $this->l11nManager->getText('en', 'Admin', 'Backend', 'Test2')); + self::assertEquals('ERROR-Test2', $this->l11nManager->getHtml('en', 'Admin', 'Backend', 'Test2')); + self::assertEquals('ERROR-Test2', $this->l11nManager->getText('en', 'Admin', 'Backend', 'Test2')); } /** diff --git a/tests/Router/SocketRouterTest.php b/tests/Router/SocketRouterTest.php index 627456cda..e925fb477 100644 --- a/tests/Router/SocketRouterTest.php +++ b/tests/Router/SocketRouterTest.php @@ -107,7 +107,7 @@ class SocketRouterTest extends \PHPUnit\Framework\TestCase null, null, 'TEST', - 0, + 'TEST', 1, null, null, @@ -140,7 +140,7 @@ class SocketRouterTest extends \PHPUnit\Framework\TestCase null, null, 'TEST', - 0, + 'TEST', 1, null, null, @@ -151,7 +151,7 @@ class SocketRouterTest extends \PHPUnit\Framework\TestCase null, null, 'InvalidModule', - 0, + 'InvalidModule', 1, null, null, @@ -162,7 +162,7 @@ class SocketRouterTest extends \PHPUnit\Framework\TestCase null, null, 'TEST', - 0, + 'TEST', 99, null, null, diff --git a/tests/Router/WebRouterTest.php b/tests/Router/WebRouterTest.php index 6fa92abe4..7add6a5a6 100644 --- a/tests/Router/WebRouterTest.php +++ b/tests/Router/WebRouterTest.php @@ -198,7 +198,7 @@ class WebRouterTest extends \PHPUnit\Framework\TestCase null, null, 'TEST', - 0, + 'TEST', 1, null, null, @@ -238,7 +238,7 @@ class WebRouterTest extends \PHPUnit\Framework\TestCase null, null, 'TEST', - 0, + 'TEST', 1, null, null, @@ -249,7 +249,7 @@ class WebRouterTest extends \PHPUnit\Framework\TestCase null, null, 'InvalidModule', - 0, + 'InvalidModule', 1, null, null, @@ -260,7 +260,7 @@ class WebRouterTest extends \PHPUnit\Framework\TestCase null, null, 'TEST', - 0, + 'TEST', 99, null, null, diff --git a/tests/Stdlib/Base/AddressTypeTest.php b/tests/Stdlib/Base/AddressTypeTest.php index bd1282a80..5a5c71e1a 100644 --- a/tests/Stdlib/Base/AddressTypeTest.php +++ b/tests/Stdlib/Base/AddressTypeTest.php @@ -27,7 +27,7 @@ class AddressTypeTest extends \PHPUnit\Framework\TestCase */ public function testEnumCount() : void { - self::assertCount(7, AddressType::getconstants()); + self::assertCount(8, AddressType::getconstants()); } /** @@ -52,5 +52,6 @@ class AddressTypeTest extends \PHPUnit\Framework\TestCase self::assertEquals(5, AddressType::WORK); self::assertEquals(6, AddressType::CONTRACT); self::assertEquals(7, AddressType::OTHER); + self::assertEquals(8, AddressType::EDUCATION); } } diff --git a/tests/System/File/Ftp/DirectoryTest.php b/tests/System/File/Ftp/DirectoryTest.php index 375b649c3..f59e5c417 100644 --- a/tests/System/File/Ftp/DirectoryTest.php +++ b/tests/System/File/Ftp/DirectoryTest.php @@ -39,6 +39,22 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase $this->markTestSkipped( 'The ftp connection is not available.' ); + } else { + try { + $mkdir = \ftp_mkdir(self::$con, '0xFF'); + \ftp_rmdir(self::$con, '0xFF'); + + $put = \ftp_put(self::$con, '0x00'); + \ftp_delete(self::$con, '0x00'); + + if (!$mkdir || !$put) { + throw new \Exception(); + } + } catch (\Throwable $t) { + $this->markTestSkipped( + 'No write permissions on ftp server.' + ); + } } } diff --git a/tests/System/File/Ftp/FileTest.php b/tests/System/File/Ftp/FileTest.php index 1b5c9898e..ac597c7bf 100644 --- a/tests/System/File/Ftp/FileTest.php +++ b/tests/System/File/Ftp/FileTest.php @@ -41,6 +41,22 @@ class FileTest extends \PHPUnit\Framework\TestCase $this->markTestSkipped( 'The ftp connection is not available.' ); + } else { + try { + $mkdir = \ftp_mkdir(self::$con, '0xFF'); + \ftp_rmdir(self::$con, '0xFF'); + + $put = \ftp_put(self::$con, '0x00'); + \ftp_delete(self::$con, '0x00'); + + if (!$mkdir || !$put) { + throw new \Exception(); + } + } catch (\Throwable $t) { + $this->markTestSkipped( + 'No write permissions on ftp server.' + ); + } } } diff --git a/tests/System/File/Ftp/FtpStorageTest.php b/tests/System/File/Ftp/FtpStorageTest.php index f496b2ab5..d2e8aab7b 100644 --- a/tests/System/File/Ftp/FtpStorageTest.php +++ b/tests/System/File/Ftp/FtpStorageTest.php @@ -38,10 +38,26 @@ class FtpStorageTest extends \PHPUnit\Framework\TestCase protected function setUp() : void { - if (self::$con == false) { + if (self::$con === false) { $this->markTestSkipped( 'The ftp connection is not available.' ); + } else { + try { + $mkdir = \ftp_mkdir(self::$con, '0xFF'); + \ftp_rmdir(self::$con, '0xFF'); + + $put = \ftp_put(self::$con, '0x00'); + \ftp_delete(self::$con, '0x00'); + + if (!$mkdir || !$put) { + throw new \Exception(); + } + } catch (\Throwable $t) { + $this->markTestSkipped( + 'No write permissions on ftp server.' + ); + } } FtpStorage::with(self::$con); diff --git a/tests/Utils/StringUtilsTest.php b/tests/Utils/StringUtilsTest.php index 08e7c4901..0fa6206be 100644 --- a/tests/Utils/StringUtilsTest.php +++ b/tests/Utils/StringUtilsTest.php @@ -159,7 +159,7 @@ class StringUtilsTest extends \PHPUnit\Framework\TestCase })); self::assertEquals('abc', StringUtils::stringify(new class() implements RenderableInterface { - public function render() : string + public function render(...$data) : string { return 'abc'; } diff --git a/tests/Utils/TaskSchedule/TaskSchedulerTest.php b/tests/Utils/TaskSchedule/TaskSchedulerTest.php index a40b1a166..37611bba6 100644 --- a/tests/Utils/TaskSchedule/TaskSchedulerTest.php +++ b/tests/Utils/TaskSchedule/TaskSchedulerTest.php @@ -28,7 +28,7 @@ class TaskSchedulerTest extends \PHPUnit\Framework\TestCase { if (\stripos(\PHP_OS, 'WIN') === false) { $this->markTestSkipped( - 'The OS is not linux.' + 'The OS is not windows.' ); } }