Ejemplo n.º 1
0
 /**
  * @param Fractal\Resource\ResourceInterface $resource
  *
  * @return void
  */
 protected function setPayload(Fractal\Resource\ResourceInterface $resource)
 {
     $includes = $this->requestParser->includes();
     $manager = $this->fractalFactory->createManager();
     if ($includes) {
         $manager = $manager->parseIncludes($includes);
     }
     $payload = $manager->createData($resource)->toArray();
     $this->payload = $payload;
 }
Ejemplo n.º 2
0
 /**
  * @param FractalFactory                     $fractalFactory
  * @param Fractal\Resource\ResourceInterface $resource
  * @param Fractal\Manager                    $manager
  * @param Fractal\Scope                      $scope
  * @param \ArrayIterator                     $data
  */
 protected function setPayloadAssertions(FractalFactory $fractalFactory, Fractal\Resource\ResourceInterface $resource, Fractal\Manager $manager, Fractal\Scope $scope, \ArrayIterator $data)
 {
     $fractalFactory->createManager()->shouldBeCalled()->willReturn($manager);
     $manager->createData($resource)->shouldBeCalled()->willReturn($scope);
     $scope->toArray()->shouldBeCalled()->willReturn($data->getArrayCopy());
 }