$container =
new ContainerBuilder();
$container->
set('string_translation',
$this->
getStringTranslationStub());
\Drupal::
setContainer($container);
} /**
* @covers ::getOptionsList
* @covers ::getOptionsListByRegion
*/
public function testGetList(): void
{ // Test the default parameters for getOptionsList().
$result = TimeZoneFormHelper::
getOptionsList();
$this->
assertIsArray($result);
$this->
assertArrayHasKey('Africa/Dar_es_Salaam',
$result);
$this->
assertEquals('Africa/Dar es Salaam',
$result['Africa/Dar_es_Salaam'
]);
// Test that the ungrouped and grouped results have the same number of
// items.
$ungrouped_count =
count(TimeZoneFormHelper::
getOptionsList());
$grouped_result = TimeZoneFormHelper::
getOptionsListByRegion();
$grouped_count = 0;
array_walk_recursive($grouped_result,
function D
) use (&
$grouped_count) { $grouped_count++;
});