Skip to content

Commit

Permalink
Use comments table in query SQL date functions test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladislav Gallay committed Jul 1, 2015
1 parent 52710b7 commit 9e1c14b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/TestCase/Database/QueryTest.php
Expand Up @@ -2684,25 +2684,25 @@ function ($q) {
'addDays' => $query->func()->dateAdd('created', +2, 'day'),
'substractYears' => $query->func()->dateAdd('created', -2, 'year')
])
->from('users')
->where(['username' => 'mariano'])
->from('comments')
->where(['created' => '2007-03-18 10:45:23'])
->execute()
->fetchAll('assoc');
$result[0]['m'] = ltrim($result[0]['m'], '0');
$result[0]['me'] = ltrim($result[0]['me'], '0');
$result[0]['addDays'] = substr($result[0]['addDays'], 0, 19);
$result[0]['substractYears'] = substr($result[0]['substractYears'], 0, 19);
$expected = [
'd' => '17',
'd' => '18',
'm' => '3',
'y' => '2007',
'de' => '17',
'de' => '18',
'me' => '3',
'ye' => '2007',
'wd' => '6', // Saturday
'dow' => '6',
'addDays' => '2007-03-19 01:16:23',
'substractYears' => '2005-03-17 01:16:23'
'wd' => '0', // Sunday
'dow' => '0',
'addDays' => '2007-03-20 01:16:23',
'substractYears' => '2005-03-18 01:16:23'
];
$this->assertEquals($expected, $result[0]);
}
Expand Down

0 comments on commit 9e1c14b

Please sign in to comment.