当前位置: 首页>>代码示例>>PHP>>正文


PHP Argument::which方法代码示例

本文整理汇总了PHP中Prophecy\Argument::which方法的典型用法代码示例。如果您正苦于以下问题:PHP Argument::which方法的具体用法?PHP Argument::which怎么用?PHP Argument::which使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Prophecy\Argument的用法示例。


在下文中一共展示了Argument::which方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: realpath

 /**
  * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  * @param \Doctrine\Common\Annotations\AnnotationReader $annotationReader
  * @param \FSi\Bundle\AdminBundle\Finder\AdminClassFinder $adminClassFinder
  */
 function it_registers_annotated_admin_classes_as_services($container, $annotationReader, $adminClassFinder)
 {
     $container->getParameter('kernel.bundles')->willReturn(array('FSi\\Bundle\\AdminBundle\\spec\\fixtures\\MyBundle', 'FSi\\Bundle\\AdminBundle\\FSiAdminBundle', 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'));
     $baseDir = __DIR__ . '/../../../../../..';
     $adminClassFinder->findClasses(array(realpath($baseDir . '/spec/fixtures/Admin'), realpath($baseDir . '/Admin')))->willReturn(array('FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\SimpleAdminElement', 'FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\CRUDElement'));
     $annotationReader->getClassAnnotation(Argument::allOf(Argument::type('ReflectionClass'), Argument::which('getName', 'FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\CRUDElement')), 'FSi\\Bundle\\AdminBundle\\Annotation\\Element')->willReturn(null);
     $annotationReader->getClassAnnotation(Argument::allOf(Argument::type('ReflectionClass'), Argument::which('getName', 'FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\SimpleAdminElement')), 'FSi\\Bundle\\AdminBundle\\Annotation\\Element')->willReturn(new Element(array()));
     $container->addResource(Argument::allOf(Argument::type('Symfony\\Component\\Config\\Resource\\DirectoryResource'), Argument::which('getResource', realpath($baseDir . '/spec/fixtures/Admin')), Argument::which('getPattern', '/\\.php$/')))->shouldBeCalled();
     $container->addResource(Argument::allOf(Argument::type('Symfony\\Component\\Config\\Resource\\DirectoryResource'), Argument::which('getResource', realpath($baseDir . '/Admin')), Argument::which('getPattern', '/\\.php$/')))->shouldBeCalled();
     $container->addDefinitions(Argument::that(function ($definitions) {
         if (count($definitions) !== 1) {
             return false;
         }
         /** @var \Symfony\Component\DependencyInjection\Definition $definition */
         $definition = $definitions[0];
         if ($definition->getClass() !== 'FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\SimpleAdminElement') {
             return false;
         }
         if (!$definition->hasTag('admin.element')) {
             return false;
         }
         return true;
     }))->shouldBeCalled();
     $this->process($container);
 }
开发者ID:kbedn,项目名称:admin-bundle,代码行数:30,代码来源:AdminAnnotatedElementPassSpec.php

示例2:

 function it_adds_new_entity_with_field_set(MapBuilder $builder, ResourceRepository $repository, TextType $resource)
 {
     $resource->getName()->willReturn('resources_group.resource_a.en');
     $repository->get('resources_group.resource_a.en')->willReturn(null);
     $builder->getResource(Argument::type('string'))->willReturn($resource);
     $resource->getResourceProperty()->willReturn('textValue');
     $repository->add(Argument::allOf(Argument::type('spec\\FSi\\Bundle\\ResourceRepositoryBundle\\Repository\\ResourceEntity'), Argument::which('getTextValue', 'text')))->shouldBeCalled();
     $this->set('resources_group.resource_a', 'text');
 }
开发者ID:norzechowicz,项目名称:resource-repository-bundle,代码行数:9,代码来源:RepositorySpec.php

示例3: array

 function it_dispatches_ExampleEvent_with_failed_status_if_example_throws_exception(EventDispatcherInterface $dispatcher, ExampleNode $example, ReflectionMethod $exampReflection, SpecificationInterface $context)
 {
     $example->isPending()->willReturn(false);
     $exampReflection->getParameters()->willReturn(array());
     $exampReflection->invokeArgs($context, array())->willThrow('RuntimeException');
     $dispatcher->dispatch('beforeExample', Argument::any())->shouldBeCalled();
     $dispatcher->dispatch('afterExample', Argument::which('getResult', ExampleEvent::BROKEN))->shouldBeCalled();
     $this->run($example);
 }
开发者ID:burimshala,项目名称:numbertowords,代码行数:9,代码来源:ExampleRunnerSpec.php

示例4: it_uploads_speech

 public function it_uploads_speech(UrlGenerator $generator, ClientInterface $client, SpeechContentInterface $speech, StreamInterface $uploadedStream, ResponseInterface $response, Uri $generatedUri)
 {
     $speech->getStream()->willReturn($uploadedStream);
     $speech->getContentType()->willReturn(null);
     $generator->generate($speech)->willReturn($generatedUri);
     $client->upload(Argument::type('Psr\\Http\\Message\\RequestInterface'))->willReturn($response);
     $this->upload($speech)->shouldReturn($response);
     $client->upload(Argument::type('Psr\\Http\\Message\\RequestInterface'))->shouldHaveBeenCalled();
     $client->upload(Argument::which('getBody', $uploadedStream->getWrappedObject()))->shouldHaveBeenCalled();
 }
开发者ID:zloesabo,项目名称:speechkit-php,代码行数:10,代码来源:UploaderSpec.php

示例5: array

 function it_decorates_expectation_with_broken_event(ExpectationInterface $expectation, EventDispatcherInterface $dispatcher)
 {
     $alias = 'be';
     $subject = new \stdClass();
     $arguments = array();
     $expectation->match(Argument::cetera())->willThrow('\\RuntimeException');
     $dispatcher->dispatch('beforeExpectation', Argument::type('PhpSpec\\Event\\ExpectationEvent'))->shouldBeCalled();
     $dispatcher->dispatch('afterExpectation', Argument::which('getResult', ExpectationEvent::BROKEN))->shouldBeCalled();
     $this->shouldThrow('\\RuntimeException')->duringMatch($alias, $subject, $arguments);
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:10,代码来源:DispatcherDecoratorSpec.php

示例6: SkippingException

 function it_dispatches_ExampleEvent_with_failed_status_if_example_throws_an_error(EventDispatcherInterface $dispatcher, ExampleNode $example, ReflectionMethod $exampReflection, Specification $context)
 {
     if (!class_exists('\\Error')) {
         throw new SkippingException('The class Error, introduced in PHP 7, does not exist');
     }
     $example->isPending()->willReturn(false);
     $exampReflection->getParameters()->willReturn(array());
     $exampReflection->invokeArgs($context, array())->willThrow('Error');
     $dispatcher->dispatch('beforeExample', Argument::any())->shouldBeCalled();
     $dispatcher->dispatch('afterExample', Argument::which('getResult', ExampleEvent::BROKEN))->shouldBeCalled();
     $this->run($example);
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:12,代码来源:ExampleRunnerSpec.php

示例7: Request

 /**
  * @param \FSi\Bundle\AdminSecurityBundle\Model\UserPasswordResetInterface $user
  * @param \Twig_Environment $twig
  * @param \Twig_Template $template
  * @param \Swift_Mailer $mailer
  * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
  */
 function it_should_render_template($user, $twig, $template, $mailer, $requestStack)
 {
     $request = new Request(array(), array(), array(), array(), array(), array('HTTP_USER_AGENT' => 'user agent', 'REMOTE_ADDR' => '192.168.99.99'));
     $requestStack->getMasterRequest()->willReturn($request);
     $templateParameters = array('user' => $user, 'ip' => '192.168.99.99', 'user_agent' => 'user agent');
     $twig->mergeGlobals($templateParameters)->willReturn($templateParameters);
     $twig->loadTemplate('mailer-template.html.twig')->willReturn($template);
     $template->renderBlock('subject', $templateParameters)->willReturn('subject string');
     $template->renderBlock('body_html', $templateParameters)->willReturn('body string');
     $user->getEmail()->willReturn('user@example.com');
     $mailer->send(Argument::allOf(Argument::type('\\Swift_Message'), Argument::which('getSubject', 'subject string'), Argument::which('getTo', array('user@example.com' => null)), Argument::which('getFrom', array('from@fsi.pl' => null)), Argument::which('getReplyTo', array('replay-to@fsi.pl' => null)), Argument::which('getBody', 'body string')))->willReturn(1);
     $this->sendPasswordResetMail($user)->shouldReturn(1);
 }
开发者ID:szymach,项目名称:admin-security-bundle,代码行数:20,代码来源:MailerSpec.php

示例8: test_it_will_return_an_hand_that_matches_the_search_null_otherwise

 public function test_it_will_return_an_hand_that_matches_the_search_null_otherwise()
 {
     $handSearch = $this->prophesize(HandSearch::class);
     $handSearch->search(Argument::cetera())->willReturn(new Hand(...[]));
     $hand = new Hand(...StaticFixtures::straight());
     $handSearch->search(Argument::which('getFaceValue', 3), Argument::cetera())->willReturn(new Hand(new Card(3, Suit::spades())))->shouldBeCalled();
     $handSearch->search(Argument::which('getFaceValue', 4), Argument::cetera())->willReturn(new Hand(new Card(4, Suit::flowers())))->shouldBeCalled();
     $handSearch->search(Argument::which('getFaceValue', 5), Argument::cetera())->willReturn(new Hand(new Card(5, Suit::spades())))->shouldBeCalled();
     $handSearch->search(Argument::which('getFaceValue', 6), Argument::cetera())->willReturn(new Hand(new Card(6, Suit::spades())))->shouldBeCalled();
     $handSearch->search(Argument::which('getFaceValue', 7), Argument::cetera())->willReturn(new Hand(new Card(7, Suit::spades())))->shouldBeCalled();
     $handSearch->search(Argument::any(), Argument::cetera())->willReturn(null);
     $finder = new StraightFinder($handSearch->reveal());
     $this->assertEquals($hand, $finder->find($hand));
 }
开发者ID:ranpafin,项目名称:phpoker,代码行数:14,代码来源:StraightFinderTest.php

示例9: it_should_return_a_result

 /**
  * @param \Phpro\SmartCrud\Gateway\CrudGatewayInterface $gateway
  * @param \Zend\EventManager\EventManager               $eventManager
  * @param \Phpro\SmartCrud\Service\SmartServiceResult   $result
  */
 public function it_should_return_a_result($gateway, $eventManager, $result)
 {
     $entity = new \StdClass();
     $entity->id = 1;
     $postData = null;
     $gateway->loadEntity('entityKey', $entity->id)->shouldBecalled()->willReturn($entity);
     $result->setSuccess(Argument::any())->shouldBeCalled();
     $result->setForm(Argument::any())->shouldNotBeCalled();
     $result->setEntity($entity)->shouldBeCalled();
     $this->setEntityKey('entityKey');
     $this->setGateway($gateway);
     $this->setResult($result);
     $this->run($entity->id, $postData)->shouldReturn($result);
     $eventManager->trigger(Argument::which('getName', CrudEvent::BEFORE_DATA_VALIDATION))->shouldNotBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::BEFORE_READ))->shouldBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::AFTER_READ))->shouldBeCalled();
 }
开发者ID:phpro,项目名称:zf-smartcrud,代码行数:22,代码来源:ReadServiceSpec.php

示例10: it_should_handle_valid_data

 /**
  * @param \Phpro\SmartCrud\Gateway\CrudGatewayInterface $gateway
  * @param \Zend\EventManager\EventManager               $eventManager
  * @param \Zend\Form\Form                               $form
  * @param \Phpro\SmartCrud\Service\SmartServiceResult   $result
  */
 public function it_should_handle_valid_data($gateway, $eventManager, $form, $result)
 {
     $entity = new \StdClass();
     $postData = $this->getMockPostData();
     $gateway->loadEntity('entityKey', null)->shouldBecalled()->willReturn($entity);
     $gateway->delete($entity, $postData)->shouldBecalled()->willReturn(true);
     $result->setSuccess(true)->shouldBeCalled();
     $result->setEntity($entity)->shouldBeCalled();
     $this->setEntityKey('entityKey');
     $this->setGateway($gateway);
     $this->setResult($result);
     $this->setForm($form);
     $this->run(null, $this->getMockPostData())->shouldReturn($result);
     $eventManager->trigger(Argument::which('getName', CrudEvent::INVALID_DELETE))->shouldNotBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::BEFORE_DELETE))->shouldBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::AFTER_DELETE))->shouldBeCalled();
 }
开发者ID:phpro,项目名称:zf-smartcrud,代码行数:23,代码来源:DeleteServiceSpec.php

示例11: test

 public function test()
 {
     $relationProviders = array(new RelationProviderConfiguration('getRelations'), new RelationProviderConfiguration('Class:getRelations'));
     $relations1 = array($relation1 = new Relation('foo'));
     $relations2 = array($relation2 = new Relation('bar'));
     $classMetadataProphecy = $this->prophesize('Hateoas\\Configuration\\Metadata\\ClassMetadataInterface');
     $classMetadataProphecy->getRelationProviders()->willReturn($relationProviders);
     $metadataFactoryProphecy = $this->prophesize('Metadata\\MetadataFactoryInterface');
     $metadataFactoryProphecy->getMetadataForClass('stdClass')->willReturn($classMetadataProphecy->reveal());
     $resolverProphecy = $this->prophesize('Hateoas\\Configuration\\Provider\\Resolver\\RelationProviderResolverInterface');
     $resolverProphecy->getRelationProvider(Argument::which('getName', 'getRelations'), Argument::any())->willReturn(function () use($relations1) {
         return $relations1;
     });
     $resolverProphecy->getRelationProvider(Argument::which('getName', 'Class:getRelations'), Argument::any())->willReturn(function () use($relations2) {
         return $relations2;
     });
     $relationProvider = new RelationProvider($metadataFactoryProphecy->reveal(), $resolverProphecy->reveal());
     $object = new \StdClass();
     $this->assertSame([$relation1, $relation2], $relationProvider->getRelations($object));
 }
开发者ID:jmcclell,项目名称:Hateoas,代码行数:20,代码来源:RelationProviderTest.php

示例12: testThrowsExceptionWithFailedUpload

 /**
  * @expectedException Google\Cloud\Exception\GoogleException
  */
 public function testThrowsExceptionWithFailedUpload()
 {
     $resumeUriResponse = new Response(200, ['Location' => 'theResumeUri']);
     $this->requestWrapper->send(Argument::which('getMethod', 'POST'), Argument::type('array'))->willReturn($resumeUriResponse);
     $this->requestWrapper->send(Argument::which('getMethod', 'PUT'), Argument::type('array'))->willThrow('Google\\Cloud\\Exception\\GoogleException');
     $uploader = new ResumableUploader($this->requestWrapper->reveal(), $this->stream, 'http://www.example.com');
     $uploader->upload();
 }
开发者ID:GoogleCloudPlatform,项目名称:gcloud-php,代码行数:11,代码来源:ResumableUploaderTest.php

示例13: Car

 function it_dispatches_event_when_given_a_labelled_fixture($dispatcher)
 {
     $dispatcher->dispatch('fixture.resolve.Car:kitt', Argument::which('getReference', 'Car:kitt'))->shouldBeCalled();
     $this->set('kitt', new Car());
 }
开发者ID:robmasters,项目名称:filler,代码行数:5,代码来源:DependencyManagerSpec.php

示例14:

 function it_applies_more_than_date_range_filter(FilterDatasourceAdapterInterface $datasource, \DateTime $start, \DateTime $end, $utility)
 {
     $start->setTimezone(Argument::allOf(Argument::type('\\DateTimeZone'), Argument::which('getName', 'UTC')))->shouldBeCalled();
     $end->setTimezone(Argument::allOf(Argument::type('\\DateTimeZone'), Argument::which('getName', 'UTC')))->shouldBeCalled();
     $start->format('Y-m-d')->willReturn('1987-05-14');
     $end->format('Y-m-d')->willReturn('2014-01-23');
     $utility->applyFilter($datasource, 'data_name_key', '>', '1987-05-14')->shouldBeCalled();
     $this->apply($datasource, ['value' => ['start' => $start, 'end' => $end], 'type' => DateRangeFilterType::TYPE_MORE_THAN]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:9,代码来源:DateRangeFilterSpec.php

示例15: isAnArrayContainingAReferenceAndAPriority

 private function isAnArrayContainingAReferenceAndAPriority($service, $priority)
 {
     return Argument::allOf(Argument::withEntry(0, Argument::allOf(Argument::type('Symfony\\Component\\DependencyInjection\\Reference'), Argument::which('__toString', $service))));
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:4,代码来源:RegisterComparatorsPassSpec.php


注:本文中的Prophecy\Argument::which方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。