Skip to content
This repository
Browse code

Add test for using SQL constants in virtualFields.

Fixes #2085
  • Loading branch information...
commit 8d9091d758f4d58d6332b71a641e9de5e3bc7d26 1 parent 4e37c79
Mark Story authored October 20, 2011
16  cake/tests/cases/libs/model/model_read.test.php
@@ -7408,6 +7408,22 @@ function testVirtualFields() {
7408 7408
 		$this->assertTrue(isset($result['Author']['full_name']));
7409 7409
 	}
7410 7410
 
  7411
+	function getTests() {
  7412
+		return array('start', 'testVirtualFieldAsAConstant', 'end');
  7413
+	}
  7414
+/**
  7415
+ * Test that virtual fields work with SQL constants
  7416
+ *
  7417
+ * @return void
  7418
+ */
  7419
+	function testVirtualFieldAsAConstant() {
  7420
+		$this->loadFixtures('Post', 'Author');
  7421
+		$Post =& ClassRegistry::init('Post');
  7422
+		$Post->virtualFields = array('empty' => "NULL");
  7423
+		$result = $Post->find('first');
  7424
+		$this->assertNull($result['Post']['empty']);
  7425
+	}
  7426
+
7411 7427
 /**
7412 7428
  * test that virtual fields work when they don't contain functions.
7413 7429
  *

0 notes on commit 8d9091d

Please sign in to comment.
Something went wrong with that request. Please try again.