]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/http/UrlUtils/GetUrlSchemeTest.php
namespacing: move HTTP utilities along \Shaarli\Http\ classes
[github/shaarli/Shaarli.git] / tests / http / UrlUtils / GetUrlSchemeTest.php
diff --git a/tests/http/UrlUtils/GetUrlSchemeTest.php b/tests/http/UrlUtils/GetUrlSchemeTest.php
new file mode 100644 (file)
index 0000000..2b97f7b
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Unitary tests for get_url_scheme()
+ */
+
+namespace Shaarli\Http;
+
+require_once 'application/http/UrlUtils.php';
+
+class GetUrlSchemeTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * Get empty scheme string for empty UrlUtils
+     */
+    public function testGetUrlSchemeEmpty()
+    {
+        $this->assertEquals('', get_url_scheme(''));
+    }
+
+    /**
+     * Get normal scheme of UrlUtils
+     */
+    public function testGetUrlScheme()
+    {
+        $this->assertEquals('http', get_url_scheme('http://domain.tld:3000'));
+        $this->assertEquals('https', get_url_scheme('https://domain.tld:3000'));
+        $this->assertEquals('http', get_url_scheme('domain.tld'));
+        $this->assertEquals('ssh', get_url_scheme('ssh://domain.tld'));
+        $this->assertEquals('ftp', get_url_scheme('ftp://domain.tld'));
+        $this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout'));
+    }
+}