![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/demo.cartinsight.co/vendor/intervention/httpauth/tests/Token/ |
<?php namespace Intervention\HttpAuth\Test\Token; use Intervention\HttpAuth\Exception\AuthentificationException; use Intervention\HttpAuth\Key; use Intervention\HttpAuth\Token\HttpAuthorization; use PHPUnit\Framework\TestCase; class HttpAuthorizationTest extends AbstractTokenTestCase { public function testParseFail() { $this->expectException(AuthentificationException::class); $auth = new HttpAuthorization(); } public function testParse() { $auth = $this->getTestToken(); $this->assertInstanceOf(HttpAuthorization::class, $auth); } public function testToKey() { $key = $this->getTestToken()->toKey(); $this->assertInstanceOf(Key::class, $key); $this->assertEquals('test', $key->getRealm()); $this->assertEquals('auth', $key->getQop()); $this->assertEquals('xxxxxxxxxxxxx', $key->getNonce()); $this->assertEquals('yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', $key->getOpaque()); } private function getTestToken() { $this->setServerVars([ 'HTTP_AUTHORIZATION' => 'Digest realm="test",qop="auth",nonce="xxxxxxxxxxxxx",opaque="yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"' ]); return new HttpAuthorization(); } }