public function it_can_execute_a_request(RequestInterface $request, Page $page, PageBlock $pageBlock) { $pageUuid = Uuid::uuid4(); $pageBlockUuid = Uuid::uuid4(); $parameters = ['content' => 42, 'new_gods' => 7]; $sortOrder = 2; $request->offsetExists('page_uuid')->willReturn(true); $request->offsetGet('page_uuid')->willReturn($pageUuid->toString()); $request->offsetExists('uuid')->willReturn(true); $request->offsetGet('uuid')->willReturn($pageBlockUuid->toString()); $request->offsetExists('parameters')->willReturn(true); $request->offsetGet('parameters')->willReturn($parameters); $request->offsetExists('sort_order')->willReturn(true); $request->offsetGet('sort_order')->willReturn($sortOrder); $request->offsetExists('status')->willReturn(false); $request->getAcceptContentType()->willReturn('text/xml'); $pageBlock->offsetSet('content', $parameters['content'])->shouldBeCalled(); $pageBlock->offsetSet('new_gods', $parameters['new_gods'])->shouldBeCalled(); $pageBlock->getType()->willReturn('type'); $pageBlock->getParameters()->willReturn($parameters); $pageBlock->setSortOrder($sortOrder)->shouldBeCalled(); $this->pageRepository->getByUuid($pageUuid)->willReturn($page); $page->getBlockByUuid($pageBlockUuid)->willReturn($pageBlock); $this->blockTypeContainer->getType('type')->willReturn(new HtmlContentBlockType()); $this->pageRepository->updateBlockForPage($pageBlock, $page)->shouldBeCalled(); $response = $this->executeRequest($request); $response['data']->shouldBe($pageBlock); }