public function RenderElementTypesTest::testLingotekSourceStatus in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 4.0.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.1.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.2.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.3.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.4.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.5.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.6.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.7.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
- 3.8.x tests/src/Functional/Render/Element/RenderElementTypesTest.php \Drupal\Tests\lingotek\Functional\Render\Element\RenderElementTypesTest::testLingotekSourceStatus()
Tests #type 'lingotek_source_status'.
File
- tests/
src/ Functional/ Render/ Element/ RenderElementTypesTest.php, line 61
Class
- RenderElementTypesTest
- Tests the markup of lingotek render element types passed to \Drupal::service('renderer')->render().
Namespace
Drupal\Tests\lingotek\Functional\Render\ElementCode
public function testLingotekSourceStatus() {
$basepath = \Drupal::request()
->getBasePath();
/** @var \Drupal\node\NodeInterface $entity */
$entity = Node::create([
'id' => 1,
'title' => 'Llamas are cool',
'type' => 'article',
]);
$entity
->save();
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_UNTRACKED);
$this
->drupalGet('/lingotek_form_test/lingotek_source_status/node/1');
$this
->assertSession()
->responseContains('lingotek/css/base.css');
$this
->assertSession()
->responseContains('<span class="language-icon source-untracked" title="Upload"><a href="' . $basepath . '/admin/lingotek/entity/upload/node/1?destination=' . $basepath . '/lingotek_form_test/lingotek_source_status/node/1">EN</a></span>');
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_IMPORTING);
$translation_service
->setDocumentId($entity, 'test-document-id');
$this
->drupalGet('/lingotek_form_test/lingotek_source_status/node/1');
$this
->assertSession()
->responseContains('lingotek/css/base.css');
$this
->assertSession()
->responseContains('<span class="language-icon source-importing" title="Source importing"><a href="' . $basepath . '/admin/lingotek/entity/check_upload/test-document-id?destination=' . $basepath . '/lingotek_form_test/lingotek_source_status/node/1">EN</a></span>');
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_CURRENT);
$this
->drupalGet('/lingotek_form_test/lingotek_source_status/node/1');
$this
->assertSession()
->responseContains('lingotek/css/base.css');
$this
->assertSession()
->responseContains('<span class="language-icon source-current" title="Source uploaded">EN</span>');
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_DISABLED);
$this
->drupalGet('/lingotek_form_test/lingotek_source_status/node/1');
$this
->assertSession()
->responseContains('lingotek/css/base.css');
$this
->assertSession()
->responseContains('<span class="language-icon source-disabled" title="Disabled, cannot request translation">EN</span>');
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_EDITED);
$this
->drupalGet('/lingotek_form_test/lingotek_source_status/node/1');
$this
->assertSession()
->responseContains('lingotek/css/base.css');
$this
->assertSession()
->responseContains('<span class="language-icon source-edited" title="Re-upload (content has changed since last upload)"><a href="' . $basepath . '/admin/lingotek/entity/update/test-document-id?destination=' . $basepath . '/lingotek_form_test/lingotek_source_status/node/1">EN</a></span>');
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_ERROR);
$this
->drupalGet('/lingotek_form_test/lingotek_source_status/node/1');
$this
->assertSession()
->responseContains('lingotek/css/base.css');
$this
->assertSession()
->responseContains('<span class="language-icon source-error" title="Error"><a href="' . $basepath . '/admin/lingotek/entity/update/test-document-id?destination=' . $basepath . '/lingotek_form_test/lingotek_source_status/node/1">EN</a></span>');
}