public function testChangeMainLocation() { $treeHandler = $this->getPartlyMockedTreeHandler(array('loadLocation', 'setSectionForSubtree', 'loadContentInfo')); $treeHandler->expects($this->at(0))->method('loadLocation')->with(34)->will($this->returnValue(new Location(array('parentId' => 42)))); $treeHandler->expects($this->at(1))->method('loadContentInfo')->with('12')->will($this->returnValue(new ContentInfo(array('currentVersionNo' => 1)))); $treeHandler->expects($this->at(2))->method('loadLocation')->with(42)->will($this->returnValue(new Location(array('contentId' => 84)))); $treeHandler->expects($this->at(3))->method('loadContentInfo')->with('84')->will($this->returnValue(new ContentInfo(array('sectionId' => 4)))); $this->getLocationGatewayMock()->expects($this->once())->method('changeMainLocation')->with(12, 34, 1, 42); $treeHandler->expects($this->once())->method('setSectionForSubtree')->with(34, 4); $treeHandler->changeMainLocation(12, 34); }