UserRestrictionsExpireTest.php in User restrictions 8
File
tests/src/Functional/UserRestrictionsExpireTest.php
View source
<?php
namespace Drupal\Tests\user_restrictions\Functional;
class UserRestrictionsExpireTest extends UserRestrictionsTestBase {
protected $id = 'test_rule_expire_1';
protected $name = 'Test rule with expiration #1';
public function testUserRestrictionsRecordExists() {
$restriction = $this->storage
->load($this->id);
$this
->assertNotNull($restriction, 'User Restriction exists in the database');
$this
->assertEqual($restriction
->label(), $this->name, 'User restriction exists');
}
public function testUserRestrictionsExpiredLogin() {
$account = $this
->drupalCreateUser([], 'expired-user');
$this
->drupalLogin($account);
}
public function testUserRestrictionsExpiredCron() {
\Drupal::service('cron')
->run();
$this->storage
->resetCache();
$this
->assertNull($this->storage
->load($this->id), 'User restriction does not exist.');
}
}