Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test for using SQL constants in virtualFields.

Fixes #2085
  • Loading branch information...
commit 8d9091d758f4d58d6332b71a641e9de5e3bc7d26 1 parent 4e37c79
Mark Story markstory authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 cake/tests/cases/libs/model/model_read.test.php
16 cake/tests/cases/libs/model/model_read.test.php
View
@@ -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.
*
Please sign in to comment.
Something went wrong with that request. Please try again.