public function ViewUnpublishedViewsTest::testIt in view_unpublished 8
Sets up the test.
File
- tests/
src/ Functional/ ViewUnpublishedViewsTest.php, line 47
Class
- ViewUnpublishedViewsTest
- Tests the View Unpublished module with views.
Namespace
Drupal\Tests\view_unpublished\FunctionalCode
public function testIt() {
$page_node = $this
->createNode([
'type' => 'page',
]);
$page_node
->setUnPublished();
$page_node
->save();
$article_node = $this
->createNode([
'type' => 'article',
]);
$article_node
->setUnPublished();
$article_node
->save();
$this
->drupalLogin($this
->createUser([
'view any unpublished content',
'access content overview',
]));
$this
->drupalGet('admin/content');
$this
->assertSession()
->pageTextContains($page_node
->label());
$this
->assertSession()
->pageTextContains($article_node
->label());
$this
->drupalLogin($this
->createUser([
'view any unpublished page content',
'access content overview',
]));
$this
->drupalGet('admin/content');
$this
->assertSession()
->pageTextContains($page_node
->label());
$this
->assertSession()
->pageTextNotContains($article_node
->label());
$this
->drupalLogin($this
->createUser([
'access content overview',
]));
$this
->drupalGet('admin/content');
$this
->assertSession()
->pageTextNotContains($page_node
->label());
$this
->assertSession()
->pageTextNotContains($article_node
->label());
}