コード例 #1
0
 function it_sets_attribute_data_date_value_to_a_product_value_with_datetime(AttributeInterface $attribute, ProductInterface $product1, ProductInterface $product2, ProductInterface $product3, $builder, ProductValueInterface $productValue)
 {
     $locale = 'fr_FR';
     $scope = 'mobile';
     $data = new \DateTime();
     $attribute->getCode()->willReturn('attributeCode');
     $productValue->setData(Argument::type('\\Datetime'))->shouldBeCalled();
     $builder->addProductValue($product2, $attribute, $locale, $scope)->willReturn($productValue);
     $product1->getValue('attributeCode', $locale, $scope)->shouldBeCalled()->willReturn($productValue);
     $product2->getValue('attributeCode', $locale, $scope)->willReturn(null);
     $product3->getValue('attributeCode', $locale, $scope)->willReturn($productValue);
     $this->setAttributeData($product1, $attribute, $data, ['locale' => $locale, 'scope' => $scope]);
     $this->setAttributeData($product2, $attribute, $data, ['locale' => $locale, 'scope' => $scope]);
     $this->setAttributeData($product3, $attribute, $data, ['locale' => $locale, 'scope' => $scope]);
 }