You are here

public function LingotekCliServiceTest::testRequestTranslationsAll in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  2. 4.0.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  3. 3.0.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  4. 3.1.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  5. 3.2.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  6. 3.3.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  7. 3.4.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  8. 3.6.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  9. 3.7.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()
  10. 3.8.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testRequestTranslationsAll()

File

tests/src/Unit/Cli/LingotekCliServiceTest.php, line 261

Class

LingotekCliServiceTest
@coversDefaultClass \Drupal\lingotek\Cli\LingotekCliService @group lingotek @preserveGlobalState disabled

Namespace

Drupal\Tests\lingotek\Unit\Cli

Code

public function testRequestTranslationsAll() {
  $entity = $this
    ->createMock(ContentEntityInterface::class);
  $entityStorage = $this
    ->createMock(EntityStorageInterface::class);
  $entityStorage
    ->expects($this
    ->once())
    ->method('load')
    ->with(1)
    ->willReturn($entity);
  $this->entityTypeManager
    ->expects($this
    ->once())
    ->method('hasDefinition')
    ->with('node')
    ->willReturn(TRUE);
  $this->entityTypeManager
    ->expects($this
    ->once())
    ->method('getStorage')
    ->with('node')
    ->willReturn($entityStorage);
  $this->translationService
    ->expects($this
    ->once())
    ->method('requestTranslations')
    ->with($entity)
    ->willReturn([
    'es',
    'ca',
    'de',
  ]);
  $result = $this->cliService
    ->requestTranslations('node', 1, [
    'all',
  ]);
  $this
    ->assertEquals([
    'es' => [
      'langcode' => 'es',
    ],
    'ca' => [
      'langcode' => 'ca',
    ],
    'de' => [
      'langcode' => 'de',
    ],
  ], $result);
}