You are here

public function ApiKeyConfigurationTest::testKeyStorage in S3 File System 8.2

Test to verify that it is stored successfully.

File

src/Tests/ApiKeyConfigurationTest.php, line 62

Class

ApiKeyConfigurationTest
Tests whether access_key & secret_key is set at the admin configuration page, and whether the access_key & secret_key is stored successfully or not.

Namespace

Drupal\s3fs\Tests

Code

public function testKeyStorage() {
  $this
    ->drupalGet(Url::fromRoute('s3fs.admin_settings'));
  $this
    ->assertResponse(200);
  $access_key = $this
    ->randomString(40);
  $secret_key = $this
    ->randomString(40);
  $edit = [
    'access_key' => $access_key,
    'secret_key' => $secret_key,
    'bucket' => $this
      ->randomString(8),
  ];
  $this
    ->drupalPostForm(Url::fromRoute('s3fs.admin_settings'), $edit, $this
    ->t('Save configuration'));
  $this
    ->assertText($this
    ->t('The configuration options have been saved.'), $this
    ->t('Saved configuration'));
}