Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Use iterator in tests for node names #29

Merged
merged 1 commit into from
Jan 26, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Repository/PhpcrOdmRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function reorderNode($sourcePath, $position)
$document = $this->getDocument($sourcePath);
$node = $this->getManager()->getNodeForDocument($document);
$parent = $node->getParent();
$nodeNames = $parent->getNodeNames();
$nodeNames = iterator_to_array($parent->getNodeNames());
$parentDocument = $this->getManager()->find(null, $parent->getPath());

if ($position == 0) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Repository/PhpcrOdmRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ private function doTestReorder($position, $before)
$this->documentManager->getNodeForDocument($this->child1)->willReturn($this->node1->reveal());
$this->node1->getParent()->willReturn($this->node2->reveal());
$this->node1->getName()->willReturn('foo');
$this->node2->getNodeNames()->willReturn([
$this->node2->getNodeNames()->willReturn(new \ArrayIterator([
'foo', 'bar', 'baz',
]);
]));
$this->node2->getPath()->willReturn('/test');
$this->documentManager->find(null, '/test')->willReturn($this->document);
$this->documentManager->reorder($this->document, 'foo', 'baz', $before)->shouldBeCalled();
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Repository/PhpcrRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ public function testReorder()
$this->node->getPath()->willReturn($evaluatedPath);
$this->node->getParent()->willReturn($this->node1->reveal());
$this->node->getName()->willReturn('node-1');
$this->node1->getNodeNames()->willReturn([
$this->node1->getNodeNames()->willReturn(new \ArrayIterator([
'node-1', 'node-2', 'node-3',
]);
]));

$this->node1->orderBefore('node-1', 'node-3')->shouldBeCalled();
$this->session->save()->shouldBeCalled();
Expand Down