本文整理汇总了PHP中Prophecy\Argument::type方法的典型用法代码示例。如果您正苦于以下问题:PHP Argument::type方法的具体用法?PHP Argument::type怎么用?PHP Argument::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prophecy\Argument
的用法示例。
在下文中一共展示了Argument::type方法的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_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]);
}
示例4:
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);
}
示例5: it_should_add_default_options_when_making_a_call
public function it_should_add_default_options_when_making_a_call($client, $request)
{
$request->getOptions()->shouldBeCalled()->willReturn([]);
$request->setOptions(Argument::type('array'))->shouldBeCalled();
$client->makeCall($request->getWrappedObject()->getFullUrl(), $request->getWrappedObject()->getHeaders(), [])->shouldBeCalled()->willReturn(['headers' => [], 'status' => 200, 'body' => '{"pubstatus": "usable", "_links": {"parent": {"href": "/", "title": "home"}, "collection": {"href": "items", "title": "items"}, "self": {"href": "items/tag:example.com,0001:newsml_BRE9A607", "title": "Item"}}, "body_text": "Andromeda and Milky Way will collide in about 2 billion years", "type": "text", "language": "en", "versioncreated": "2015-03-09T16:32:23+0000", "uri": "http://api.master.dev.superdesk.org/items/tag%3Aexample.com%2C0001%3Anewsml_BRE9A607", "version": "2", "headline": "Andromeda on a collision course"}']);
$this->makeApiCall($request);
}
示例6: 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);
}
示例7:
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']);
}
示例8: array
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());
}
示例9:
function it_lists_user_notifications_linked_to_the_current_user($userNotifRepository, $context, $templating, UserInterface $user, UserNotificationInterface $userNotification, Request $request)
{
$context->getUser()->willReturn($user);
$userNotifRepository->findBy(['user' => $user], ['id' => 'DESC'], 10, null)->willReturn([$userNotification]);
$templating->renderResponse('PimNotificationBundle:Notification:list.json.twig', ['userNotifications' => [$userNotification]], Argument::type('Symfony\\Component\\HttpFoundation\\JsonResponse'))->shouldBeCalled();
$this->listAction($request);
}
示例10: testCallBasicMethods
/**
* @dataProvider methodProvider
*/
public function testCallBasicMethods($method, $args, $expectedArgs)
{
$this->requestWrapper->send(Argument::type('callable'), $expectedArgs, Argument::type('array'))->willReturn($this->successMessage);
$grpc = new Grpc();
$grpc->setRequestWrapper($this->requestWrapper->reveal());
$this->assertEquals($this->successMessage, $grpc->{$method}($args));
}
示例11: array
function it_should_build_form_with_proper_fields(FormBuilder $builder)
{
$builder->add('description', 'textarea', Argument::any())->shouldBeCalled()->willReturn($builder);
$builder->add('parent', 'sylius_permission_choice', Argument::any())->shouldBeCalled()->willReturn($builder);
$builder->addEventListener(FormEvents::PRE_SET_DATA, Argument::type('closure'))->shouldBeCalled()->willReturn($builder);
$this->buildForm($builder, array());
}
示例12: testListenerShouldReturnBadRequestException
public function testListenerShouldReturnBadRequestException()
{
$event = $this->prophesize(GetResponseForExceptionEvent::class);
$event->getException()->willReturn(new ParamValidationFailedException(new ConstraintViolationList()));
$event->setException(Argument::type(BadRequestHttpException::class))->shouldBeCalled();
$this->listener->onKernelException($event->reveal());
}
示例13:
function it_render_template_with_paginator(EngineInterface $templating, Response $response, GalleryManagerInterface $galleryManager, AdapterInterface $adapter)
{
$galleryManager->createPagerfantaAdapter()->willReturn($adapter);
$adapter->getNbResults()->willReturn(5);
$templating->renderResponse('FSiGalleryBundle:Gallery:list.html.twig', Argument::allOf(Argument::withEntry('galleries', Argument::type('Pagerfanta\\Pagerfanta')), Argument::withEntry('preview_photos_count', 4)))->willReturn($response);
$this->listAction(2)->shouldReturn($response);
}
示例14:
function it_tries_to_remove_a_coupon_and_catches_exception_in_case_of_failure(SharedStorageInterface $sharedStorage, RepositoryInterface $couponRepository, CouponInterface $coupon)
{
$coupon->getId()->willReturn(5);
$couponRepository->remove($coupon)->willThrow(ForeignKeyConstraintViolationException::class);
$sharedStorage->set('last_exception', Argument::type(ForeignKeyConstraintViolationException::class))->shouldBeCalled();
$this->iTryToDeleteCoupon($coupon);
}
示例15:
function it_builds_a_form(FormBuilderInterface $builder)
{
$builder->add('id', 'text', Argument::type('array'))->willReturn($builder);
$builder->add('title', 'text', Argument::type('array'))->willReturn($builder);
$builder->add('body', 'textarea', Argument::type('array'))->willReturn($builder);
$this->buildForm($builder);
}