public function LingotekApiUnitTest::testAddTranslation in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 4.0.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.0.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.1.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.2.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.3.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.4.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.5.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.6.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 3.7.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testAddTranslation()
 - 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 65  
Class
- LingotekApiUnitTest
 - @coversDefaultClass \Drupal\lingotek\Remote\LingotekApi @group lingotek @preserveGlobalState disabled
 
Namespace
Drupal\Tests\lingotek\Unit\RemoteCode
public function testAddTranslation() {
  // Ensure that the workflow is set when it's need to be.
  $response = $this
    ->getMockBuilder('\\Psr\\Http\\Message\\ResponseInterface')
    ->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->lingotek_api
    ->addTranslation('fancy-document-id', 'es_ES', 'my_workflow');
  $this->lingotek_api
    ->addTranslation('fancy-document-id', 'es_ES', NULL);
}