From 5ec90ec1ba4d63ed4712f9f5921060f22c39d526 Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 2 Jan 2018 01:14:55 +0100 Subject: [PATCH] New tests (FS writing is broken, fix it) --- composer.json | 2 +- composer.lock | 77 +++++++++++------------ src/Colour.php | 1 - src/IO/File.php | 7 ++- src/Net/CIDR.php | 12 ++-- src/Net/IP.php | 4 +- src/TemplateEngine.php | 6 +- src/Zalgo.php | 39 ++++++------ tests/CIDRTest.php | 23 +++++++ tests/ColourTest.php | 3 +- tests/FileSystemTest.php | 132 +++++++++++++++++++++++++++++++++++++++ tests/IPTest.php | 77 +++++++++++++++++++++++ tests/ZalgoTest.php | 17 +++++ utility.php | 3 +- 14 files changed, 328 insertions(+), 75 deletions(-) create mode 100644 tests/CIDRTest.php create mode 100644 tests/FileSystemTest.php create mode 100644 tests/IPTest.php create mode 100644 tests/ZalgoTest.php diff --git a/composer.json b/composer.json index 9bc5d35c..50047350 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ }, "require": { "php": ">=7.2", - "flashwave/aitemu": "dev-master#ac3050d17e3aa31a088caf15469bb51e5b165d40", + "flashwave/aitemu": "dev-master#3ddb8147ed809cfba59c46f6e3d3af9fb2a86ace", "twig/twig": "~2.4", "nesbot/carbon": "~1.22", "illuminate/database": "~5.5", diff --git a/composer.lock b/composer.lock index dbbc30ce..00e8c856 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "e20f18d591572a55dce8ab1b98dc7b5a", + "content-hash": "4c9cc87ad91ef38f4333d4e9e80a0f39", "packages": [ { "name": "doctrine/annotations", @@ -590,17 +590,16 @@ "source": { "type": "git", "url": "https://github.com/flashwave/aitemu.git", - "reference": "ac3050d17e3aa31a088caf15469bb51e5b165d40" + "reference": "3ddb8147ed809cfba59c46f6e3d3af9fb2a86ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/flashwave/aitemu/zipball/ac3050d17e3aa31a088caf15469bb51e5b165d40", - "reference": "ac3050d17e3aa31a088caf15469bb51e5b165d40", + "url": "https://api.github.com/repos/flashwave/aitemu/zipball/3ddb8147ed809cfba59c46f6e3d3af9fb2a86ace", + "reference": "3ddb8147ed809cfba59c46f6e3d3af9fb2a86ace", "shasum": "" }, "require": { - "php": ">=7.2", - "twig/twig": "~2.0" + "php": ">=7.2" }, "require-dev": { "phpunit/phpunit": "~6.0" @@ -615,13 +614,13 @@ "license": [ "MIT" ], - "description": "PHP Framework, primarily for personal use.", + "description": "PHP router library, mainly for personal use.", "homepage": "https://github.com/flashwave/aitemu", - "time": "2017-12-17T01:25:07+00:00" + "time": "2018-01-01T22:36:19+00:00" }, { "name": "illuminate/container", - "version": "v5.5.17", + "version": "v5.5.28", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", @@ -665,16 +664,16 @@ }, { "name": "illuminate/contracts", - "version": "v5.5.17", + "version": "v5.5.28", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "d9e269284eba43bd2e9e8d1f1ba12362b00ec096" + "reference": "03e9014d2091a30b025c895aa6d39c2755576ea5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/d9e269284eba43bd2e9e8d1f1ba12362b00ec096", - "reference": "d9e269284eba43bd2e9e8d1f1ba12362b00ec096", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/03e9014d2091a30b025c895aa6d39c2755576ea5", + "reference": "03e9014d2091a30b025c895aa6d39c2755576ea5", "shasum": "" }, "require": { @@ -705,20 +704,20 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2017-09-19T13:09:37+00:00" + "time": "2017-11-22T19:01:14+00:00" }, { "name": "illuminate/database", - "version": "v5.5.17", + "version": "v5.5.28", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "9b3bdecfd74279d305ad1d3d56ae62b1b54a230d" + "reference": "e5f0c2ce642baf74fc126f0077032b13c50e8997" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/9b3bdecfd74279d305ad1d3d56ae62b1b54a230d", - "reference": "9b3bdecfd74279d305ad1d3d56ae62b1b54a230d", + "url": "https://api.github.com/repos/illuminate/database/zipball/e5f0c2ce642baf74fc126f0077032b13c50e8997", + "reference": "e5f0c2ce642baf74fc126f0077032b13c50e8997", "shasum": "" }, "require": { @@ -764,20 +763,20 @@ "orm", "sql" ], - "time": "2017-10-17T12:16:50+00:00" + "time": "2017-12-19T14:02:10+00:00" }, { "name": "illuminate/filesystem", - "version": "v5.5.17", + "version": "v5.5.28", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "9e45ea9a64787455944bca2c6588cf2da085c360" + "reference": "505d1a1e4a4d6e05db7f4d54bb1c9668e0afc754" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/9e45ea9a64787455944bca2c6588cf2da085c360", - "reference": "9e45ea9a64787455944bca2c6588cf2da085c360", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/505d1a1e4a4d6e05db7f4d54bb1c9668e0afc754", + "reference": "505d1a1e4a4d6e05db7f4d54bb1c9668e0afc754", "shasum": "" }, "require": { @@ -814,20 +813,20 @@ ], "description": "The Illuminate Filesystem package.", "homepage": "https://laravel.com", - "time": "2017-09-13T13:01:30+00:00" + "time": "2017-12-14T13:33:54+00:00" }, { "name": "illuminate/support", - "version": "v5.5.17", + "version": "v5.5.28", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "132b06edaab3808f63943004911d58785f164ab4" + "reference": "4db3cc82b483172b1b25d9dfcec684927f5c8cf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/132b06edaab3808f63943004911d58785f164ab4", - "reference": "132b06edaab3808f63943004911d58785f164ab4", + "url": "https://api.github.com/repos/illuminate/support/zipball/4db3cc82b483172b1b25d9dfcec684927f5c8cf9", + "reference": "4db3cc82b483172b1b25d9dfcec684927f5c8cf9", "shasum": "" }, "require": { @@ -871,7 +870,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2017-10-17T12:18:29+00:00" + "time": "2017-12-24T20:02:59+00:00" }, { "name": "nesbot/carbon", @@ -1989,16 +1988,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.5.4", + "version": "6.5.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b2f933d5775f9237369deaa2d2bfbf9d652be4c" + "reference": "83d27937a310f2984fd575686138597147bdc7df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b2f933d5775f9237369deaa2d2bfbf9d652be4c", - "reference": "1b2f933d5775f9237369deaa2d2bfbf9d652be4c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df", + "reference": "83d27937a310f2984fd575686138597147bdc7df", "shasum": "" }, "require": { @@ -2069,7 +2068,7 @@ "testing", "xunit" ], - "time": "2017-12-10T08:06:19+00:00" + "time": "2017-12-17T06:31:19+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -2177,16 +2176,16 @@ }, { "name": "sebastian/comparator", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158" + "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b11c729f95109b56a0fe9650c6a63a0fcd8c439f", + "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f", "shasum": "" }, "require": { @@ -2237,7 +2236,7 @@ "compare", "equality" ], - "time": "2017-11-03T07:16:52+00:00" + "time": "2017-12-22T14:50:35+00:00" }, { "name": "sebastian/diff", diff --git a/src/Colour.php b/src/Colour.php index dfaa25eb..99a0edf0 100644 --- a/src/Colour.php +++ b/src/Colour.php @@ -81,7 +81,6 @@ class Colour $this->rawValue &= ~0xFF; $this->rawValue |= $value; break; - } } diff --git a/src/IO/File.php b/src/IO/File.php index e92beb2c..d5511a92 100644 --- a/src/IO/File.php +++ b/src/IO/File.php @@ -18,7 +18,7 @@ class File /** * Open + Write flag. */ - public const OPEN_WRITE = 'xb'; + public const OPEN_WRITE = 'cb'; /** * Open + Read + Write flag. @@ -38,12 +38,12 @@ class File /** * Open + Write flag. */ - public const OPEN_CREATE_WRITE = 'cb'; + public const OPEN_CREATE_WRITE = 'xb'; /** * Open or Create + Read + Write flag. */ - public const OPEN_CREATE_READ_WRITE = 'cb+'; + public const OPEN_CREATE_READ_WRITE = 'xb+'; /** * Resource/stream container. @@ -318,6 +318,7 @@ class File } $this->updateMetaData(); + $this->updatePosition(); } /** diff --git a/src/Net/CIDR.php b/src/Net/CIDR.php index b08a3bc8..5f25cc73 100644 --- a/src/Net/CIDR.php +++ b/src/Net/CIDR.php @@ -14,7 +14,7 @@ class CIDR * @param string $range * @return bool */ - public static function match($ip, $range) + public static function match(string $ip, string $range): bool { [$net, $mask] = explode('/', $range); @@ -44,7 +44,7 @@ class CIDR * @param int $mask * @return bool */ - private static function matchV4($ip, $net, $mask) + private static function matchV4(string $ip, string $net, int $mask): bool { $ip = ip2long($ip); $net = ip2long($net); @@ -59,7 +59,7 @@ class CIDR * @param int $mask * @return bool */ - private static function matchV6($ip, $net, $mask) + private static function matchV6(string $ip, string $net, int $mask): bool { $ip = inet_pton($ip); $net = inet_pton($net); @@ -70,11 +70,11 @@ class CIDR /** * Converts an IPv6 mask to bytes. * @param int $mask - * @return int + * @return string */ - private static function createV6Mask($mask) + private static function createV6Mask(int $mask): string { - $range = str_repeat("f", $mask / 4); + $range = str_repeat('f', $mask / 4); switch ($mask % 4) { case 1: diff --git a/src/Net/IP.php b/src/Net/IP.php index b90971e6..65977000 100644 --- a/src/Net/IP.php +++ b/src/Net/IP.php @@ -48,7 +48,7 @@ class IP * @throws NetInvalidAddressException * @return string */ - public static function unpack($ip) + public static function unpack(string $ip): string { $ipv = static::version($ip); @@ -69,7 +69,7 @@ class IP * @throws NetAddressTypeException * @return string */ - public static function pack($bin) + public static function pack(string $bin): string { $len = strlen($bin); diff --git a/src/TemplateEngine.php b/src/TemplateEngine.php index 5a3d9bab..cbbd51b5 100644 --- a/src/TemplateEngine.php +++ b/src/TemplateEngine.php @@ -184,7 +184,7 @@ class TemplateEngine * @param string $name * @param Callable $callable */ - public function addFunction(string $name, Callable $callable = null): void + public function addFunction(string $name, callable $callable = null): void { $this->twig->addFunction(new Twig_SimpleFunction($name, $callable === null ? $name : $callable)); } @@ -194,7 +194,7 @@ class TemplateEngine * @param string $name * @param Callable $callable */ - public function addFilter(string $name, Callable $callable = null): void + public function addFilter(string $name, callable $callable = null): void { $this->twig->addFilter(new Twig_SimpleFilter($name, $callable === null ? $name : $callable)); } @@ -204,7 +204,7 @@ class TemplateEngine * @param string $path * @return string */ - public function findNamespace(string $path): string + public function findNamespace(string $path): ?string { foreach ($this->loader->getNamespaces() as $namespace) { if ($this->exists($path, $namespace)) { diff --git a/src/Zalgo.php b/src/Zalgo.php index d22cb497..7604a4b5 100644 --- a/src/Zalgo.php +++ b/src/Zalgo.php @@ -76,8 +76,11 @@ class Zalgo return $string; } - public static function run(string $text, int $mode = self::ZALGO_MODE_MINI, int $direction = self::ZALGO_DIR_MID | self::ZALGO_DIR_DOWN): string - { + public static function run( + string $text, + int $mode = self::ZALGO_MODE_MINI, + int $direction = self::ZALGO_DIR_MID | self::ZALGO_DIR_DOWN + ): string { $text_length = strlen($text); if (!$text_length || !$mode || !$direction || !in_array($mode, self::ZALGO_MODES)) { @@ -104,24 +107,24 @@ class Zalgo $str .= $char; switch ($mode) { - case self::ZALGO_MODE_MINI: - $num_up = mt_rand(0, 8); - $num_mid = mt_rand(0, 2); - $num_down = mt_rand(0, 8); - break; + case self::ZALGO_MODE_MINI: + $num_up = mt_rand(0, 8); + $num_mid = mt_rand(0, 2); + $num_down = mt_rand(0, 8); + break; - case self::ZALGO_MODE_NORMAL: - $num_up = mt_rand(0, 16) / 2 + 1; - $num_mid = mt_rand(0, 6) / 2; - $num_down = mt_rand(0, 8) / 2 + 1; - break; + case self::ZALGO_MODE_NORMAL: + $num_up = mt_rand(0, 16) / 2 + 1; + $num_mid = mt_rand(0, 6) / 2; + $num_down = mt_rand(0, 8) / 2 + 1; + break; - case self::ZALGO_MODE_MAX: - $num_up = mt_rand(0, 64) / 4 + 3; - $num_mid = mt_rand(0, 16) / 4 + 1; - $num_down = mt_rand(0, 64) / 4 + 3; - break; - } + case self::ZALGO_MODE_MAX: + $num_up = mt_rand(0, 64) / 4 + 3; + $num_mid = mt_rand(0, 16) / 4 + 1; + $num_down = mt_rand(0, 64) / 4 + 3; + break; + } if ($going_up) { $str .= self::getZalgo(self::ZALGO_CHARS_UP, $num_up); diff --git a/tests/CIDRTest.php b/tests/CIDRTest.php new file mode 100644 index 00000000..303fe23e --- /dev/null +++ b/tests/CIDRTest.php @@ -0,0 +1,23 @@ +assertTrue(CIDR::match('104.27.135.189', '104.16.0.0/12')); + $this->assertTrue(CIDR::match('104.27.154.200', '104.16.0.0/12')); + $this->assertTrue(CIDR::match('104.28.9.4', '104.16.0.0/12')); + } + + public function testIPv6() + { + $this->assertTrue(CIDR::match('2400:cb00:2048:1:0:0:681b:9ac8', '2400:cb00::/32')); + $this->assertTrue(CIDR::match('2400:cb00:2048:1:0:0:681c:804', '2400:cb00::/32')); + $this->assertTrue(CIDR::match('2400:cb00:2048:1:0:0:681b:86bd', '2400:cb00::/32')); + $this->assertTrue(CIDR::match('2400:cb00:2048:1:0:0:681f:5e2a', '2400:cb00::/32')); + } +} diff --git a/tests/ColourTest.php b/tests/ColourTest.php index 7e262625..38b34e62 100644 --- a/tests/ColourTest.php +++ b/tests/ColourTest.php @@ -1,6 +1,7 @@ assertEquals( + Directory::fixSlashes("test{$wrong_slash}dir{$wrong_slash}with{$wrong_slash}wrong{$wrong_slash}slashes"), + "test{$right_slash}dir{$right_slash}with{$right_slash}wrong{$right_slash}slashes" + ); + } + + public function testExists() + { + $this->assertTrue(Directory::exists(sys_get_temp_dir())); + $this->assertFalse(Directory::exists(WORKING_DIR)); + } + + public function testCreateDir() + { + $directory = Directory::create(WORKING_DIR); + $this->assertInstanceOf(Directory::class, $directory); + } + + public function testCreateFile() + { + $file = new File(WORKING_DIR . '/file', File::CREATE_READ_WRITE); + $this->assertInstanceOf(File::class, $file); + $file->close(); + } + + public function testWriteFile() + { + $file = new File(WORKING_DIR . '/file', File::OPEN_WRITE); + $this->assertInstanceOf(File::class, $file); + + $file->write('misuzu'); + $this->assertEquals(6, $file->size); + + $file->close(); + } + + public function testAppendFile() + { + $file = new File(WORKING_DIR . '/file', File::OPEN_WRITE); + $this->assertInstanceOf(File::class, $file); + + $file->append(' test'); + $this->assertEquals(11, $file->size); + + $file->close(); + } + + public function testPosition() + { + $file = new File(WORKING_DIR . '/file', File::OPEN_READ); + $this->assertInstanceOf(File::class, $file); + + $file->start(); + $this->assertEquals(0, $file->position); + + $file->end(); + $this->assertEquals($file->size, $file->position); + + $file->position(4); + $this->assertEquals(4, $file->position); + + $file->position(4, true); + $this->assertEquals(8, $file->position); + + $file->close(); + } + + public function testRead() + { + $file = new File(WORKING_DIR . '/file', File::OPEN_READ); + $this->assertInstanceOf(File::class, $file); + + $this->assertEquals('misuzu test', $file->read()); + + $file->position(7); + $this->assertEquals('test', $file->read()); + + $file->close(); + } + + public function testFind() + { + $file = new File(WORKING_DIR . '/file', File::OPEN_READ); + $this->assertInstanceOf(File::class, $file); + + $this->assertEquals(7, $file->find('test')); + + $file->close(); + } + + public function testChar() + { + $file = new File(WORKING_DIR . '/file', File::OPEN_READ); + $this->assertInstanceOf(File::class, $file); + + $file->position(3); + $this->assertEquals('s', $file->char()); + + $file->close(); + } + + public function testDirectoryFiles() + { + $dir = new Directory(WORKING_DIR); + $this->assertEquals([realpath(WORKING_DIR . DIRECTORY_SEPARATOR . 'file')], $dir->files()); + } + + public function testDelete() + { + File::delete(WORKING_DIR . '/file'); + $this->assertFalse(File::exists(WORKING_DIR . '/file')); + + Directory::delete(WORKING_DIR); + $this->assertFalse(Directory::exists(WORKING_DIR)); + } +} diff --git a/tests/IPTest.php b/tests/IPTest.php new file mode 100644 index 00000000..9049d3c0 --- /dev/null +++ b/tests/IPTest.php @@ -0,0 +1,77 @@ +assertEquals(IP::version('127.0.0.1'), IP::V4); + $this->assertEquals(IP::version('104.27.135.189'), IP::V4); + $this->assertEquals(IP::version('104.27.154.200'), IP::V4); + $this->assertEquals(IP::version('104.28.9.4'), IP::V4); + + $this->assertEquals(IP::version('::1'), IP::V6); + $this->assertEquals(IP::version('2400:cb00:2048:1:0:0:681b:9ac8'), IP::V6); + $this->assertEquals(IP::version('2400:cb00:2048:1:0:0:681c:804'), IP::V6); + $this->assertEquals(IP::version('2400:cb00:2048:1:0:0:681b:86bd'), IP::V6); + $this->assertEquals(IP::version('2400:cb00:2048:1:0:0:681f:5e2a'), IP::V6); + + $this->assertEquals(IP::version('not an ip address'), 0); + $this->assertEquals(IP::version('256.256.256.256'), 0); + } + + public function testUnpack() + { + $this->assertEquals(IP::unpack('127.0.0.1'), "\x7f\x00\x00\x01"); + $this->assertEquals(IP::unpack('104.27.135.189'), "\x68\x1b\x87\xbd"); + $this->assertEquals(IP::unpack('104.27.154.200'), "\x68\x1b\x9a\xc8"); + $this->assertEquals(IP::unpack('104.28.9.4'), "\x68\x1c\x09\x04"); + + $this->assertEquals(IP::unpack('::1'), "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"); + $this->assertEquals( + IP::unpack('2400:cb00:2048:1:0:0:681b:9ac8'), + "\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1b\x9a\xc8" + ); + $this->assertEquals( + IP::unpack('2400:cb00:2048:1:0:0:681c:804'), + "\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1c\x08\x04" + ); + $this->assertEquals( + IP::unpack('2400:cb00:2048:1:0:0:681b:86bd'), + "\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1b\x86\xbd" + ); + $this->assertEquals( + IP::unpack('2400:cb00:2048:1:0:0:681f:5e2a'), + "\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1f\x5e\x2a" + ); + } + + public function testPack() + { + $this->assertEquals(IP::pack("\x7f\x00\x00\x01"), '127.0.0.1'); + $this->assertEquals(IP::pack("\x68\x1b\x87\xbd"), '104.27.135.189'); + $this->assertEquals(IP::pack("\x68\x1b\x9a\xc8"), '104.27.154.200'); + $this->assertEquals(IP::pack("\x68\x1c\x09\x04"), '104.28.9.4'); + + $this->assertEquals(IP::pack("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"), '::1'); + $this->assertEquals( + IP::pack("\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1b\x9a\xc8"), + '2400:cb00:2048:1::681b:9ac8' + ); + $this->assertEquals( + IP::pack("\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1c\x08\x04"), + '2400:cb00:2048:1::681c:804' + ); + $this->assertEquals( + IP::pack("\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1b\x86\xbd"), + '2400:cb00:2048:1::681b:86bd' + ); + $this->assertEquals( + IP::pack("\x24\x00\xcb\x00\x20\x48\x00\x01\x00\x00\x00\x00\x68\x1f\x5e\x2a"), + '2400:cb00:2048:1::681f:5e2a' + ); + } +} diff --git a/tests/ZalgoTest.php b/tests/ZalgoTest.php new file mode 100644 index 00000000..8e07fd1d --- /dev/null +++ b/tests/ZalgoTest.php @@ -0,0 +1,17 @@ +assertEquals(TEST_STRING, Zalgo::strip(Zalgo::run(TEST_STRING, Zalgo::ZALGO_MODE_MINI))); + $this->assertEquals(TEST_STRING, Zalgo::strip(Zalgo::run(TEST_STRING, Zalgo::ZALGO_MODE_NORMAL))); + $this->assertEquals(TEST_STRING, Zalgo::strip(Zalgo::run(TEST_STRING, Zalgo::ZALGO_MODE_MAX))); + } +} diff --git a/utility.php b/utility.php index b9182b86..26edfde4 100644 --- a/utility.php +++ b/utility.php @@ -1,5 +1,6 @@