當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Prophecy\Argument類代碼示例

本文整理匯總了PHP中Prophecy\Argument的典型用法代碼示例。如果您正苦於以下問題:PHP Argument類的具體用法?PHP Argument怎麽用?PHP Argument使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Argument類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: let

 function let(ObjectManager $om, ObjectRepository $or)
 {
     // It is not possible to mock internal classes with final constructor
     $this->beConstructedWith(new \SimpleXMLElement('<row></row>'), $om);
     $om->getRepository(Argument::type('string'))->willReturn($or);
     $or->findOneBy(Argument::type('array'))->willReturn();
 }
開發者ID:jacdobro,項目名稱:teryt-database-bundle,代碼行數:7,代碼來源:StreetsNodeConverterSpec.php

示例2:

 function it_builds_form_with_proper_fields(FormBuilder $builder)
 {
     $builder->add('name', 'text', Argument::any())->shouldBeCalled()->willReturn($builder);
     $builder->add('abbreviation', 'text', Argument::any())->shouldBeCalled()->willReturn($builder);
     $builder->addEventSubscriber(Argument::type(AddCodeFormSubscriber::class))->shouldBeCalled()->willReturn($builder);
     $this->buildForm($builder, []);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:7,代碼來源:ProvinceTypeSpec.php

示例3:

 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);
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:7,代碼來源:NotificationControllerSpec.php

示例4:

 function it_marks_a_variant_group_as_updated_when_its_attributes_are_removed_or_updated($registry, EntityManager $em, ProductTemplateInterface $productTemplate, GroupInterface $group, GroupRepositoryInterface $groupRepo)
 {
     $productTemplate->getId()->willReturn(956);
     $registry->getRepository(Argument::type('string'))->willReturn($groupRepo);
     $groupRepo->getVariantGroupByProductTemplate($productTemplate)->willReturn($group);
     $this->guessUpdates($em, $productTemplate, UpdateGuesserInterface::ACTION_UPDATE_ENTITY)->shouldReturn([$group]);
 }
開發者ID:abdeldayem,項目名稱:pim-community-dev,代碼行數:7,代碼來源:VariantGroupUpdateGuesserSpec.php

示例5:

 function it_does_not_filters_when_data_id_is_not_defined(DataSourceInterface $dataSource, ExpressionBuilderInterface $expressionBuilder)
 {
     $dataSource->getExpressionBuilder()->willReturn($expressionBuilder);
     $expressionBuilder->equals('entity', Argument::any())->shouldNotBeCalled();
     $dataSource->restrict(Argument::any())->shouldNotBeCalled();
     $this->apply($dataSource, 'entity', '', []);
 }
開發者ID:NeverResponse,項目名稱:Sylius,代碼行數:7,代碼來源:EntityFilterSpec.php

示例6:

 function it_builds_form(FormBuilder $builder, FormFactoryInterface $factory)
 {
     $builder->add('type', 'sylius_promotion_rule_choice', Argument::type('array'))->willReturn($builder);
     $builder->getFormFactory()->willReturn($factory);
     $builder->addEventSubscriber(Argument::type(BuildRuleFormSubscriber::class))->shouldBeCalled();
     $this->buildForm($builder, ['configuration_type' => 'configuration_form_type']);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:7,代碼來源:RuleTypeSpec.php

示例7: array

 function it_builds_a_form(FormBuilderInterface $builder)
 {
     $builder->add('first_item_cost', 'sylius_money', Argument::withKey('constraints'))->shouldBeCalled()->willReturn($builder);
     $builder->add('additional_item_cost', 'sylius_money', Argument::withKey('constraints'))->shouldBeCalled()->willReturn($builder);
     $builder->add('additional_item_limit', 'integer', Argument::withKey('constraints'))->shouldBeCalled()->willReturn($builder);
     $this->buildForm($builder, array());
 }
開發者ID:Silwereth,項目名稱:Sylius,代碼行數:7,代碼來源:FlexibleRateConfigurationTypeSpec.php

示例8: let

 function let(MetadataRendererInterface $universalRenderer, OptionsResolver $optionsResolver, PropertyAccessorInterface $propertyAccessor)
 {
     $this->beConstructedWith($universalRenderer, $optionsResolver, $propertyAccessor);
     $optionsResolver->setDefaults(Argument::type('array'))->willReturn($optionsResolver);
     $optionsResolver->setAllowedValues(Argument::any(), Argument::type('array'))->willReturn($optionsResolver);
     $optionsResolver->setAllowedTypes(Argument::any(), Argument::any())->willReturn($optionsResolver);
 }
開發者ID:sidibea,項目名稱:Sylius,代碼行數:7,代碼來源:PageMetadataRendererSpec.php

示例9:

 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;');
 }
開發者ID:qrz-io,項目名稱:pim-community-dev,代碼行數:7,代碼來源:HomogeneousProcessorSpec.php

示例10: getVariantImageMock

 /**
  * Get variant image resolver mock.
  *
  * @param ImageInterface|false $image Image
  *
  * @return VariantImageResolver
  */
 protected function getVariantImageMock($image)
 {
     $variantImageResolver = $this->prophesize('Elcodi\\Component\\Product\\ImageResolver\\VariantImageResolver');
     $variantImageResolver->getValidImage(Argument::any())->willReturn($image);
     $variantImageResolver->getPurchasableNamespace()->willReturn('Elcodi\\Component\\Product\\Entity\\Interfaces\\VariantInterface');
     return $variantImageResolver->reveal();
 }
開發者ID:IRlyDontKnow,項目名稱:elcodi,代碼行數:14,代碼來源:AbstractImageResolverTest.php

示例11: let

 function let(GroupRepositoryInterface $groupRepository, DenormalizerInterface $denormalizer, ValidatorInterface $validator, ObjectDetacherInterface $detacher, StepExecution $stepExecution)
 {
     $groupClass = 'Pim\\Bundle\\CatalogBundle\\Entity\\Group';
     $this->beConstructedWith($groupRepository, $denormalizer, $validator, $detacher, $groupClass, 'csv');
     $this->setStepExecution($stepExecution);
     $validator->validate(Argument::any())->willReturn(new ConstraintViolationList());
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:7,代碼來源:GroupProcessorSpec.php

示例12:

 function it_hydrates_a_result_record(Builder $builder, Query $query, ProductInterface $product, Association $association, AssociationType $associationType, ProductInterface $associatedProduct1, ProductInterface $associatedProduct2, DocumentManager $documentManager, \Doctrine\ODM\MongoDB\Mapping\ClassMetadata $metadata, Collection $collection, ArrayIterator $arrayIterator)
 {
     $options = ['locale_code' => 'en_US', 'scope_code' => 'print', 'current_group_id' => null, 'attributes_configuration' => [], 'association_type_id' => 1, 'current_product' => $product];
     $builder->getQuery()->willReturn($query);
     $builder->hydrate(false)->willReturn($builder);
     $associatedProduct1->getId()->willReturn('550ae6b98ead0ed7778b46bb');
     $associatedProduct2->getId()->willReturn('550ae6b98abd0ec8778b46bb');
     $product->getAssociations()->willReturn([$association]);
     $association->getAssociationType()->willReturn($associationType);
     $associationType->getId()->willReturn(1);
     $association->getProducts()->willReturn([$associatedProduct1, $associatedProduct2]);
     $queryDefinition = ['type' => 1, 'sort' => ['normalizedData.is_associated' => -1, '_id' => 1], 'limit' => 10, 'skip' => 0, 'query' => ['_id' => ['$ne' => \MongoId::__set_state(['$id' => '550ae6b98ead0ee8778b46bb'])]], 'newObj' => []];
     $query->getQuery()->willReturn($queryDefinition);
     $query->getDocumentManager()->willReturn($documentManager);
     $documentManager->getDocumentCollection(Argument::any())->willReturn($collection);
     $documentManager->getClassMetadata(Argument::any())->willReturn($metadata);
     $metadata->getFieldNames()->willReturn(['id', 'created', 'updated', 'locale', 'scope', 'values', 'indexedValues', 'indexedValuesOutdated', 'family', 'familyId', 'categories', 'categoryIds', 'enabled', 'groups', 'groupIds', 'associations', 'completenesses', 'normalizedData']);
     $pipeline = [['$match' => ['_id' => ['$ne' => \MongoId::__set_state(['$id' => '550ae6b98ead0ee8778b46bb'])]]], ['$project' => ['id' => 1, 'created' => 1, 'updated' => 1, 'locale' => 1, 'scope' => 1, 'values' => 1, 'indexedValues' => 1, 'indexedValuesOutdated' => 1, 'family' => 1, 'familyId' => 1, 'categories' => 1, 'categoryIds' => 1, 'enabled' => 1, 'groups' => 1, 'groupIds' => 1, 'associations' => 1, 'completenesses' => 1, 'normalizedData' => 1, 'is_associated' => ['$cond' => [['$or' => [['$eq' => ['$_id', \MongoId::__set_state(['$id' => '550ae6b98ead0ed7778b46bb'])]], ['$eq' => ['$_id', \MongoId::__set_state(['$id' => '550ae6b98abd0ec8778b46bb'])]]]], 1, 0]]]], ['$sort' => ['is_associated' => -1]], ['$skip' => 0], ['$limit' => 10]];
     $collection->aggregate($pipeline)->willReturn($arrayIterator);
     $fixture = ['_id' => \MongoId::__set_state(['$id' => '550ae6b98ead0ee8778b46bb']), 'normalizedData' => [], 'sku' => ['attribute' => ['code' => 'sku', 'attributeType' => 'text', 'backendType' => 'text'], 'locale' => null, 'scope' => null, 'value' => 'mysku'], 'name' => ['attribute' => ['code' => 'name', 'attributeType' => 'text', 'backendType' => 'text'], 'locale' => 'fr_FR', 'scope' => null], 'desc' => ['attribute' => ['code' => 'desc', 'attributeType' => 'text', 'backendType' => 'text'], 'locale' => 'fr_FR', 'scope' => 'print'], 'is_associated' => 1];
     $arrayIterator->toArray()->willReturn([$fixture]);
     $rows = $this->hydrate($builder, $options);
     $rows->shouldHaveCount(1);
     $firstResult = $rows[0];
     $firstResult->shouldBeAnInstanceOf('\\Oro\\Bundle\\DataGridBundle\\Datasource\\ResultRecord');
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:26,代碼來源:AssociatedProductHydratorSpec.php

示例13:

 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);
 }
開發者ID:phpguard,項目名稱:phpguard,代碼行數:7,代碼來源:ConfigurationListenerSpec.php

示例14: getProphetClient

 /**
  * @param mixed $params
  * @param bool $isArray
  * @return JsonRpcClient
  */
 private function getProphetClient($params, $isArray)
 {
     $guzzle = $this->prophesize(ClientInterface::class);
     $self = $this;
     $guzzle->sendAsync(Argument::type(RequestInterface::class))->will(function ($args) use($self, $params, $isArray) {
         /** @var RequestInterface $request */
         $request = $args[0];
         $content = $request->getBody()->getContents();
         $data = json_decode($content);
         if ($isArray) {
             $self::assertTrue(is_array($data));
             $self::assertNotEmpty($data);
             $data = array_shift($data);
         }
         $self::assertEquals(JSON_ERROR_NONE, json_last_error());
         $self::assertObjectHasAttribute('id', $data);
         $self::assertObjectHasAttribute('method', $data);
         $self::assertObjectHasAttribute('params', $data);
         $self::assertObjectHasAttribute('jsonrpc', $data);
         $self::assertEquals('test', $data->id);
         $self::assertEquals('2.0', $data->jsonrpc);
         $self::assertEquals('test', $data->method);
         $self::assertEquals($params, $data->params);
         return new Promise(function () {
         }, function () {
         });
     });
     return new JsonRpcClient($guzzle->reveal(), new Uri('http://localhost/'));
 }
開發者ID:scaytrase,項目名稱:json-rpc-client,代碼行數:34,代碼來源:JsonRpcClientTest.php

示例15:

 function it_has_options(OptionsResolver $resolver)
 {
     $resolver->setDefaults(Argument::withKey('choice_list'))->shouldBeCalled()->willReturn($resolver);
     $resolver->setRequired(['variable'])->shouldBeCalled()->willReturn($resolver);
     $resolver->setAllowedTypes('variable', VariableInterface::class)->shouldBeCalled()->willReturn($resolver);
     $this->configureOptions($resolver);
 }
開發者ID:okwinza,項目名稱:Sylius,代碼行數:7,代碼來源:VariantChoiceTypeSpec.php


注:本文中的Prophecy\Argument類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。