You are here

protected function ShieldTest::setUp in Shield 8

Overrides BrowserTestBase::setUp

File

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

Class

ShieldTest
Tests Shield module.

Namespace

Drupal\Tests\shield\Functional

Code

protected function setUp() {
  parent::setUp();

  // Do basic setup to prepare shield operating but disable it.
  $this
    ->config('shield.settings')
    ->set('shield_enable', FALSE)
    ->set('credential_provider', 'shield')
    ->set('credentials.shield.user', 'user')
    ->set('credentials.shield.pass', 'password')
    ->set('print', 'Hello world!')
    ->save();

  // Generate a user_password key.
  Key::create([
    'id' => 'shield_test',
    'label' => 'Shield test',
    'key_type' => "user_password",
    'key_type_settings' => [],
    'key_provider' => 'file',
    'key_provider_settings' => [
      'file_location' => drupal_get_path('module', 'shield') . '/tests/files/shield_test.key',
      'strip_line_breaks' => FALSE,
    ],
  ])
    ->save();
}