mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
changing numeric check in TimeHelper::wasWithinLast to remove the use of a php extension
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6761 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
44fae51ce8
commit
85cd5adaf1
2 changed files with 2 additions and 2 deletions
|
@ -431,7 +431,7 @@ class TimeHelper extends AppHelper {
|
|||
*/
|
||||
function wasWithinLast($timeInterval, $date_string) {
|
||||
$tmp = r(' ', '', $timeInterval);
|
||||
if (is_int($tmp) || preg_match('/[\d]+/', $tmp)) {
|
||||
if (is_numeric($tmp)) {
|
||||
$timeInterval = $tmp.' days';
|
||||
}
|
||||
|
||||
|
|
|
@ -501,7 +501,7 @@ class TimeTest extends UnitTestCase {
|
|||
$this->assertTrue($this->Time->wasWithinLast('5 ', '-3 days'));
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 ', '-1 hour'));
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 ', '-1 minute'));
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 ', '-23 hours -59 minutes - 59 seconds'));
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 ', '-23 hours -59 minutes -59 seconds'));
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
|
Loading…
Add table
Reference in a new issue