You are here

protected function InactiveDeleteTest::createTestUser in Auto Purge Users 8.3

Settings for a blocked user expected to be deleted.

Overrides SettingsBase::createTestUser

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

File

tests/src/Functional/InactiveDeleteTest.php, line 77

Class

InactiveDeleteTest
Purge users whose account has not been activated for a specific period.

Namespace

Drupal\Tests\purge_users\Functional

Code

protected function createTestUser() : void {

  // User is created 6 months ago, never logged in
  // and status = 0.
  // Expected not to be blocked.
  $this->blockedUser = $this
    ->createUser([], NULL, FALSE, [
    'created' => strtotime('-6 days'),
    'login' => 0,
  ]);
  $this->blockedUser->status = 0;
  $this->blockedUser
    ->save();
  $this->blockedUserToDelete = $this
    ->createUser([], NULL, FALSE, [
    'created' => strtotime('-3 year'),
    'login' => 0,
  ]);
  $this->blockedUserToDelete->status = 0;
  $this->blockedUserToDelete
    ->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'),
  ]);
}