public function test__construct() { $realm = '*****@*****.**'; $user = '******'; $nonce = 'dcd98b7102dd2f0e8b11d0f600bfb0c093'; $uri = '/dir/index.html'; $cnonce = '0a4f113b'; $response = '6629fae49393a05397450978507c4ef1'; $opaque = '5ccc069c403ebaf9f0171e9517f40e41'; $password = '******'; $sDigest = <<<START \t\t\tusername="******", \t\t\trealm="{$realm}", \t\t\tnonce="{$nonce}", \t\t\turi="{$uri}", \t\t\tqop=auth, \t\t\tnc=00000001, \t\t\tcnonce="{$cnonce}", \t\t\tresponse="{$response}", \t\t\topaque="{$opaque}" START; $o = new DigestHttpAuthentication($sDigest); $this->assertEquals($user, $o->getUser()); $this->assertNull($o->getPassword()); // this method should be removed }
public function test__ExampleFromRFC() { $realm = '*****@*****.**'; $user = '******'; $nonce = 'dcd98b7102dd2f0e8b11d0f600bfb0c093'; $uri = '/dir/index.html'; $cnonce = '0a4f113b'; $response = '6629fae49393a05397450978507c4ef1'; $opaque = '5ccc069c403ebaf9f0171e9517f40e41'; $password = '******'; $sDigest = <<<START \t\t\tusername="******", \t\t\trealm="{$realm}", \t\t\tnonce="{$nonce}", \t\t\turi="{$uri}", \t\t\tqop=auth, \t\t\tnc=00000001, \t\t\tcnonce="{$cnonce}", \t\t\tresponse="{$response}", \t\t\topaque="{$opaque}" START; $o = new DigestHttpAuthentication($sDigest, HttpRequestTypes::GET); $this->assertEquals($user, $o->getUser()); $this->assertTrue($o->validateDigestAuthentication($password, $realm)); }