You are here

public function ManagerTest::testGetFlags in Message Subscribe 8

Tests the flag retrieval.

@covers ::getFlags

@dataProvider providerTestGetFlags

Parameters

array $expected: The expected flags.

array $flags: The available flags for the flag service.

File

message_subscribe_email/tests/src/Unit/ManagerTest.php, line 33

Class

ManagerTest
Unit tests for the message subscribe email manager utility class.

Namespace

Drupal\Tests\message_subscribe_email\Unit

Code

public function testGetFlags(array $expected, array $flags) {
  $flag_service = $this
    ->prophesize(FlagServiceInterface::class);
  $flag_service
    ->getAllFlags()
    ->willReturn($flags);
  $config = $this
    ->prophesize(ImmutableConfig::class);
  $config
    ->get('flag_prefix')
    ->willReturn('non_standard_prefix');
  $config_factory = $this
    ->prophesize(ConfigFactoryInterface::class);
  $config_factory
    ->get('message_subscribe_email.settings')
    ->willReturn($config
    ->reveal());
  $manager = new Manager($flag_service
    ->reveal(), $config_factory
    ->reveal());
  $this
    ->assertEquals($expected, $manager
    ->getFlags());
}