You are here

function SecureSiteScriptDigestMD5UnitTest::testSecureSiteScriptDigestMD5Wrong in Secure Site 6.2

Same name and namespace in other branches
  1. 7.2 securesite.test \SecureSiteScriptDigestMD5UnitTest::testSecureSiteScriptDigestMD5Wrong()

Check response to wrong password.

File

./securesite.test, line 301
Tests for Secure Site module.

Class

SecureSiteScriptDigestMD5UnitTest
Unit tests for digest_md5.php.

Code

function testSecureSiteScriptDigestMD5Wrong() {
  $ha1 = md5($this->user->name . ':' . $this->challenge['realm'] . ':' . $this->user->pass);
  $response = md5($ha1 . ':' . $this->challenge['nonce'] . ':' . md5('GET:/'));
  $this->data[] = 'nonce="' . $this->challenge['nonce'] . '"';
  $this->data[] = 'response="' . $response . '"';
  $command = $this->digest_md5 . ' data=' . escapeshellarg(implode(', ', $this->data)) . ' method=GET';
  $authentication = _securesite_parse_directives(exec($command, $output, $status));
  $this
    ->assertTrue($status == 3 && isset($authentication['realm']) && isset($authentication['nonce']), t('Checking response to wrong password.'));
}