summaryrefslogtreecommitdiffstats
path: root/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php')
-rw-r--r--admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php b/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php
new file mode 100644
index 0000000..88230d5
--- /dev/null
+++ b/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php
@@ -0,0 +1,49 @@
+<?php
+
+use Intervention\Httpauth\Httpauth;
+
+class HttpauthTest extends PHPUnit_Framework_TestCase
+{
+ private function createTestHttpauth()
+ {
+ $config = array(
+ 'realm' => 'test_realm',
+ 'username' => 'test_user',
+ 'password' => 'test_password'
+ );
+
+ $httpauth = new Httpauth($config);
+ return $httpauth;
+ }
+
+ public function testConstruction()
+ {
+ $httpauth = $this->createTestHttpauth();
+ $this->assertInstanceOf('\Intervention\Httpauth\Httpauth', $httpauth);
+ $this->assertEquals('test_realm', $httpauth->realm);
+ $this->assertTrue($httpauth->isValid('test_user', 'test_password'));
+ }
+
+ public function testStaticCall()
+ {
+ $config = array(
+ 'realm' => '1',
+ 'username' => '2',
+ 'password' => '3'
+ );
+
+ $httpauth = Httpauth::make($config);
+
+ $this->assertInstanceOf('\Intervention\Httpauth\Httpauth', $httpauth);
+ $this->assertEquals('1', $httpauth->realm);
+ $this->assertTrue($httpauth->isValid($config['username'], $config['password']));
+ }
+
+ /**
+ * @expectedException Exception
+ */
+ public function testConstructorWithoutUserPassword()
+ {
+ $httpauth = new Httpauth;
+ }
+}