本文整理汇总了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();
}
示例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, []);
}
示例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);
}
示例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]);
}
示例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', '', []);
}
示例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']);
}
示例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());
}
示例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);
}
示例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;');
}
示例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();
}
示例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());
}
示例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');
}
示例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);
}
示例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/'));
}
示例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);
}