Commit d83b2b98 authored by Patrick Barroca's avatar Patrick Barroca 🎮

fix Storm_Model_Abstract::hasChange() bug

parent 77704143
Pipeline #1867 passed with stage
in 6 seconds
......@@ -837,7 +837,8 @@ abstract class Storm_Model_Abstract {
public function hasChangedAttribute($name) {
if ($this->isNew() ||
null === $name ||
!isset($this->_attributes[$name])) return false;
!isset($this->_attributes[$name]))
return false;
if (!isset($this->_attributes_in_db[$name]))
return true;
......@@ -847,7 +848,7 @@ abstract class Storm_Model_Abstract {
public function hasChange() {
foreach($this->toArray() as $name) {
foreach(array_keys($this->toArray()) as $name) {
if($this->hasChangedAttribute($name))
return true;
}
......
......@@ -122,6 +122,11 @@ class Storm_Test_AttributeChangeForExistingUserTest extends Storm_Test_ModelTest
function nullAttributeShouldNotHaveChanged(){
$this->assertFalse($this->user->hasChangedAttribute(null));
}
/** @test */
public function modelShouldHaveChange() {
$this->assertTrue($this->user->hasChange());
}
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment