public function testFindUnsavedChildren() { $a = new Object("TestObject"); $b = new Object("TestObject"); $c = new Object("TestObject"); $a->set("likes", array($b, "foo")); $b->set("likes", array($c, 42)); $c->set("likes", $a); $unsavedChildren = $b->findUnsavedChildren(); $this->assertContains($c, $unsavedChildren); $this->assertContains($a, $unsavedChildren); // it should not contain $b $this->assertNotContains($b, $unsavedChildren); }