You are here

public function RuntimeTest::testReadOnlyMode in Acquia Search 3.x

Tests shouldEnforceReadOnlyMode.

@covers \Drupal\acquia_search\Helper\Runtime::shouldEnforceReadOnlyMode

File

tests/src/Unit/Helper/RuntimeTest.php, line 154

Class

RuntimeTest
@coversDefaultClass \Drupal\acquia_search\Helper\Runtime @group Acquia Search Solr

Namespace

Drupal\Tests\acquia_search\Unit\Helper

Code

public function testReadOnlyMode() {
  $storage = new Storage();
  $storage
    ->setIdentifier('ABC-12345');
  $this->config
    ->get('read_only')
    ->willReturn(TRUE);
  $this->config
    ->reveal();
  $this->moduleHandler
    ->alter('acquia_search_should_enforce_read_only', Argument::exact(TRUE))
    ->shouldBeCalledOnce();
  $this->moduleHandler
    ->reveal();
  $this
    ->assertTrue(Runtime::shouldEnforceReadOnlyMode());
  $this->config
    ->get('read_only')
    ->willReturn(FALSE);
  $this->config
    ->reveal();
  $this->moduleHandler
    ->alter('acquia_search_should_enforce_read_only', Argument::exact(FALSE))
    ->shouldBeCalledOnce();
  $this->moduleHandler
    ->reveal();
  $this
    ->assertFalse(Runtime::shouldEnforceReadOnlyMode());
}