spec\Sylius\Bundle\ProductBundle\Form\DataTransformer\ProductsToProductAssociationsTransformerSpec::it_transforms_product_associations_to_array PHP Метод

it_transforms_product_associations_to_array() публичный Метод

public it_transforms_product_associations_to_array ( Sylius\Component\Product\Model\ProductAssociationInterface $productAssociation, Sylius\Component\Product\Model\ProductAssociationTypeInterface $productAssociationType, Sylius\Component\Product\Model\ProductInterface $firstAssociatedProduct, Sylius\Component\Product\Model\ProductInterface $secondAssociatedProduct )
$productAssociation Sylius\Component\Product\Model\ProductAssociationInterface
$productAssociationType Sylius\Component\Product\Model\ProductAssociationTypeInterface
$firstAssociatedProduct Sylius\Component\Product\Model\ProductInterface
$secondAssociatedProduct Sylius\Component\Product\Model\ProductInterface
    function it_transforms_product_associations_to_array(ProductAssociationInterface $productAssociation, ProductAssociationTypeInterface $productAssociationType, ProductInterface $firstAssociatedProduct, ProductInterface $secondAssociatedProduct)
    {
        $productAssociation->getType()->willReturn($productAssociationType);
        $productAssociation->getAssociatedProducts()->willReturn(new ArrayCollection([$firstAssociatedProduct->getWrappedObject(), $secondAssociatedProduct->getWrappedObject()]));
        $firstAssociatedProduct->getId()->willReturn(7);
        $secondAssociatedProduct->getId()->willReturn(21);
        $productAssociationType->getCode()->willReturn('accessories');
        $this->transform([$productAssociation])->shouldReturn(['accessories' => '7,21']);
    }