Commit 5d8ac6d0 authored by pookey's avatar pookey

pookey: adding test cases for Doctrine_Record::copy refs #172

parent e3137c70
...@@ -652,11 +652,33 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase { ...@@ -652,11 +652,33 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
$this->assertTrue($new instanceof Doctrine_Record); $this->assertTrue($new instanceof Doctrine_Record);
$this->assertTrue($new->getState() == Doctrine_Record::STATE_TDIRTY); $this->assertTrue($new->getState() == Doctrine_Record::STATE_TDIRTY);
$new = $user->copy();
$new->save(); $new->save();
$this->assertEqual($user->name, $new->name);
$this->assertTrue(is_numeric($new->id) && $new->id > 0); $this->assertTrue(is_numeric($new->id) && $new->id > 0);
$new->refresh(); $new->refresh();
$this->assertEqual($user->name, $new->name); $this->assertEqual($user->name, $new->name);
$this->assertTrue(is_numeric($new->id) && $new->id > 0);
}
public function testCopyAndModify() {
$user = $this->connection->getTable("User")->find(4);
$new = $user->copy();
$this->assertTrue($new instanceof Doctrine_Record);
$this->assertTrue($new->getState() == Doctrine_Record::STATE_TDIRTY);
$new->loginname = 'jackd';
$this->assertEqual($user->name, $new->name);
$this->assertEqual($new->loginname, 'jackd');
$new->save();
$this->assertTrue(is_numeric($new->id) && $new->id > 0);
$new->refresh();
$this->assertEqual($user->name, $new->name);
$this->assertEqual($new->loginname, 'jackd');
} }
public function testReferences() { public function testReferences() {
......
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