You are here

public function ReadOnlyConfigTest::testSingleImport in Configuration Read-only mode 8

Tests switching the config single import form to read-only.

File

tests/src/Functional/ReadOnlyConfigTest.php, line 150

Class

ReadOnlyConfigTest
Tests read-only module config functionality.

Namespace

Drupal\Tests\config_readonly\Functional

Code

public function testSingleImport() {

  // Verify if we can successfully access the single import route.
  $import_url = Url::fromRoute('config.import_single');
  $this
    ->drupalGet($import_url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // The single import form is not read-only.
  $this
    ->assertSession()
    ->pageTextNotContains($this->message);

  // Switch forms to read-only.
  $this
    ->turnOnReadOnlySetting();
  $this
    ->drupalGet($import_url);

  // The single import form is read-only.
  $this
    ->assertSession()
    ->pageTextContains($this->message);
}