Skip to content
Browse files

ensure that children are returned in the order they were stored

  • Loading branch information...
1 parent 5b276f9 commit 7a3f690cd407f5fc75af4ae3d70b4360c5a499c7 @lsmith77 lsmith77 committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/Doctrine/Tests/ODM/PHPCR/Functional/ChildrenTest.php
View
14 tests/Doctrine/Tests/ODM/PHPCR/Functional/ChildrenTest.php
@@ -63,6 +63,7 @@ public function testChildrenCollection()
$this->assertCount(4, $col);
$childA = $col['child-a'];
$this->assertEquals('Child A', $childA->name);
+ $this->assertEquals('child-a', $col->key());
$col = $this->dm->getChildren($parent, 'child*');
$this->assertCount(4, $col);
@@ -70,6 +71,19 @@ public function testChildrenCollection()
$col = $this->dm->getChildren($parent, '*a');
$this->assertCount(1, $col);
$this->assertTrue($childA === $col->first());
+
+ $this->dm->clear();
+
+ $this->dm->find('Doctrine\Tests\ODM\PHPCR\Functional\ChildrenTestObj', '/functional/parent/child-d');
+ $parent = $this->dm->find('Doctrine\Tests\ODM\PHPCR\Functional\ChildrenTestObj', '/functional/parent');
+ $col = $this->dm->getChildren($parent);
+ $this->assertEquals('child-a', $col->key());
+
+ $this->dm->clear();
+
+ $this->dm->find('Doctrine\Tests\ODM\PHPCR\Functional\ChildrenTestObj', '/functional/parent/child-d');
+ $parent = $this->dm->find('Doctrine\Tests\ODM\PHPCR\Functional\ChildrenTestObj', '/functional/parent');
+ $this->assertEquals('child-a', $parent->allChildren->key());
}
public function testNoChildrenInitOnFlush()

0 comments on commit 7a3f690

Please sign in to comment.
Something went wrong with that request. Please try again.