protected function AssertRoleExpireTrait::setAndGetExpiration in Role Expire 2.x
Same name and namespace in other branches
- 8 tests/src/Traits/AssertRoleExpireTrait.php \Drupal\Tests\role_expire\Traits\AssertRoleExpireTrait::setAndGetExpiration()
Writes and then gets role expiration for a given user and role ID.
Parameters
$account_id: User ID.
string $rid: Role ID.
int $expiration: The expiration timestamp.
Return value
array Array with the expiration time.
1 call to AssertRoleExpireTrait::setAndGetExpiration()
- RoleExpireApiTest::testRoleExpireSetGet in tests/
src/ Functional/ RoleExpireApiTest.php - Tests setter and getter for expiration of a role.
File
- tests/
src/ Traits/ AssertRoleExpireTrait.php, line 23
Class
- AssertRoleExpireTrait
- Adds helper functions.
Namespace
Drupal\Tests\role_expire\TraitsCode
protected function setAndGetExpiration($account_id, $rid, $expiration) {
$this->apiService
->writeRecord($account_id, $rid, $expiration);
$saved_expiration = $this->apiService
->getUserRoleExpiryTime($account_id, $rid);
return $saved_expiration;
}