You are here

protected function BlockedSitePolicyDeleteTest::createTestUser in Auto Purge Users 8.3

Sets the user to be deleted.

This user and their content will be deleted.

Overrides SettingsBase::createTestUser

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

File

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

Class

BlockedSitePolicyDeleteTest
Site policy applied.

Namespace

Drupal\Tests\purge_users\Functional

Code

protected function createTestUser() : void {

  // Blocked user is created 150 days ago, never logged in
  // and status = 0.
  $this->blockedUser = $this
    ->createUser([], NULL, FALSE, [
    'created' => strtotime('-150 day'),
    'login' => 0,
  ]);
  $this->blockedUser->status = 0;
  $this->blockedUser
    ->save();
  $this->blockedUserToDelete = $this
    ->createUser([], NULL, FALSE, [
    'created' => strtotime('-150 day'),
    'login' => strtotime('-150 day'),
  ]);
  $this->blockedUserToDelete->status = 0;
  $this->blockedUserToDelete
    ->save();

  // Active 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'),
  ]);
}