示例#1
0
 function it_should_resolve_exportables_in_argument_list(ExportableInterface $exportableMain, ExportableInterface $exportableChild, ExportableInterface $exportableChildInArray)
 {
     $exportableChildInArray->export()->willReturn([]);
     $exportableChild->export()->willReturn(['name1' => 'value1', 'value' => ['data_key' => $exportableChildInArray->getWrappedObject()]]);
     $exportableMain->export()->willReturn(['name1' => 'value1', 'child' => $exportableChild->getWrappedObject()]);
     $this->build($exportableMain)->shouldBeLike(new Instance(get_class($exportableMain->getWrappedObject()), ['name1' => 'value1', 'child' => new Instance(get_class($exportableChild->getWrappedObject()), ['name1' => 'value1', 'value' => ['data_key' => new Instance(get_class($exportableChildInArray->getWrappedObject()))]])]));
 }
示例#2
0
 /**
  * Builds statement based on exportable object
  *
  * @param ExportableInterface $exportable
  *
  * @return Instance
  */
 public function build(ExportableInterface $exportable)
 {
     $arguments = $this->resolveArray($exportable->export());
     return new Instance(get_class($exportable), $arguments);
 }