Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enum type] Fix isModified() returns true when setting the existing value #140

Merged
merged 1 commit into from Oct 12, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion generator/lib/model/PropelTypes.php
Expand Up @@ -94,7 +94,7 @@ class PropelTypes
const BOOLEAN_EMU_NATIVE_TYPE = "boolean";
const OBJECT_NATIVE_TYPE = "";
const PHP_ARRAY_NATIVE_TYPE = "array";
const ENUM_NATIVE_TYPE = "string";
const ENUM_NATIVE_TYPE = "int";

/**
* Mapping between Propel types and PHP native types.
Expand Down
Expand Up @@ -114,4 +114,31 @@ public function testValueIsCopied()
$e1->copyInto($e2);
$this->assertEquals('baz', $e2->getBar());
}

/**
* @see https://github.com/propelorm/Propel/issues/139
*/
public function testSetterWithSameValueDoesNotUpdateObject()
{
$e = new ComplexColumnTypeEntity3();
$e->setBar('baz');
$e->resetModified();
$e->setBar('baz');
$this->assertFalse($e->isModified());
}

/**
* @see https://github.com/propelorm/Propel/issues/139
*/
public function testSetterWithSameValueDoesNotUpdateHydratedObject()
{
$e = new ComplexColumnTypeEntity3();
$e->setBar('baz');
$e->save();
// force hydration
ComplexColumnTypeEntity3Peer::clearInstancePool();
$e = ComplexColumnTypeEntity3Query::create()->findPk($e->getPrimaryKey());
$e->setBar('baz');
$this->assertFalse($e->isModified());
}
}