public function it_should_not_remove_identifier_requirements_when_other_requirements_are_provided($attrRequiFactory, $channelRepository, FamilyInterface $family, AttributeRepositoryInterface $attributeRepository, AttributeInterface $skuAttribute, AttributeInterface $nameAttribute, AttributeInterface $descAttribute, AttributeRequirementInterface $skuMobileRqrmt, AttributeRequirementInterface $skuPrintRqrmt, AttributeRequirementInterface $namePrintRqrmt, AttributeRequirementInterface $descPrintRqrmt, ChannelInterface $mobileChannel, ChannelInterface $printChannel) { $values = ['code' => 'mycode', 'requirements' => ['print' => ['name', 'description']]]; $family->getAttributeRequirements()->willReturn([$skuMobileRqrmt, $skuPrintRqrmt]); $family->getId()->willReturn(42); $skuMobileRqrmt->getAttribute()->willReturn($skuAttribute); $skuPrintRqrmt->getAttribute()->willReturn($skuAttribute); $skuMobileRqrmt->getChannelCode()->willReturn('mobile'); $skuPrintRqrmt->getChannelCode()->willReturn('print'); $skuAttribute->getAttributeType()->willReturn(AttributeTypes::IDENTIFIER); $channelRepository->findOneByIdentifier('print')->willReturn($printChannel); $attributeRepository->findOneByIdentifier('name')->willReturn($nameAttribute); $attributeRepository->findOneByIdentifier('description')->willReturn($descAttribute); $attrRequiFactory->createAttributeRequirement($nameAttribute, $printChannel, true)->willReturn($namePrintRqrmt); $attrRequiFactory->createAttributeRequirement($descAttribute, $printChannel, true)->willReturn($descPrintRqrmt); $namePrintRqrmt->getAttribute()->willReturn($nameAttribute); $descPrintRqrmt->getAttribute()->willReturn($descAttribute); $channelRepository->getChannelCodes()->willReturn(['mobile', 'print']); $channelRepository->findOneByIdentifier('mobile')->willReturn($mobileChannel); $channelRepository->findOneByIdentifier('print')->willReturn($printChannel); $attributeRepository->getIdentifier()->willReturn($skuAttribute); $family->setCode('mycode')->shouldBeCalled(); $family->setAttributeRequirements([$skuMobileRqrmt, $skuPrintRqrmt, $namePrintRqrmt, $descPrintRqrmt])->shouldBeCalled(); $this->update($family, $values, []); }