Skip to content
Permalink
Browse files

Adding test for now() function generator

  • Loading branch information...
lorenzo committed Mar 16, 2013
1 parent 56ed756 commit b084f7419ae25bfa712ca1fabba7d18ae9f07078
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/Cake/Test/TestCase/Model/Datasource/Database/FunctionsTraitTest.php
@@ -83,4 +83,18 @@ public function testCoalesce() {
$param2 = $function->bindings()[2]['placeholder'];
$this->assertEquals("COALESCE(NULL, :$param, :$param2)", (string)$function);
}
public function testNow() {
$function = $this->functions->now();
$this->assertInstanceOf('\Cake\Model\Datasource\Database\Expression\FunctionExpression', $function);
$this->assertEquals("NOW()", (string)$function);
$function = $this->functions->now('date');
$this->assertInstanceOf('\Cake\Model\Datasource\Database\Expression\FunctionExpression', $function);
$this->assertEquals("CURRENT_DATE()", (string)$function);
$function = $this->functions->now('time');
$this->assertInstanceOf('\Cake\Model\Datasource\Database\Expression\FunctionExpression', $function);
$this->assertEquals("CURRENT_TIME()", (string)$function);

This comment has been minimized.

Copy link
@markstory

markstory Mar 17, 2013

Member

Will these tests pass against all the drivers? or should the test have a skipif for non mysql sources?

This comment has been minimized.

Copy link
@lorenzo

lorenzo Mar 17, 2013

Author Member

It does, thanks to the query translators :)

This comment has been minimized.

Copy link
@markstory

markstory Mar 17, 2013

Member

Fancy :)

}
}

0 comments on commit b084f74

Please sign in to comment.
You can’t perform that action at this time.