summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorblair <[email protected]>2015-04-07 09:46:11 -0700
committerblair <[email protected]>2015-04-07 09:46:11 -0700
commit431684ffe8469cd41c4b2ace98666578cc6ae9af (patch)
tree4bcd2dbfafa051c49867b615de914b44e794f08f /test
parent1db83c9fee8a6418d92fd6fa87447d31faf88842 (diff)
Update ORM#is_dirty - swapped isset() for array_key_exists() - isset() will return false when fields have been set null.
Update ORMTest#testIsDirty - added tests for filed set to '' and null
Diffstat (limited to 'test')
-rw-r--r--test/ORMTest.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/ORMTest.php b/test/ORMTest.php
index f244f12..b85b0f6 100644
--- a/test/ORMTest.php
+++ b/test/ORMTest.php
@@ -43,9 +43,15 @@ class ORMTest extends PHPUnit_Framework_TestCase {
public function testIsDirty() {
$model = ORM::for_table('test')->create();
$this->assertFalse($model->is_dirty('test'));
-
+
$model = ORM::for_table('test')->create(array('test' => 'test'));
$this->assertTrue($model->is_dirty('test'));
+
+ $model->test = null;
+ $this->assertTrue($model->is_dirty('test'));
+
+ $model->test = '';
+ $this->assertTrue($model->is_dirty('test'));
}
public function testArrayAccess() {