diff options
Diffstat (limited to 'admin/survey/minify/vendor/intervention/httpauth/tests')
4 files changed, 91 insertions, 0 deletions
diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/.gitkeep b/admin/survey/minify/vendor/intervention/httpauth/tests/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/.gitkeep diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/BasicUserTest.php b/admin/survey/minify/vendor/intervention/httpauth/tests/BasicUserTest.php new file mode 100644 index 0000000..837a70e --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/BasicUserTest.php @@ -0,0 +1,30 @@ +<?php
+
+use Intervention\Httpauth\BasicUser;
+
+class BasicUserTest extends PHPUnit_Framework_TestCase
+{
+ public function testBasicUserAuthMod()
+ {
+ $_SERVER['PHP_AUTH_USER'] = 'test_user';
+ $_SERVER['PHP_AUTH_PW'] = 'test_password';
+
+ $user = new BasicUser;
+ $this->assertTrue($user->isValid('test_user', 'test_password'));
+ }
+
+ public function testUserAuth()
+ {
+ $userdata = array('test_user', 'test_password');
+ $userdata = implode(':', $userdata);
+ $userdata = base64_encode($userdata);
+ $userdata = 'basic_'.$userdata;
+
+ unset($_SERVER['PHP_AUTH_USER']);
+ unset($_SERVER['PHP_AUTH_PW']);
+ $_SERVER['HTTP_AUTHENTICATION'] = $userdata;
+
+ $user = new BasicUser;
+ $this->assertTrue($user->isValid('test_user', 'test_password'));
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/DigestUserTest.php b/admin/survey/minify/vendor/intervention/httpauth/tests/DigestUserTest.php new file mode 100644 index 0000000..7427794 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/DigestUserTest.php @@ -0,0 +1,12 @@ +<?php
+
+use Intervention\Httpauth\DigestUser;
+
+class DigestUserTest extends PHPUnit_Framework_TestCase
+{
+ public function testDigestUserCreation()
+ {
+ $user = new DigestUser;
+ $this->assertInstanceOf('\Intervention\Httpauth\DigestUser', $user);
+ }
+}
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;
+ }
+}
|