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']); }