You are here

public function ApiKeyConfigurationTest::testKeyConfiguration in S3 File System 8.2

Test to implement a runtime requirement checking if API key is not set.

File

src/Tests/ApiKeyConfigurationTest.php, line 48

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 testKeyConfiguration() {
  $this
    ->drupalGet(Url::fromRoute('s3fs.admin_settings'));
  $this
    ->assertResponse(200);
  $this
    ->assertFieldByName('access_key', '', 'The Access API key is not set');
  $this
    ->assertFieldByName('secret_key', '', 'The Secret API key is not set');
  $this
    ->drupalGet(Url::fromRoute('system.status'));
  $this
    ->assertText('S3 File System access key or secret key is not set and it is required for some functionalities to work.', 'The content exists on the report page');
  $this
    ->assertLink('S3 File System module settings page', 0, 'Link to the api key configuration page found');
  $this
    ->assertLinkByHref(Url::fromRoute('s3fs.admin_settings')
    ->toString());
}