public function LingotekUnitTest::testAddTargetPaymentRequired in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.1.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.2.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.3.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.4.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.5.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.6.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.7.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
- 3.8.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testAddTargetPaymentRequired()
@covers ::addTarget
File
- tests/
src/ Unit/ LingotekUnitTest.php, line 1090
Class
- LingotekUnitTest
- @coversDefaultClass \Drupal\lingotek\Lingotek @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\UnitCode
public function testAddTargetPaymentRequired() {
$response = $this
->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
$response
->expects($this
->any())
->method('getStatusCode')
->willReturn(Response::HTTP_PAYMENT_REQUIRED);
$response
->expects($this
->any())
->method('getBody')
->willReturn(json_encode([
'messages' => [
"Community has been disabled. Please contact support@lingotek.com to re-enable your community.",
],
]));
$language = $this
->createMock(ConfigurableLanguageInterface::class);
$language
->expects($this
->any())
->method('getId')
->will($this
->returnValue('es'));
$this->accountConfig
->expects($this
->any())
->method('get')
->will($this
->returnValueMap([
[
'default.workflow',
'default_workflow',
],
]));
$this->languageLocaleMapper
->expects($this
->any())
->method('getConfigurableLanguageForLocale')
->with('es_ES')
->will($this
->returnValue($language));
$this->api
->expects($this
->at(0))
->method('addTranslation')
->with('my_doc_id', 'es_ES', NULL)
->will($this
->returnValue($response));
$this
->expectException(LingotekPaymentRequiredException::class);
$this
->expectExceptionMessage('Community has been disabled. Please contact support@lingotek.com to re-enable your community.');
$this->lingotek
->addTarget('my_doc_id', 'es_ES', NULL);
}