示例#1
0
 function it_creates_new_product_from_archetype(FactoryInterface $factory, ProductInterface $product, RepositoryInterface $archetypeRepository, ArchetypeBuilderInterface $archetypeBuilder, ArchetypeInterface $archetype, VariantInterface $variant, FactoryInterface $variantFactory)
 {
     $variantFactory->createNew()->willReturn($variant);
     $variant->setMaster(true)->shouldBeCalled();
     $product->setMasterVariant($variant)->shouldBeCalled();
     $factory->createNew()->willReturn($product);
     $archetypeRepository->findOneBy(array('code' => 'book'))->willReturn($archetype);
     $product->setArchetype($archetype)->shouldBeCalled();
     $archetypeBuilder->build($product)->shouldBeCalled();
     $this->createFromArchetype('book')->shouldReturn($product);
 }