View source
<?php
namespace Drupal\Tests\lingotek\Functional\Views;
use Drupal\lingotek\Lingotek;
use Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest;
class LingotekNodeBulkViewsTranslationTest extends LingotekNodeBulkTranslationTest {
use LingotekViewsTestTrait;
public static $modules = [
'block',
'node',
'views',
];
protected function setUp() {
parent::setUp();
\Drupal::getContainer()
->get('module_installer')
->install([
'lingotek_views_test',
], TRUE);
}
public function testAddContentLinkPresent() {
$this
->markTestSkipped('This doesn\'t apply if we replace the management pages with views. Or if you do, it is your decision to add the content creation link.');
}
protected function assertSelectionIsKept(string $key) {
$this
->assertText('You are not authorized to access this page.');
}
protected function assertSourceStatus($language, $status) {
if ($status === Lingotek::STATUS_UNTRACKED) {
$status_target = $this
->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "') and ./a[contains(text(), '" . strtoupper($language) . "')]]");
if (count($status_target) === 1) {
$this
->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
}
else {
$status_target = $this
->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "') and contains(text(), '" . strtoupper($language) . "')]");
if (count($status_target) === 1) {
$this
->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
}
else {
$status_target = $this
->xpath("//span[contains(@class,'language-icon')]");
$this
->assertEqual(count($status_target), 0, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
}
}
}
else {
$status_target = $this
->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "') and ./a[contains(text(), '" . strtoupper($language) . "')]]");
if (count($status_target) === 1) {
$this
->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
}
else {
$status_target = $this
->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "') and contains(text(), '" . strtoupper($language) . "')]");
$this
->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
}
}
}
}