function ContentTmgmtEntitySourceListTest::testNodeEntityListings in Translation Management Tool 8
File
- sources/content/tests/src/Functional/ContentTmgmtEntitySourceListTest.php, line 292
Class
- ContentTmgmtEntitySourceListTest
- Tests the user interface for entity translation lists.
Namespace
Drupal\Tests\tmgmt_content\Functional
Code
function testNodeEntityListings() {
$content_translation_manager = \Drupal::service('content_translation.manager');
$content_translation_manager
->setEnabled('node', 'article', FALSE);
$content_translation_manager
->setEnabled('node', 'page', FALSE);
$this
->drupalGet('admin/tmgmt/sources/content/node');
$this
->assertSession()
->pageTextContains(t('Entity translation is not enabled for any of existing content types. To use this functionality go to Content types administration and enable entity translation for desired content types.'));
$content_translation_manager
->setEnabled('node', 'article', TRUE);
$content_translation_manager
->setEnabled('node', 'page', TRUE);
$page_node_translatable = $this
->createTranslatableNode('page');
$this
->drupalGet('admin/tmgmt/sources/content/node');
$this
->assertSession()
->pageTextContains($this->nodes['article']['en'][0]
->label());
$this
->assertSession()
->pageTextContains($page_node_translatable
->label());
$edit = array();
$edit['search[type]'] = 'article';
$this
->drupalPostForm('admin/tmgmt/sources/content/node', $edit, t('Search'));
$this
->assertSession()
->pageTextContains($this->nodes['article']['en'][0]
->label());
$this
->assertNoText($page_node_translatable
->label());
$this
->drupalPostForm('admin/tmgmt/sources/content/node', $edit, t('Cancel'));
$this
->assertSession()
->pageTextContains($this->nodes['article']['en'][0]
->label());
$this
->assertSession()
->pageTextContains($page_node_translatable
->label());
$this
->config('tmgmt.settings')
->set('source_list_limit', 8)
->save();
$translation = $this->nodes['article']['de'][0]
->addTranslation('en', $this->nodes['article']['de'][0]
->toArray());
$translation
->setNewRevision(TRUE);
$translation
->save();
$this
->drupalGet('admin/tmgmt/sources/content/node');
$this
->assertSession()
->linkNotExists('Next');
$this
->config('tmgmt.settings')
->set('source_list_limit', 4)
->save();
$this
->drupalGet('admin/tmgmt/sources/content/node');
$this
->assertSession()
->linkExists('Next');
$this
->assertSession()
->linkExists('Go to page 2');
$this
->assertSession()
->linkNotExists('Go to page 3');
}