class ModeratedContentLocalTaskTest
Same name and namespace in other branches
- 11.x core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentLocalTaskTest
- 10 core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentLocalTaskTest
Tests moderated content dynamic local task.
@group content_moderation
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\content_moderation\Functional\ModeratedContentLocalTaskTest implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ModeratedContentLocalTaskTest
File
-
core/
modules/ content_moderation/ tests/ src/ Functional/ ModeratedContentLocalTaskTest.php, line 12
Namespace
Drupal\Tests\content_moderation\FunctionalView source
class ModeratedContentLocalTaskTest extends BrowserTestBase {
/**
* A user to test with.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected $adminUser;
/**
* {@inheritdoc}
*/
protected static $modules = [
'block',
'content_moderation',
'node',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
public function setUp() : void {
parent::setUp();
$this->drupalPlaceBlock('local_tasks_block');
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'access content overview',
'view any unpublished content',
]);
}
/**
* Tests the moderated content local task appears.
*/
public function testModeratedContentLocalTask() {
$this->drupalLogin($this->adminUser);
// Verify the moderated content tab exists.
$this->drupalGet('admin/content');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->linkExists('Moderated content');
// Uninstall the node module which should also remove the tab.
$this->container
->get('module_installer')
->uninstall([
'node',
]);
// Verify the moderated content local task does not exist without the node
// module installed.
$this->drupalGet('admin/content');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->linkNotExists('Moderated content');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.