You are here

public function ImportEntityManagerTest::testVerifyLanguageSupportability in Acquia Content Hub 8

Verifies Language Supportabilitites.

@covers ::verifyLanguageSupportability

Throws

\Exception

File

tests/src/Unit/ImportEntityManagerTest.php, line 981

Class

ImportEntityManagerTest
PHPUnit test for the ImportEntityManager class.

Namespace

Drupal\Tests\acquia_contenthub\Unit

Code

public function testVerifyLanguageSupportability() {

  // Content entity with languages: 'en', 'es'.
  $contenthub_entity = $this
    ->createMultilanguageContentHubEntity();
  $contenthub_entity_dependency = new ContentHubEntityDependency($contenthub_entity);

  // Site languages are different than entity languages.
  $this->languageManager
    ->expects($this
    ->at(0))
    ->method('getLanguages')
    ->willReturn([
    'jp' => 'jp',
    'ru' => 'ru',
  ]);

  // Site languages include at least one of entity languages.
  $this->languageManager
    ->expects($this
    ->at(1))
    ->method('getLanguages')
    ->willReturn([
    'es' => 'es',
    'ru' => 'ru',
  ]);
  $verify = $this->importEntityManager
    ->verifyLanguageSupportability($contenthub_entity_dependency);
  $this
    ->assertFalse($verify);
  $verify = $this->importEntityManager
    ->verifyLanguageSupportability($contenthub_entity_dependency);
  $this
    ->assertTrue($verify);
}