You are here

public function TfaContextTest::testIsModuleSetup in Two-factor Authentication (TFA) 8

@covers ::isModuleSetup

File

tests/src/Unit/TfaContextTest.php, line 121

Class

TfaContextTest
@coversDefaultClass \Drupal\tfa\TfaContext

Namespace

Drupal\Tests\tfa\Unit

Code

public function testIsModuleSetup() {

  // Defaults to false with empty mocked services.
  $fixture = $this
    ->getFixture();
  $this
    ->assertFalse($fixture
    ->isModuleSetup());

  // Enable.
  $settings = $this
    ->prophesize(ImmutableConfig::class);
  $settings
    ->get('enabled')
    ->willReturn(TRUE);
  $settings
    ->get('default_validation_plugin')
    ->willReturn('foo');
  $config_factory = $this
    ->prophesize(ConfigFactoryInterface::class);
  $config_factory
    ->get('tfa.settings')
    ->willReturn($settings
    ->reveal());
  $this->configFactory = $config_factory
    ->reveal();
  $fixture = $this
    ->getFixture();
  $this
    ->assertTrue($fixture
    ->isModuleSetup());
}