You are here

public function LingotekApiUnitTest::testAddTranslation in Lingotek Translation 3.4.x

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

@covers ::addTranslation

File

tests/src/Unit/Remote/LingotekApiUnitTest.php, line 46

Class

LingotekApiUnitTest
@coversDefaultClass \Drupal\lingotek\Remote\LingotekApi @group lingotek @preserveGlobalState disabled

Namespace

Drupal\Tests\lingotek\Unit\Remote

Code

public function testAddTranslation() {

  // Ensure that the workflow is set when it's need to be.
  $response = $this
    ->getMockBuilder(ResponseInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->client
    ->expects($this
    ->at(0))
    ->method('post')
    ->with('/api/document/fancy-document-id/translation', [
    'locale_code' => 'es_ES',
    'workflow_id' => 'my_workflow',
  ])
    ->will($this
    ->returnValue($response));
  $this->client
    ->expects($this
    ->at(1))
    ->method('post')
    ->with('/api/document/fancy-document-id/translation', [
    'locale_code' => 'es_ES',
  ])
    ->will($this
    ->returnValue($response));
  $this->client
    ->expects($this
    ->at(2))
    ->method('post')
    ->with('/api/document/fancy-document-id/translation', [
    'locale_code' => 'es_ES',
    'workflow_id' => 'my_workflow',
    'vault_id' => 'my_vault',
  ])
    ->will($this
    ->returnValue($response));
  $this->lingotek_api
    ->addTranslation('fancy-document-id', 'es_ES', 'my_workflow');
  $this->lingotek_api
    ->addTranslation('fancy-document-id', 'es_ES', NULL);
  $this->lingotek_api
    ->addTranslation('fancy-document-id', 'es_ES', 'my_workflow', 'my_vault');
}