public function testTrashSubtree()
{
$handler = $this->getTrashHandler();
$this->locationGateway->expects($this->at(0))->method('getSubtreeContent')->with(20)->will($this->returnValue(array(array('contentobject_id' => 10, 'node_id' => 20, 'main_node_id' => 30, 'parent_node_id' => 40), array('contentobject_id' => 11, 'node_id' => 21, 'main_node_id' => 31, 'parent_node_id' => 41))));
$this->locationGateway->expects($this->at(1))->method('countLocationsByContentId')->with(10)->will($this->returnValue(1));
$this->locationGateway->expects($this->at(2))->method('trashLocation')->with(20);
$this->locationGateway->expects($this->at(3))->method('countLocationsByContentId')->with(11)->will($this->returnValue(2));
$this->locationGateway->expects($this->at(4))->method('removeLocation')->with(21);
$this->locationHandler->expects($this->once())->method('markSubtreeModified')->with(40);
$this->locationGateway->expects($this->at(5))->method('loadTrashByLocation')->with(20)->will($this->returnValue($array = array('data…')));
$this->locationMapper->expects($this->once())->method('createLocationFromRow')->with($array, null, new Trashed())->will($this->returnValue(new Trashed(array('id' => 20))));
$trashedObject = $handler->trashSubtree(20);
self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Trashed', $trashedObject);
self::assertSame(20, $trashedObject->id);
}