You are here

public function ConfigNamesMapperTest::testHasSchema in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigNamesMapperTest::testHasSchema()

Tests ConfigNamesMapper::hasSchema().

@dataProvider providerTestHasSchema

Parameters

array $mock_return_values: An array of values that the mocked locale configuration manager should return for hasConfigSchema().

bool $expected: The expected return value of ConfigNamesMapper::hasSchema().

File

core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php, line 497
Contains \Drupal\Tests\config_translation\Unit\ConfigNamesMapperTest.

Class

ConfigNamesMapperTest
Tests the functionality provided by the configuration names mapper.

Namespace

Drupal\Tests\config_translation\Unit

Code

public function testHasSchema(array $mock_return_values, $expected) {

  // As the configuration names are arbitrary, simply use integers.
  $config_names = range(1, count($mock_return_values));
  $this->configNamesMapper
    ->setConfigNames($config_names);
  $map = [];
  foreach ($config_names as $i => $config_name) {
    $map[] = [
      $config_name,
      $mock_return_values[$i],
    ];
  }
  $this->typedConfigManager
    ->expects($this
    ->any())
    ->method('hasConfigSchema')
    ->will($this
    ->returnValueMap($map));
  $result = $this->configNamesMapper
    ->hasSchema();
  $this
    ->assertSame($expected, $result);
}