SecureSiteBasicNoneTest.php in Secure Site 8
File
src/Tests/BasicAuth/SecureSiteBasicNoneTest.php
View source
<?php
namespace Drupal\securesite\Tests\BasicAuth;
use Drupal\simpletest\WebTestBase;
class SecureSiteBasicNoneTest extends WebTestBase {
public static $modules = array(
'securesite',
);
public static function getInfo() {
return array(
'name' => t('Basic authentication: No credentials'),
'description' => t('Test HTTP basic authentication without credentials.'),
'group' => t('Secure Site'),
);
}
function setUp() {
parent::setUp();
\Drupal::config('securesite.settings')
->set('securesite_enabled', SECURESITE_ALWAYS);
}
function testSecureSiteTypeBasicNone() {
$this
->drupalHead(NULL);
$this
->assertResponse(401, t('Requesting home page.'));
$found_scheme = FALSE;
if (stripos($this
->drupalGetHeader('WWW-Authenticate'), 'Basic') === 0) {
$found_scheme = TRUE;
}
$this
->assertTrue($found_scheme, t('Checking for basic authentication scheme.'));
}
}