You are here

function ConfigSourceUiTest::testCart in Translation Management Tool 8

Test the entity source specific cart functionality.

File

sources/tmgmt_config/tests/src/Functional/ConfigSourceUiTest.php, line 328

Class

ConfigSourceUiTest
Content entity source UI tests.

Namespace

Drupal\Tests\tmgmt_config\Functional

Code

function testCart() {
  $this
    ->loginAsTranslator(array(
    'translate configuration',
  ));

  // Test the source overview.
  $this
    ->drupalPostForm('admin/structure/views/view/content/translate', array(), t('Add to cart'));
  $this
    ->drupalPostForm('admin/structure/types/manage/article/translate', array(), t('Add to cart'));

  // Test if the content and article are in the cart.
  $this
    ->drupalGet('admin/tmgmt/cart');
  $this
    ->assertLink('Content view');
  $this
    ->assertLink('Article content type');

  // Test the label on the source overivew.
  $this
    ->drupalGet('admin/structure/views/view/content/translate');
  $this
    ->assertRaw(t('There are @count items in the <a href=":url">translation cart</a> including the current item.', array(
    '@count' => 2,
    ':url' => Url::fromRoute('tmgmt.cart')
      ->toString(),
  )));
}