コード例 #1
0
 /**
  * Tests ConfigNamesMapper::hasTranslation().
  *
  * @param array $mock_return_values
  *   An array of values that the mocked configuration mapper manager should
  *   return for hasTranslation().
  * @param bool $expected
  *   The expected return value of ConfigNamesMapper::hasTranslation().
  *
  * @dataProvider providerTestHasTranslation
  */
 public function testHasTranslation(array $mock_return_values, $expected)
 {
     $language = new Language();
     // As the configuration names are arbitrary, simply use integers.
     $config_names = range(1, count($mock_return_values));
     $this->configNamesMapper->setConfigNames($config_names);
     $map = array();
     foreach ($config_names as $i => $config_name) {
         $map[] = array($config_name, $language->getId(), $mock_return_values[$i]);
     }
     $this->localeConfigManager->expects($this->any())->method('hasTranslation')->will($this->returnValueMap($map));
     $result = $this->configNamesMapper->hasTranslation($language);
     $this->assertSame($expected, $result);
 }