protected function NotLoggedBlockTest::createTestUser in Auto Purge Users 8.3
Active user to be blocked.
Expected to be blocked, their content still published.
Overrides SettingsBase::createTestUser
1 call to NotLoggedBlockTest::createTestUser()
- NotLoggedBlockTest::setUp in tests/
src/ Functional/ NotLoggedBlockTest.php
File
- tests/
src/ Functional/ NotLoggedBlockTest.php, line 86
Class
- NotLoggedBlockTest
- Purge users who have not logged in for a specific period.
Namespace
Drupal\Tests\purge_users\FunctionalCode
protected function createTestUser() : void {
// User is created 12 months ago and never logged in.
// Expected not to be blocked.
$this->neverLoggedUser = $this
->createUser([], NULL, FALSE, [
'created' => strtotime('-12 month'),
'login' => 0,
]);
$this->activeUserToBlock = $this
->createUser();
// The user has also created content that will be kept.
$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'),
]);
}