Línea 43... |
Línea 43... |
43 |
* Test calculating expiry time in general
|
43 |
* Test calculating expiry time in general
|
44 |
*
|
44 |
*
|
45 |
* @covers ::calculate_expiry_time
|
45 |
* @covers ::calculate_expiry_time
|
46 |
* @return void
|
46 |
* @return void
|
47 |
*/
|
47 |
*/
|
48 |
public function test_calculate_expiry_time_in_general() {
|
48 |
public function test_calculate_expiry_time_in_general(): void {
|
49 |
$timestamp = 1642213800; // 1230 UTC.
|
49 |
$timestamp = 1642213800; // 1230 UTC.
|
Línea 50... |
Línea 50... |
50 |
|
50 |
|
51 |
set_config('expireovernight', 0, 'factor_token');
|
51 |
set_config('expireovernight', 0, 'factor_token');
|
Línea 89... |
Línea 89... |
89 |
*
|
89 |
*
|
90 |
* @covers ::calculate_expiry_time
|
90 |
* @covers ::calculate_expiry_time
|
91 |
* @param int $timestamp
|
91 |
* @param int $timestamp
|
92 |
* @dataProvider timestamp_provider
|
92 |
* @dataProvider timestamp_provider
|
93 |
*/
|
93 |
*/
|
94 |
public function test_calculate_expiry_time_for_overnight_expiry_with_one_day_expiry($timestamp) {
|
94 |
public function test_calculate_expiry_time_for_overnight_expiry_with_one_day_expiry($timestamp): void {
|
95 |
// Setup configuration.
|
95 |
// Setup configuration.
|
96 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
96 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
97 |
set_config('expireovernight', 1, 'factor_token');
|
97 |
set_config('expireovernight', 1, 'factor_token');
|
98 |
set_config('expiry', DAYSECS, 'factor_token');
|
98 |
set_config('expiry', DAYSECS, 'factor_token');
|
Línea 137... |
Línea 137... |
137 |
*
|
137 |
*
|
138 |
* @covers ::calculate_expiry_time
|
138 |
* @covers ::calculate_expiry_time
|
139 |
* @param int $timestamp
|
139 |
* @param int $timestamp
|
140 |
* @dataProvider timestamp_provider
|
140 |
* @dataProvider timestamp_provider
|
141 |
*/
|
141 |
*/
|
142 |
public function test_calculate_expiry_time_for_overnight_expiry_with_two_day_expiry($timestamp) {
|
142 |
public function test_calculate_expiry_time_for_overnight_expiry_with_two_day_expiry($timestamp): void {
|
143 |
// Setup configuration.
|
143 |
// Setup configuration.
|
144 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
144 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
145 |
set_config('expireovernight', 1, 'factor_token');
|
145 |
set_config('expireovernight', 1, 'factor_token');
|
146 |
set_config('expiry', 2 * DAYSECS, 'factor_token');
|
146 |
set_config('expiry', 2 * DAYSECS, 'factor_token');
|
Línea 187... |
Línea 187... |
187 |
*
|
187 |
*
|
188 |
* @covers ::calculate_expiry_time
|
188 |
* @covers ::calculate_expiry_time
|
189 |
* @param int $timestamp
|
189 |
* @param int $timestamp
|
190 |
* @dataProvider timestamp_provider
|
190 |
* @dataProvider timestamp_provider
|
191 |
*/
|
191 |
*/
|
192 |
public function test_calculate_expiry_time_for_overnight_expiry_with_three_hour_expiry($timestamp) {
|
192 |
public function test_calculate_expiry_time_for_overnight_expiry_with_three_hour_expiry($timestamp): void {
|
193 |
// Setup configuration.
|
193 |
// Setup configuration.
|
194 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
194 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
195 |
set_config('expireovernight', 1, 'factor_token');
|
195 |
set_config('expireovernight', 1, 'factor_token');
|
196 |
set_config('expiry', 3 * HOURSECS, 'factor_token');
|
196 |
set_config('expiry', 3 * HOURSECS, 'factor_token');
|
Línea 231... |
Línea 231... |
231 |
*
|
231 |
*
|
232 |
* @covers ::calculate_expiry_time
|
232 |
* @covers ::calculate_expiry_time
|
233 |
* @param int $timestamp
|
233 |
* @param int $timestamp
|
234 |
* @dataProvider timestamp_provider
|
234 |
* @dataProvider timestamp_provider
|
235 |
*/
|
235 |
*/
|
236 |
public function test_calculate_expiry_time_for_overnight_expiry_with_an_hour_expiry($timestamp) {
|
236 |
public function test_calculate_expiry_time_for_overnight_expiry_with_an_hour_expiry($timestamp): void {
|
237 |
// Setup configuration.
|
237 |
// Setup configuration.
|
238 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
238 |
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
|
239 |
set_config('expireovernight', 1, 'factor_token');
|
239 |
set_config('expireovernight', 1, 'factor_token');
|
240 |
set_config('expiry', HOURSECS, 'factor_token');
|
240 |
set_config('expiry', HOURSECS, 'factor_token');
|