DeprecatedModerationStateViewsRelationshipTest.php in Drupal 8
File
core/modules/content_moderation/tests/src/Functional/DeprecatedModerationStateViewsRelationshipTest.php
View source
<?php
namespace Drupal\Tests\content_moderation\Functional;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
class DeprecatedModerationStateViewsRelationshipTest extends BrowserTestBase {
use ContentModerationTestTrait;
public static $modules = [
'node',
'content_moderation',
'views_ui',
];
protected function setUp() {
parent::setUp();
NodeType::create([
'type' => 'moderated',
])
->save();
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('node', 'moderated');
$workflow
->save();
$this
->drupalLogin($this->rootUser);
}
public function testReportDeprecatedModerationStateRelationships() {
$this
->drupalGet('admin/structure/views/nojs/add-handler/moderated_content/moderated_content/relationship');
$this
->assertSession()
->pageTextContains('Deprecated: Content moderation state');
$this
->assertSession()
->pageTextContains('Using a relationship to the Content Moderation State entity type has been deprecated');
$this
->drupalGet('admin/reports/status');
$this
->assertSession()
->pageTextNotContains('Content Moderation State views relationship');
$this->container
->get('module_installer')
->install([
'content_moderation_test_views',
]);
$this
->drupalGet('admin/reports/status');
$this
->assertSession()
->pageTextContains('Content Moderation State views relationship');
$this
->assertSession()
->linkExists('test_content_moderation_base_table_test');
$this
->assertSession()
->linkByHrefExists('admin/structure/views/view/test_content_moderation_base_table_test');
$this->container
->get('module_installer')
->uninstall([
'views_ui',
]);
$this
->drupalGet('admin/reports/status');
$this
->assertSession()
->pageTextContains('Content Moderation State views relationship');
$this
->assertSession()
->pageTextContains('test_content_moderation_base_table_test');
}
public function testCodeDeprecationModerationStateRelationships() {
$this->container
->get('module_installer')
->install([
'content_moderation_test_views',
]);
$this
->drupalGet('test-content-moderation-base-table-test');
}
}