function it_lists_user_notifications_linked_to_the_current_user(UserInterface $user, UserNotification $userNotification, Request $request, $manager, $context, $templating)
 {
     $context->getUser()->willReturn($user);
     $manager->getUserNotifications($user, Argument::cetera())->willReturn([$userNotification]);
     $templating->renderResponse('PimNotificationBundle:Notification:list.json.twig', ['userNotifications' => [$userNotification]], Argument::type('Symfony\\Component\\HttpFoundation\\JsonResponse'))->shouldBeCalled();
     $this->listAction($request);
 }
 function it_processes_homogeneous_items($serializer, $localeRepository)
 {
     $items = [['item1' => ['attr10']], ['item2' => 'attr20'], ['item3' => ['attr30']]];
     $localeRepository->getActivatedLocaleCodes()->willReturn(['code1', 'code2']);
     $serializer->serialize(Argument::cetera())->willReturn('those;items;in;csv;format;');
     $this->process($items)->shouldReturn('those;items;in;csv;format;');
 }
示例#3
0
 function it_builds_form(FormBuilderInterface $builder)
 {
     $builder->add('rating', 'choice', Argument::cetera())->willReturn($builder)->shouldBeCalled();
     $builder->add('title', 'text', Argument::cetera())->willReturn($builder)->shouldBeCalled();
     $builder->add('comment', 'textarea', Argument::cetera())->willReturn($builder)->shouldBeCalled();
     $this->buildForm($builder, ['rating_steps' => 5]);
 }
 function it_should_pre_load_configuration_properly(GenericEvent $event, ContainerInterface $container, PhpGuard $guard, InputInterface $input)
 {
     $input->hasParameterOption(Argument::cetera())->willReturn(false);
     $container->get('phpguard')->willReturn($guard);
     $guard->setOptions(array())->shouldBeCalled();
     $this->preLoad($event);
 }
 function it_does_not_notify_if_job_execution_has_no_user($event, $jobExecution, $manager)
 {
     $jobExecution->getUser()->willReturn(null);
     $jobExecution->getStatus()->shouldNotBeCalled();
     $manager->notify(Argument::cetera())->shouldNotBeCalled();
     $this->afterJobExecution($event);
 }
 function it_throws_an_exception_if_something_went_wrong_with_magento_calls(Category $category, $webservice, $categoryMappingManager)
 {
     $batches = [['create' => [['pimCategory' => $category, 'magentoCategory' => ['foo']]]]];
     $webservice->sendNewCategory(['foo'])->willThrow('\\Pim\\Bundle\\MagentoConnectorBundle\\Webservice\\SoapCallException');
     $categoryMappingManager->registerCategoryMapping(Argument::cetera())->shouldNotBeCalled();
     $this->shouldThrow('\\Akeneo\\Bundle\\BatchBundle\\Item\\InvalidItemException')->duringWrite($batches);
 }
 function it_creates_query_builder_for_all_status($em, QueryBuilder $builder)
 {
     $em->createQueryBuilder()->shouldBeCalled()->willReturn($builder);
     $builder->select('method')->shouldBeCalled()->willReturn($builder);
     $builder->from(Argument::any(), 'method', Argument::cetera())->shouldBeCalled()->willReturn($builder);
     $this->getQueryBuidlerForChoiceType(array('disabled' => true))->shouldReturn($builder);
 }
 function it_copies_simple_select_value_to_a_product_value($builder, $attrValidatorHelper, AttributeInterface $fromAttribute, AttributeInterface $toAttribute, ProductInterface $product1, ProductInterface $product2, ProductInterface $product3, ProductInterface $product4, ProductValueInterface $fromProductValue, ProductValueInterface $toProductValue, AttributeOptionInterface $attributeOption)
 {
     $fromLocale = 'fr_FR';
     $toLocale = 'fr_FR';
     $toScope = 'mobile';
     $fromScope = 'mobile';
     $fromAttribute->getCode()->willReturn('fromAttributeCode');
     $toAttribute->getCode()->willReturn('toAttributeCode');
     $attrValidatorHelper->validateLocale(Argument::cetera())->shouldBeCalled();
     $attrValidatorHelper->validateScope(Argument::cetera())->shouldBeCalled();
     $fromProductValue->getData()->willReturn($attributeOption);
     $toProductValue->setOption($attributeOption)->shouldBeCalledTimes(3);
     $product1->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product1->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $product2->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn(null);
     $product2->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $product3->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product3->getValue('toAttributeCode', $toLocale, $toScope)->willReturn(null);
     $product4->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product4->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $builder->addProductValue($product3, $toAttribute, $toLocale, $toScope)->shouldBeCalledTimes(1)->willReturn($toProductValue);
     $products = [$product1, $product2, $product3, $product4];
     foreach ($products as $product) {
         $this->copyAttributeData($product, $product, $fromAttribute, $toAttribute, ['from_locale' => $fromLocale, 'to_locale' => $toLocale, 'from_scope' => $fromScope, 'to_scope' => $toScope]);
     }
 }
 function let(ChannelManager $channelManager, MediaManager $mediaManager, ProductValueNormalizer $productValueNormalizer, CategoryMappingManager $categoryMappingManager, AssociationTypeManager $associationTypeManager, MappingCollection $storeViewMapping, MappingCollection $categoryMapping, MappingCollection $attributeMapping, Product $product, ProductValue $productValue, ProductValue $imageValue, Channel $channel, Locale $localeFR, Locale $localeEN, Category $category)
 {
     $this->beConstructedWith($channelManager, $mediaManager, $productValueNormalizer, $categoryMappingManager, $associationTypeManager, 1, 4, 'currency', 'magento_url');
     $this->globalContext = ['attributeSetId' => 0, 'magentoAttributes' => [], 'magentoAttributesOptions' => [], 'storeViewMapping' => $storeViewMapping, 'magentoStoreViews' => [['code' => 'fr_fr']], 'defaultLocale' => 'default_locale', 'website' => 'website', 'channel' => 'channel', 'categoryMapping' => $categoryMapping, 'attributeCodeMapping' => $attributeMapping, 'create' => true, 'pimGrouped' => 'pim_grouped', 'created_date' => new \DateTime(), 'updated_date' => new \DateTime(), 'defaultStoreView' => 'default', 'smallImageAttribute' => 'small_image_attribute', 'baseImageAttribute' => 'image_attribute', 'thumbnailAttribute' => 'image_attribute'];
     $attributeMapping->getTarget('visibility')->willReturn('visibility');
     $attributeMapping->getTarget('created_at')->willReturn('created_at');
     $attributeMapping->getTarget('updated_at')->willReturn('updated_at');
     $attributeMapping->getTarget('status')->willReturn('status');
     $attributeMapping->getTarget('categories')->willReturn('categories');
     $channelManager->getChannelByCode('channel')->willReturn($channel);
     $channel->getLocales()->willReturn([$localeEN, $localeFR]);
     $localeEN->getCode()->willReturn('default_locale');
     $localeFR->getCode()->willReturn('fr_FR');
     $channel->getCode()->willReturn('channel_code');
     $channel->getCategory()->willReturn($category);
     $product->getCategories()->willReturn([$category]);
     $product->getIdentifier()->willReturn('sku-000');
     $product->getCreated()->willReturn($this->globalContext['created_date']);
     $product->getUpdated()->willReturn($this->globalContext['updated_date']);
     $product->getValues()->willReturn(new ArrayCollection([$productValue, $imageValue]));
     $storeViewMapping->getTarget('default_locale')->willReturn('default_locale');
     $storeViewMapping->getTarget('fr_FR')->willReturn('fr_fr');
     $categoryMappingManager->getIdFromCategory($category, 'magento_url', $categoryMapping)->willReturn(2);
     $productValueNormalizer->normalize($productValue, Argument::cetera())->willReturn(['value' => 'productValueNormalized']);
     $productValueNormalizer->normalize($imageValue, Argument::cetera())->willReturn(null);
 }
 function it_does_not_report_screenshot_taking_not_supported_errors_on_screen(OutputInterface $output, Session $session, DriverInterface $driver)
 {
     $output->writeln(Argument::cetera())->shouldNotBeCalled();
     $driverInstance = $driver->getWrappedObject();
     $session->getScreenshot()->willThrow(new UnsupportedDriverActionException('Message.', $driverInstance));
     $this->takeScreenshot();
 }
示例#11
0
 public function testPicksTheFirstSuitableResolverToResolveTheGivenValue()
 {
     $value = new FakeValue();
     $fixture = new FakeFixture();
     $set = ResolvedFixtureSetFactory::create();
     $scope = ['scope' => 'epocs'];
     $context = new GenerationContext();
     $context->markIsResolvingFixture('foo');
     $expected = new ResolvedValueWithFixtureSet(10, ResolvedFixtureSetFactory::create(null, null, (new ObjectBag())->with(new SimpleObject('dummy', new \stdClass()))));
     $instantiator1Prophecy = $this->prophesize(ChainableValueResolverInterface::class);
     $instantiator1Prophecy->canResolve($value)->willReturn(false);
     /* @var ChainableValueResolverInterface $instantiator1 */
     $instantiator1 = $instantiator1Prophecy->reveal();
     $instantiator2Prophecy = $this->prophesize(ChainableValueResolverInterface::class);
     $instantiator2Prophecy->canResolve($value)->willReturn(true);
     $instantiator2Prophecy->resolve($value, $fixture, $set, $scope, $context)->willReturn($expected);
     /* @var ChainableValueResolverInterface $instantiator2 */
     $instantiator2 = $instantiator2Prophecy->reveal();
     $instantiator3Prophecy = $this->prophesize(ChainableValueResolverInterface::class);
     $instantiator3Prophecy->canResolve(Argument::any())->shouldNotBeCalled();
     /* @var ChainableValueResolverInterface $instantiator3 */
     $instantiator3 = $instantiator3Prophecy->reveal();
     $registry = new ValueResolverRegistry([$instantiator1, $instantiator2, $instantiator3]);
     $actual = $registry->resolve($value, $fixture, $set, $scope, $context);
     $this->assertSame($expected, $actual);
     $instantiator1Prophecy->canResolve(Argument::any())->shouldHaveBeenCalledTimes(1);
     $instantiator2Prophecy->canResolve(Argument::any())->shouldHaveBeenCalledTimes(1);
     $instantiator2Prophecy->resolve(Argument::cetera())->shouldHaveBeenCalledTimes(1);
 }
 /**
  * @test
  */
 public function exceptionWhileParsingLongUrlOutputsError()
 {
     $this->urlShortener->urlToShortCode(Argument::cetera())->willThrow(new InvalidUrlException())->shouldBeCalledTimes(1);
     $this->commandTester->execute(['command' => 'shortcode:generate', 'longUrl' => 'http://domain.com/invalid']);
     $output = $this->commandTester->getDisplay();
     $this->assertTrue(strpos($output, 'Provided URL "http://domain.com/invalid" is invalid. Try with a different one.') === 0);
 }
示例#13
0
 /**
  * @test
  */
 public function alreadyProcessedElementsAreNotProcessed()
 {
     $url = 'http://foo.com';
     $this->filesystem->exists(sprintf('dir/preview_%s.png', urlencode($url)))->willReturn(true)->shouldBeCalledTimes(1);
     $this->image->saveAs(Argument::cetera())->shouldBeCalledTimes(0);
     $this->assertEquals(sprintf('dir/preview_%s.png', urlencode($url)), $this->generator->generatePreview($url));
 }
 function it_gets_form_from_class_name(Configuration $configuration, FormFactoryInterface $formFactory, FormInterface $form)
 {
     $formClass = 'spec\\Sylius\\Bundle\\ResourceBundle\\Controller\\TestFormType';
     $configuration->getFormType()->willReturn($formClass);
     $formFactory->create(Argument::type($formClass), Argument::cetera())->shouldBeCalled()->willReturn($form);
     $this->getForm()->shouldReturn($form);
 }
 function it_falls_back_to_decorated_template_locator_if_there_are_no_themes_active(FileLocatorInterface $decoratedFileLocator, ThemeContextInterface $themeContext, ThemeHierarchyProviderInterface $themeHierarchyProvider, TemplateReferenceInterface $template)
 {
     $themeContext->getTheme()->willReturn(null);
     $themeHierarchyProvider->getThemeHierarchy(null)->willReturn([]);
     $decoratedFileLocator->locate($template, Argument::cetera())->willReturn('/app/template/path');
     $this->locate($template)->shouldReturn('/app/template/path');
 }
 /**
  * @test
  */
 public function addDataThrowsExceptionOnDatabaseError()
 {
     $this->dbProphecy->exec_SELECTgetRows(Argument::cetera())->willReturn(null);
     $this->dbProphecy->sql_error(Argument::cetera())->willReturn(null);
     $this->setExpectedException(\UnexpectedValueException::class, '', 1440777705);
     $this->subject->addData(['effectivePid' => 1]);
 }
示例#17
0
 public function test_it_returns_false_if_no_url_found()
 {
     $service = $this->prophesize(Service::class);
     $service->getUrl(Argument::any(), Argument::cetera())->shouldBeCalled()->willReturn(false);
     $this->catalog->services = [$service->reveal()];
     $this->assertFalse($this->catalog->getServiceUrl('', '', '', ''));
 }
示例#18
0
 /**
  * @testdox Do a instantiate-hydrate-calls cycle to generate the object described by the fixture.
  */
 public function testGenerate()
 {
     $this->markTestIncomplete('TODO');
     $fixture = new SimpleFixture('dummy', \stdClass::class, SpecificationBagFactory::create());
     $set = ResolvedFixtureSetFactory::create();
     $context = new GenerationContext();
     $context->markIsResolvingFixture('foo');
     $instance = new \stdClass();
     $instantiatedObject = new SimpleObject($fixture->getId(), $instance);
     $instantiatorProphecy = $this->prophesize(InstantiatorInterface::class);
     $instantiatorProphecy->instantiate($fixture, $set, $context)->willReturn($setWithInstantiatedObject = ResolvedFixtureSetFactory::create(null, null, (new ObjectBag())->with($instantiatedObject)));
     /** @var InstantiatorInterface $instantiator */
     $instantiator = $instantiatorProphecy->reveal();
     $hydratedInstance = clone $instance;
     $hydratedInstance->hydrated = true;
     $hydratedObject = new SimpleObject($fixture->getId(), $hydratedInstance);
     $hydratorProphecy = $this->prophesize(HydratorInterface::class);
     $hydratorProphecy->hydrate($instantiatedObject, $setWithInstantiatedObject, $context)->willReturn($setWithHydratedObject = ResolvedFixtureSetFactory::create(null, null, (new ObjectBag())->with($hydratedObject)));
     /** @var HydratorInterface $hydrator */
     $hydrator = $hydratorProphecy->reveal();
     $instanceAfterCalls = clone $hydratedInstance;
     $instanceAfterCalls->calls = true;
     $objectAfterCalls = new SimpleObject($fixture->getId(), $instanceAfterCalls);
     $callerProphecy = $this->prophesize(CallerInterface::class);
     $callerProphecy->doCallsOn($hydratedObject, $setWithHydratedObject)->willReturn($setWithObjectAfterCalls = ResolvedFixtureSetFactory::create(null, null, (new ObjectBag())->with($objectAfterCalls)));
     /** @var CallerInterface $caller */
     $caller = $callerProphecy->reveal();
     $generator = new SimpleObjectGenerator(new FakeValueResolver(), $instantiator, $hydrator, $caller);
     $objects = $generator->generate($fixture, $set, $context);
     $this->assertEquals($setWithObjectAfterCalls->getObjects(), $objects);
     $instantiatorProphecy->instantiate(Argument::cetera())->shouldHaveBeenCalledTimes(1);
     $hydratorProphecy->hydrate(Argument::cetera())->shouldHaveBeenCalledTimes(1);
     $callerProphecy->doCallsOn(Argument::cetera())->shouldHaveBeenCalledTimes(1);
 }
 function it_does_not_add_violations_if_attribute_has_allowed_type($context, AttributeOptionInterface $attributeOption, AttributeInterface $allowedAttribute, AttributeTypeForOption $constraint)
 {
     $attributeOption->getAttribute()->willReturn($allowedAttribute);
     $allowedAttribute->getAttributeType()->willReturn(AttributeTypes::OPTION_SIMPLE_SELECT);
     $context->buildViolation(Argument::cetera())->shouldNotBeCalled();
     $this->validate($attributeOption, $constraint);
 }
示例#20
0
 /**
  * Sets up the entity type manager to be tested.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface[]|\Prophecy\Prophecy\ProphecyInterface[] $definitions
  *   (optional) An array of entity type definitions.
  */
 protected function setUpEntityTypeDefinitions($definitions = [])
 {
     $class = $this->getMockClass(EntityInterface::class);
     foreach ($definitions as $key => $entity_type) {
         // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called
         // by \Drupal\Core\Entity\EntityManager::processDefinition() so it must
         // always be mocked.
         $entity_type->getLinkTemplates()->willReturn([]);
         // Give the entity type a legitimate class to return.
         $entity_type->getClass()->willReturn($class);
         $definitions[$key] = $entity_type->reveal();
     }
     $this->entityTypeManager->getDefinition(Argument::cetera())->will(function ($args) use($definitions) {
         $entity_type_id = $args[0];
         $exception_on_invalid = $args[1];
         if (isset($definitions[$entity_type_id])) {
             return $definitions[$entity_type_id];
         } elseif (!$exception_on_invalid) {
             return NULL;
         } else {
             throw new PluginNotFoundException($entity_type_id);
         }
     });
     $this->entityTypeManager->getDefinitions()->willReturn($definitions);
 }
示例#21
0
 function it_creates_negative_throw_expectations(MatcherManager $matchers, Matcher $matcher, Subject $subject)
 {
     $matchers->find(Argument::cetera())->willReturn($matcher);
     $subject->__call('getWrappedObject', array())->willReturn(new \stdClass());
     $expectation = $this->create('shouldNotThrow', $subject);
     $expectation->shouldHaveType('PhpSpec\\Wrapper\\Subject\\Expectation\\NegativeThrow');
 }
 function it_normalizes_group_type($nomalizer, GroupTypeInterface $groupType)
 {
     $nomalizer->normalize(Argument::cetera())->willReturn([]);
     $groupType->getCode()->willReturn('RELATED');
     $groupType->isVariant()->willReturn(false);
     $this->normalize($groupType)->shouldReturn(['code' => 'RELATED', 'is_variant' => false]);
 }
示例#23
0
 function it_should_add_rule_event_subscriber(FormBuilder $builder, FormFactoryInterface $factory)
 {
     $builder->getFormFactory()->willReturn($factory);
     $builder->add(Argument::any(), Argument::cetera())->willReturn($builder);
     $builder->addEventSubscriber(Argument::type(BuildRuleFormSubscriber::class))->willReturn($builder);
     $this->buildForm($builder, array());
 }
示例#24
0
 /**
  * @test
  */
 public function loader_should_be_called_exact_times()
 {
     $fileLoader = $this->prophesize('Kcs\\Metadata\\Loader\\LoaderInterface');
     $fileLoader->loadClassMetadata(Argument::cetera())->shouldBeCalledTimes(3);
     $loader = new FilesLoaderTestLoader(['test1.yml', 'test2.yml', 'test3.yml'], $fileLoader->reveal());
     $loader->loadClassMetadata($this->prophesize('Kcs\\Metadata\\ClassMetadata')->reveal());
 }
 public function let(Container $container, Translator $translator, Session $session, TopicRepository $topicRepository, EntityRepository $repository, EntityManager $entityManager, Request $request, FormFactory $formFactory, FormBuilder $formBuilder, Form $form, FormView $formView, Topic $topic, CsrfTokenManagerAdapter $csrfTokenManagerAdapter, AbstractQuery $query, AbstractQuery $query2, ParameterBag $parameterBag, ArticleTopicRepository $articleTopicrepository, UserService $userService, User $user, TopicService $topicService, Article $article, QueryBuilder $queryBuilder, CacheService $cacheService, EventDispatcher $dispatcher)
 {
     $container->get('em')->willReturn($entityManager);
     $container->get('session')->willReturn($session);
     $container->get('request')->willReturn($request);
     $container->get('translator')->willReturn($translator);
     $container->get('form.factory')->willReturn($formFactory);
     $container->get('form.csrf_provider')->willReturn($csrfTokenManagerAdapter);
     $container->get('newscoop.cache')->willReturn($cacheService);
     $container->get('user')->willReturn($userService);
     $container->get('dispatcher')->willReturn($dispatcher);
     $userService->getCurrentUser()->willReturn($user);
     $container->get('newscoop_newscoop.topic_service')->willReturn($topicService);
     $formBuilder->getForm(Argument::cetera())->willReturn($form);
     $formFactory->create(Argument::cetera())->willReturn($form);
     $form->createView()->willReturn($formView);
     $form->handleRequest(Argument::cetera())->willReturn(true);
     $form->isValid()->willReturn(true);
     $entityManager->persist(Argument::any())->willReturn(true);
     $entityManager->flush(Argument::any())->willReturn(true);
     $entityManager->remove(Argument::any())->willReturn(true);
     $entityManager->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic')->willReturn($repository);
     $entityManager->getRepository('Newscoop\\Entity\\ArticleTopic')->willReturn($articleTopicrepository);
     $this->setContainer($container);
     $this->token = 'uTxRiEkont4XxRpTcSADPCowge7TgNONE7Y5HWd4pmY';
     $request->get('_csrf_token')->willReturn($this->token);
     $request->get('_code')->willReturn('en');
     $request->get('_articleNumber')->willReturn('64');
     $request->getLocale()->willReturn('en');
     $request->get('_code', 'en')->willReturn('en');
     $request->request = $parameterBag;
 }
 public function testListenerShouldReturnNullOnGenericExceptions()
 {
     $event = $this->prophesize(GetResponseForExceptionEvent::class);
     $event->getException()->willReturn(new \Exception());
     $event->setException(Argument::cetera())->shouldNotBeCalled();
     $this->listener->onKernelException($event->reveal());
 }
 function it_processes_an_heterogeneous_item($serializer, $localeManager)
 {
     $items = [['item1' => ['attr10']], ['item2'], ['item3' => ['attr30', 'attr31']]];
     $localeManager->getActiveCodes()->willReturn([]);
     $serializer->serialize(Argument::cetera())->willReturn('those;items;in;csv;format;');
     $this->process($items)->shouldReturn('those;items;in;csv;format;');
 }
示例#28
0
 public function testCanResolveAFixtureSet()
 {
     $unresolvedFixtureProphecy = $this->prophesize(FixtureInterface::class);
     $unresolvedFixtureProphecy->getId()->willReturn('Nelmio\\Entity\\User#user1');
     /** @var FixtureInterface $unresolvedFixture */
     $unresolvedFixture = $unresolvedFixtureProphecy->reveal();
     $resolvedFixtureProphecy = $this->prophesize(FixtureInterface::class);
     $resolvedFixtureProphecy->getId()->willReturn('Nelmio\\Entity\\User#user1');
     /** @var FixtureInterface $resolvedFixture */
     $resolvedFixture = $resolvedFixtureProphecy->reveal();
     $loadedParameters = new ParameterBag(['foo' => 'bar']);
     $injectedParameters = new ParameterBag(['fou' => 'baz']);
     $unresolvedFixtures = (new FixtureBag())->with($unresolvedFixture);
     $injectedObjects = new ObjectBag(['std' => new \stdClass()]);
     $set = new FixtureSet($loadedParameters, $injectedParameters, $unresolvedFixtures, $injectedObjects);
     $resolvedParameters = new ParameterBag(['foo' => 'bar', 'fou' => 'baz']);
     $parametersResolverProphecy = $this->prophesize(ParameterBagResolverInterface::class);
     $parametersResolverProphecy->resolve($loadedParameters, $injectedParameters)->willReturn($resolvedParameters);
     /** @var ParameterBagResolverInterface $parametersResolver */
     $parametersResolver = $parametersResolverProphecy->reveal();
     $resolvedFixtures = (new FixtureBag())->with($resolvedFixture);
     $fixtureResolverProphecy = $this->prophesize(FixtureBagResolverInterface::class);
     $fixtureResolverProphecy->resolve($unresolvedFixtures)->willReturn($resolvedFixtures);
     /** @var FixtureBagResolverInterface $fixtureResolver */
     $fixtureResolver = $fixtureResolverProphecy->reveal();
     $expected = new ResolvedFixtureSet($resolvedParameters, $resolvedFixtures, $injectedObjects);
     $resolver = new SimpleFixtureSetResolver($parametersResolver, $fixtureResolver);
     $actual = $resolver->resolve($set);
     $this->assertEquals($expected, $actual);
     $parametersResolverProphecy->resolve(Argument::cetera())->shouldHaveBeenCalledTimes(1);
     $fixtureResolverProphecy->resolve(Argument::any())->shouldHaveBeenCalledTimes(1);
 }
 function it_validates_that_a_job_instance_has_a_known_type($jobRegistry, $context, Constraint $constraint, JobInstance $jobInstance, JobInterface $job)
 {
     $jobInstance->getJobName()->willReturn('my_job_name');
     $jobRegistry->get('my_job_name')->willReturn($job);
     $context->buildViolation(Argument::cetera())->shouldNotBeCalled();
     $this->validate($jobInstance, $constraint);
 }
 function it_copies_multi_select_value_to_a_product_value($builder, $attrValidatorHelper, AttributeInterface $fromAttribute, AttributeInterface $toAttribute, ProductInterface $product1, ProductInterface $product2, ProductInterface $product3, ProductInterface $product4, ProductValue $fromProductValue, ProductValue $toProductValue, AttributeOptionInterface $attributeOption)
 {
     $fromLocale = 'fr_FR';
     $toLocale = 'fr_FR';
     $toScope = 'mobile';
     $fromScope = 'mobile';
     $fromAttribute->getCode()->willReturn('fromAttributeCode');
     $toAttribute->getCode()->willReturn('toAttributeCode');
     $attrValidatorHelper->validateLocale(Argument::cetera())->shouldBeCalled();
     $attrValidatorHelper->validateScope(Argument::cetera())->shouldBeCalled();
     $fromProductValue->getOptions()->willReturn([$attributeOption])->shouldBeCalled(3);
     $toProductValue->getOptions()->willReturn([$attributeOption]);
     $toProductValue->removeOption($attributeOption)->shouldBeCalled();
     $toProductValue->addOption($attributeOption)->shouldBeCalled();
     $product1->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product1->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $product2->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn(null);
     $product2->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $product3->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product3->getValue('toAttributeCode', $toLocale, $toScope)->willReturn(null);
     $product4->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product4->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $builder->addProductValue($product3, $toAttribute, $toLocale, $toScope)->shouldBeCalledTimes(1)->willReturn($toProductValue);
     $products = [$product1, $product2, $product3, $product4];
     $this->copyValue($products, $fromAttribute, $toAttribute, $fromLocale, $toLocale, $fromScope, $toScope);
 }