You are here

public function DeletedTest::testDeleted in Multiversion 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/Views/DeletedTest.php \Drupal\Tests\multiversion\Functional\Views\DeletedTest::testDeleted()

Tests the _deleted filter when _deleted == 1.

File

tests/src/Functional/Views/DeletedTest.php, line 24

Class

DeletedTest
Tests the _deleted field handler.

Namespace

Drupal\Tests\multiversion\Functional\Views

Code

public function testDeleted() {
  $admin_user = $this
    ->drupalCreateUser([
    'bypass node access',
  ]);
  $uid = $admin_user
    ->id();
  $this
    ->drupalLogin($admin_user);

  // Create four nodes and delete two of them.
  $node1 = $this
    ->drupalCreateNode([
    'uid' => $uid,
  ]);
  $node2 = $this
    ->drupalCreateNode([
    'uid' => $uid,
  ]);
  $node3 = $this
    ->drupalCreateNode([
    'uid' => $uid,
  ]);
  $node3
    ->delete();
  $node4 = $this
    ->drupalCreateNode([
    'uid' => $uid,
  ]);
  $node4
    ->delete();
  $this
    ->drupalGet('test_deleted');
  $this
    ->assertNoText($node1
    ->label());
  $this
    ->assertNoText($node2
    ->label());
  $this
    ->assertText($node3
    ->label());
  $this
    ->assertText($node4
    ->label());
}