You are here

protected function ContentEntityNormalizerTest::createMockLanguageList in Acquia Content Hub 8

Creates a mock language list.

Return value

\Drupal\Core\Language\LanguageInterface[]|\PHPUnit_Framework_MockObject_MockObject The mocked Languages.

1 call to ContentEntityNormalizerTest::createMockLanguageList()
ContentEntityNormalizerTest::createMockForContentEntity in tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
Creates a mock content entity.

File

tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php, line 1095

Class

ContentEntityNormalizerTest
PHPUnit test for the ContentEntityNormalizer class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Normalizer

Code

protected function createMockLanguageList($languages = [
  'en',
]) {
  $language_objects = [];
  foreach ($languages as $language) {
    $mock = $this
      ->createMock('Drupal\\Core\\Language\\LanguageInterface');
    $mock
      ->method('getId')
      ->willReturn($language);
    $language_objects[$language] = $mock;
  }
  return $language_objects;
}