Skip to content

Commit

Permalink
Merge pull request #3 from interpopulus/feature/add-is-clean
Browse files Browse the repository at this point in the history
Added isClean method and corresponding test
  • Loading branch information
Danno040 committed Aug 6, 2015
2 parents 74c9ed4 + 370d1f3 commit d9ca1da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ public function offsetUnset($offset)
);
}

/**
* @return bool
*/
public function isClean()
{
return empty($this->propertyDirty);
}

/**
* @param $key
* @param $value
Expand Down
11 changes: 11 additions & 0 deletions tests/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,15 @@ public function test_binary_trait()

$this->assertFalse($entity->changedAndEnabled('binaryProp'));
}

public function test_is_clean()
{
$entity = new TestEntity(['testProp' => 'test1', 'test_prop' => 'test2']);

$this->assertTrue($entity->isClean());

$entity->testProp = 'testInfinity';

$this->assertFalse($entity->isClean());
}
}

0 comments on commit d9ca1da

Please sign in to comment.