Esempio n. 1
0
 public function it_can_execute_a_request_part_deux(RequestInterface $request, Page $page, PageBlock $pageBlock)
 {
     $pageUuid = Uuid::uuid4();
     $pageBlockUuid = Uuid::uuid4();
     $newStatus = PageStatusValue::get(PageStatusValue::DELETED);
     $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(false);
     $request->offsetExists('sort_order')->willReturn(false);
     $request->offsetExists('status')->willReturn(true);
     $request->offsetGet('status')->willReturn($newStatus->toString());
     $request->getAcceptContentType()->willReturn('text/xml');
     $pageBlock->getType()->willReturn('type');
     $pageBlock->setStatus($newStatus)->shouldBeCalled();
     $this->pageRepository->getByUuid($pageUuid)->willReturn($page);
     $page->getBlockByUuid($pageBlockUuid)->willReturn($pageBlock);
     $pageBlock->getParameters()->willReturn(['content' => 'test']);
     $this->blockTypeContainer->getType('type')->willReturn(new HtmlContentBlockType());
     $this->pageRepository->updateBlockForPage($pageBlock, $page)->shouldBeCalled();
     $response = $this->executeRequest($request);
     $response['data']->shouldBe($pageBlock);
 }
Esempio n. 2
0
 private function setBlockStatus(PageBlock $block, RequestInterface $request)
 {
     if (isset($request['status'])) {
         $block->setStatus(PageStatusValue::get($request['status']));
     }
 }