From 48e423eb81947eb4dad691dc52c7eb23191227fd Mon Sep 17 00:00:00 2001 From: Luis Ball Date: Mon, 3 May 2021 11:24:17 -0400 Subject: [PATCH] test(encoding): test unicode, delims, and res char --- tests/Imgix/Tests/PathEncodingTest.php | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/Imgix/Tests/PathEncodingTest.php diff --git a/tests/Imgix/Tests/PathEncodingTest.php b/tests/Imgix/Tests/PathEncodingTest.php new file mode 100644 index 0000000..47dd075 --- /dev/null +++ b/tests/Imgix/Tests/PathEncodingTest.php @@ -0,0 +1,34 @@ +createURL("/ <>[]{}|\\^%.jpg"); + $this->assertEquals( + "https://sdk-test.imgix.net/%20%3C%3E%5B%5D%7B%7D%7C%5C%5E%25.jpg", + $url); + } + + public function testSpecialCharsEncoding() { + $builder = new UrlBuilder(self::HOST, true, "", false); + $url = $builder->createURL("&$+,:;=?@#.jpg"); + $this->assertEquals( + "https://sdk-test.imgix.net/%26%24%2B%2C:%3B%3D%3F@%23.jpg", + $url); + } + + public function testUnicodeEncoding() { + $builder = new UrlBuilder(self::HOST, true, "", false); + $url = $builder->createURL("/ساندویچ.jpg"); + $this->assertEquals( + "https://sdk-test.imgix.net/%D8%B3%D8%A7%D9%86%D8%AF%D9%88%DB%8C%DA%86.jpg", + $url); + } + + } +?>