public function LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage in Lingotek Translation 8.2
Same name and namespace in other branches
- 4.0.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.0.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.1.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.2.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.3.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.4.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.5.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.6.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.7.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
- 3.8.x tests/src/Unit/Cli/LingotekCliServiceTest.php \Drupal\Tests\lingotek\Unit\Cli\LingotekCliServiceTest::testCheckTranslationsStatusesUnexistingLanguage()
File
- tests/
src/ Unit/ Cli/ LingotekCliServiceTest.php, line 518
Class
- LingotekCliServiceTest
- @coversDefaultClass \Drupal\lingotek\Cli\LingotekCliService @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\Unit\CliCode
public function testCheckTranslationsStatusesUnexistingLanguage() {
/** @var \Drupal\Core\Language\LanguageInterface|\PHPUnit_Framework_MockObject_MockObject $language */
$language = $this
->createMock(LanguageInterface::class);
$language
->expects($this
->once())
->method('getId')
->willReturn('en');
/** @var \Drupal\Core\Entity\EntityInterface|\PHPUnit_Framework_MockObject_MockObject $entity */
$entity = $this
->createMock(ContentEntityInterface::class);
$entity
->expects($this
->once())
->method('getUntranslated')
->willReturnSelf();
$entity
->expects($this
->once())
->method('language')
->willReturn($language);
$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
->at(0))
->method('checkTargetStatuses')
->with($entity);
$this->translationService
->expects($this
->at(1))
->method('getTargetStatuses')
->with($entity)
->willReturn([
'en' => 'CURRENT',
'es' => 'READY',
'ca' => 'PENDING',
'de' => 'ERROR',
]);
$result = $this->cliService
->checkTranslationsStatuses('node', 1, [
'es',
'hu',
]);
$this
->assertEquals([
'es' => [
'langcode' => 'es',
'status' => 'READY',
],
], $result);
}