Exemplo n.º 1
0
 function testMoreThanADay()
 {
     $filter = new T_Filter_HumanTimePeriod();
     $this->assertSame($filter->transform(23 * 60 * 60 + 59 * 60 + 30), '1 day');
     $this->assertSame($filter->transform(24 * 60 * 60 + 29 * 60 + 29), '1 day');
     $this->assertSame($filter->transform(24 * 60 * 60 + 1 * 60 * 60 + 13 * 60 + 1), '1 day 1 hour');
     $this->assertSame($filter->transform(24 * 60 * 60 + 3 * 60 * 60 - 13 * 60 + 1), '1 day 3 hours');
     $this->assertSame($filter->transform(5 * 24 * 60 * 60 + 0.25 * 60 * 60), '5 days');
     $this->assertSame($filter->transform(5 * 24 * 60 * 60 + 23 * 60 * 60), '5 days 23 hours');
     $this->assertSame($filter->transform(35 * 24 * 60 * 60 - 0.25 * 60 * 60), '35 days');
 }
Exemplo n.º 2
0
 protected function getError($expiry)
 {
     $f = new T_Filter_HumanTimePeriod();
     $time = $f->transform($expiry - time());
     $msg = 'Due to unusual activity, your account has been temporarily ' . "disabled for the next {$time}. " . 'Please wait and try again later, or contact your system ' . 'administrator.';
     return new T_Exception_Auth($msg);
 }