You are here

public function DeletedTest::testDeleted in Multiversion 8.2

Same name and namespace in other branches
  1. 8 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() {

  // Create four nodes and delete two of them.
  $node1 = $this
    ->drupalCreateNode([
    'uid' => $this->uid,
  ]);
  $node2 = $this
    ->drupalCreateNode([
    'uid' => $this->uid,
  ]);
  $node3 = $this
    ->drupalCreateNode([
    'uid' => $this->uid,
  ]);
  $node3
    ->delete();
  $node4 = $this
    ->drupalCreateNode([
    'uid' => $this->uid,
  ]);
  $node4
    ->delete();
  $this
    ->drupalGet('test_deleted');
  $session = $this
    ->assertSession();
  $session
    ->pageTextNotContains($node1
    ->label());
  $session
    ->pageTextNotContains($node2
    ->label());
  $session
    ->pageTextContains($node3
    ->label());
  $session
    ->pageTextContains($node4
    ->label());
  $alpha = $this
    ->createWorkspaceThroughUi('Alpha', 'alpha');
  $this
    ->switchToWorkspace($alpha);
  $node5 = $this
    ->drupalCreateNode([
    'uid' => $this->uid,
  ]);
  $node6 = $this
    ->drupalCreateNode([
    'uid' => $this->uid,
  ]);
  $node6
    ->delete();
  $this
    ->drupalGet('test_deleted');
  $session = $this
    ->assertSession();
  $session
    ->pageTextNotContains($node1
    ->label());
  $session
    ->pageTextNotContains($node2
    ->label());
  $session
    ->pageTextNotContains($node5
    ->label());
  $session
    ->pageTextContains($node3
    ->label());
  $session
    ->pageTextContains($node4
    ->label());
  $session
    ->pageTextContains($node6
    ->label());
}