diff --git a/tests/Collection/SnapshotTestCase.php b/tests/Collection/SnapshotTestCase.php index 5330cc9bc..687f878d0 100644 --- a/tests/Collection/SnapshotTestCase.php +++ b/tests/Collection/SnapshotTestCase.php @@ -98,5 +98,16 @@ class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase $this->assertEqual($users[0]->Group[0]->name, 'PHP'); $this->assertEqual($users[0]->Group[1]->name, 'Web'); + + unset($user->Group[0]); + + $user->save(); + + $this->assertEqual(count($user->Group->getSnapshot()), 1); + unset($user->Group[1]); + $this->assertEqual(count($user->Group->getSnapshot()), 1); + $user->save(); + + $this->assertEqual(count($user->Group->getSnapshot()), 0); } } diff --git a/tests/unsolved.php b/tests/unsolved.php new file mode 100644 index 000000000..bd5e49b37 --- /dev/null +++ b/tests/unsolved.php @@ -0,0 +1,40 @@ +openConnection($dbh); + +$user = new User(); +$user->name = 'zYne'; +$user->Phonenumber[0]->phonenumber = '123 123'; +if ($user === $user->Phonenumber[0]->entity_id) { + print 'case 1 works'; +} +$city = new Record_City(); +$city->name = 'City 1'; +$city->District->name = 'District 1'; + +if ($city->District === $city->district_id) { + print 'case 2 works'; +} + + +$c = new Record_Country(); +$c->name = 'Some country'; +$c->City[0]->name = 'City 1'; +$c->City[0]->District->name = 'District 1'; + +print $c->City[0]->District; +print $c->City[0]->get('district_id'); + +if ($c->City[0]->get('district_id') == $c->City[0]->District) { + print "case 3 works!"; +}