eZ\Publish\Core\REST\Server\Tests\Output\ValueObjectVisitor\RestTrashItemTest::testVisit PHP Method

testVisit() public method

Test the TrashItem visitor.
public testVisit ( ) : string
return string
    public function testVisit()
    {
        $visitor = $this->getVisitor();
        $generator = $this->getGenerator();
        $generator->startDocument(null);
        $trashItem = new RestTrashItem(new TrashItem(array('id' => 42, 'priority' => 0, 'hidden' => false, 'invisible' => true, 'remoteId' => 'remote-id', 'parentLocationId' => 21, 'pathString' => '/1/2/21/42/', 'depth' => 3, 'contentInfo' => new ContentInfo(array('id' => 84, 'contentTypeId' => 4, 'name' => 'A Node, long lost in the trash')), 'sortField' => TrashItem::SORT_FIELD_NAME, 'sortOrder' => TrashItem::SORT_ORDER_DESC)), 0);
        $this->addRouteExpectation('ezpublish_rest_loadTrashItem', array('trashItemId' => $trashItem->trashItem->id), "/content/trash/{$trashItem->trashItem->id}");
        $this->addRouteExpectation('ezpublish_rest_loadLocation', array('locationPath' => '1/2/21'), '/content/locations/1/2/21');
        $this->addRouteExpectation('ezpublish_rest_loadContent', array('contentId' => $trashItem->trashItem->contentInfo->id), "/content/objects/{$trashItem->trashItem->contentInfo->id}");
        // Expected twice, second one here for ContentInfo
        $this->addRouteExpectation('ezpublish_rest_loadContent', array('contentId' => $trashItem->trashItem->contentInfo->id), "/content/objects/{$trashItem->trashItem->contentInfo->id}");
        $this->getVisitorMock()->expects($this->once())->method('visitValueObject')->with($this->isInstanceOf('eZ\\Publish\\Core\\REST\\Server\\Values\\RestContent'));
        $visitor->visit($this->getVisitorMock(), $generator, $trashItem);
        $result = $generator->endDocument(null);
        $this->assertNotNull($result);
        return $result;
    }