You are here

public function LingotekViewsFunctionalTests::testNodeWithMetadataView in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  2. 4.0.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  3. 3.0.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  4. 3.1.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  5. 3.3.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  6. 3.4.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  7. 3.5.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  8. 3.6.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  9. 3.7.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()
  10. 3.8.x tests/src/Functional/LingotekViewsFunctionalTests.php \Drupal\Tests\lingotek\Functional\LingotekViewsFunctionalTests::testNodeWithMetadataView()

File

tests/src/Functional/LingotekViewsFunctionalTests.php, line 73

Class

LingotekViewsFunctionalTests
Tests the views integrations for Lingotek.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNodeWithMetadataView() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet('lingotek/views/node_and_lingotek_metadata');
  $assert_session
    ->elementTextContains('css', 'h1.page-title', 'Node view with metadata relationship');
  $assert_session
    ->elementExists('css', '.view-node-and-lingotek-metadata');
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['body[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
  $this
    ->saveAndPublishNodeForm($edit);
  $this
    ->drupalGet('lingotek/views/node_and_lingotek_metadata');
  $assert_session
    ->elementExists('css', '.view-node-and-lingotek-metadata');
  $assert_session
    ->linkExists('Llamas are cool');
  $assert_session
    ->elementTextContains('css', 'td.views-field-translation-source', 'EN');
  $assert_session
    ->elementTextNotContains('css', 'td.views-field-document-id', 'dummy-document-hash-id');
  $assert_session
    ->elementTextNotContains('css', 'td.views-field-translation-status-value', 'EN');
  $assert_session
    ->linkExists('Manual');
  $this
    ->saveAndKeepPublishedNodeForm([
    'lingotek_translation_management[lingotek_translation_profile]' => 'automatic',
  ], 1);
  $this
    ->drupalGet('lingotek/views/node_and_lingotek_metadata');
  $assert_session
    ->elementExists('css', '.view-node-and-lingotek-metadata');
  $assert_session
    ->linkExists('Llamas are cool');
  $assert_session
    ->elementTextContains('css', 'td.views-field-translation-source', 'EN');
  $assert_session
    ->elementTextContains('css', 'td.views-field-document-id', 'dummy-document-hash-id');
  $assert_session
    ->elementTextNotContains('css', 'td.views-field-translation-status-value', 'EN');
  $assert_session
    ->elementTextContains('css', 'td.views-field-translation-status-value', 'ES');
  $assert_session
    ->linkExists('Automatic');
}