You are here

public function ShieldTest::testShieldEnable in Shield 8

Validate shield_enable config display or not the http auth prompt.

Throws

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/ShieldTest.php, line 57

Class

ShieldTest
Tests Shield module.

Namespace

Drupal\Tests\shield\Functional

Code

public function testShieldEnable() {

  // Assert we are not presented with a http auth prompt.
  $this
    ->drupalGet('user');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Configure shield so it is enabled.
  $this
    ->config('shield.settings')
    ->set('shield_enable', TRUE)
    ->save();

  // Assert we are presented with a http auth prompt.
  $this
    ->drupalGet('user');
  $this
    ->assertSession()
    ->statusCodeEquals(401);
}