Skip to content

Commit

Permalink
Adding test for now() function generator
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 16, 2013
1 parent 56ed756 commit b084f74
Showing 1 changed file with 14 additions and 0 deletions.
Expand Up @@ -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.