You are here

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

Tests the _deleted filter when _deleted == 0.

File

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

Class

DeletedTest
Tests the _deleted field handler.

Namespace

Drupal\Tests\multiversion\Functional\Views

Code

public function testNotDeleted() {

  // 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_not_deleted');
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains($node1
    ->label());
  $session
    ->pageTextContains($node2
    ->label());
  $session
    ->pageTextNotContains($node3
    ->label());
  $session
    ->pageTextNotContains($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_not_deleted');
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains($node1
    ->label());
  $session
    ->pageTextContains($node2
    ->label());
  $session
    ->pageTextContains($node5
    ->label());
  $session
    ->pageTextNotContains($node3
    ->label());
  $session
    ->pageTextNotContains($node4
    ->label());
  $session
    ->pageTextNotContains($node6
    ->label());
}