You are here

public function DeletedTest::testNotDeleted 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::testNotDeleted()

Tests the _deleted filter when _deleted == 0.

File

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

Class

DeletedTest
Tests the _deleted field handler.

Namespace

Drupal\Tests\multiversion\Functional\Views

Code

public function testNotDeleted() {
  $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_not_deleted');
  $this
    ->assertText($node1
    ->label());
  $this
    ->assertText($node2
    ->label());
  $this
    ->assertNoText($node3
    ->label());
  $this
    ->assertNoText($node4
    ->label());
}