You are here

protected function NotLoggedBlockedUnpublishTest::createTestUser in Auto Purge Users 8.3

Active user settings.

Expected to be blocked and their content unpublished.

Overrides SettingsBase::createTestUser

1 call to NotLoggedBlockedUnpublishTest::createTestUser()
NotLoggedBlockedUnpublishTest::setUp in tests/src/Functional/NotLoggedBlockedUnpublishTest.php

File

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

Class

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

Namespace

Drupal\Tests\purge_users\Functional

Code

protected function createTestUser() : void {

  // User is created 12 months ago and never logged in.
  $this->neverLoggedUser = $this
    ->createUser([], NULL, FALSE, [
    'created' => strtotime('-12 month'),
    'login' => 0,
  ]);
  $this->activeUserToBlock = $this
    ->createUser();
  $this->node = $this
    ->createNode([
    'uid' => $this->activeUserToBlock
      ->id(),
    'published' => TRUE,
  ]);
  $this->node
    ->save();
  $this->activeUserToBlock->created = strtotime("-20 month");
  $this->activeUserToBlock->login = strtotime("-13 month");
  $this->activeUserToBlock
    ->save();

  // User is created 20 months ago and logged in 3 days ago.
  $this->activeUser = $this
    ->createUser([], NULL, FALSE, [
    'created' => strtotime('-20 month'),
    'login' => strtotime('-3 day'),
  ]);
}