You are here

protected function NotLoggedBlockedUnpublishTest::checkTestResults in Auto Purge Users 8.3

Check the state of each user.

2 calls to NotLoggedBlockedUnpublishTest::checkTestResults()
NotLoggedBlockedUnpublishTest::checkConfirmFormResults in tests/src/Functional/NotLoggedBlockedUnpublishTest.php
Verifies the expected results of each test.
NotLoggedBlockedUnpublishTest::checkCronResults in tests/src/Functional/NotLoggedBlockedUnpublishTest.php
Verifies the expected results of each test.

File

tests/src/Functional/NotLoggedBlockedUnpublishTest.php, line 58

Class

NotLoggedBlockedUnpublishTest
Purge users who did not log in for a specific period.

Namespace

Drupal\Tests\purge_users\Functional

Code

protected function checkTestResults() : void {

  // Admin user is not blocked.
  $account = $this->userStorage
    ->load($this->admin
    ->id());
  $this
    ->assertFalse($account
    ->isBlocked());

  // Never logged user is not blocked.
  $account = $this->userStorage
    ->load($this->neverLoggedUser
    ->id());
  $this
    ->assertFalse($account
    ->isBlocked());

  // Active user is blocked.
  $account = $this->userStorage
    ->load($this->activeUserToBlock
    ->id());
  $this
    ->assertTrue($account
    ->isBlocked());

  // Confirm user's content is published.
  $test_node = $this->nodeStorage
    ->loadUnchanged($this->node
    ->id());
  $this
    ->assertFalse($test_node
    ->isPublished());

  // Active is not blocked.
  $account = $this->userStorage
    ->load($this->activeUser
    ->id());
  $this
    ->assertFalse($account
    ->isBlocked());
}