You are here

protected function NotLoggedBlockTest::checkTestResults in Auto Purge Users 8.3

Check the state of each user.

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

File

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

Class

NotLoggedBlockTest
Purge users who have not logged in for a specific period.

Namespace

Drupal\Tests\purge_users\Functional

Code

protected function checkTestResults() : void {

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

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

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

  // Active user content.
  $test_node = $this->nodeStorage
    ->loadUnchanged($this->node
    ->id());
  $this
    ->assertTrue($test_node
    ->isPublished());

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