Permalink
Browse files

Add test for using SQL constants in virtualFields.

Fixes #2085
  • Loading branch information...
markstory committed Oct 21, 2011
1 parent 4e37c79 commit 8d9091d758f4d58d6332b71a641e9de5e3bc7d26
Showing with 16 additions and 0 deletions.
  1. +16 −0 cake/tests/cases/libs/model/model_read.test.php
@@ -7408,6 +7408,22 @@ function testVirtualFields() {
$this->assertTrue(isset($result['Author']['full_name']));
}
function getTests() {
return array('start', 'testVirtualFieldAsAConstant', 'end');
}
/**
* Test that virtual fields work with SQL constants
*
* @return void
*/
function testVirtualFieldAsAConstant() {
$this->loadFixtures('Post', 'Author');
$Post =& ClassRegistry::init('Post');
$Post->virtualFields = array('empty' => "NULL");
$result = $Post->find('first');
$this->assertNull($result['Post']['empty']);
}
/**
* test that virtual fields work when they don't contain functions.
*

0 comments on commit 8d9091d

Please sign in to comment.