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


PHP Prophet::prophesize方法代码示例

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


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

示例1: prophesize

 /**
  * @param string|null $classOrInterface
  * @return \Prophecy\Prophecy\ObjectProphecy
  * @throws \LogicException
  */
 protected function prophesize($classOrInterface = null)
 {
     if (null === $this->prophet) {
         throw new \LogicException(sprintf('The setUp method of %s must be called to initialize Prophecy.', __CLASS__));
     }
     return $this->prophet->prophesize($classOrInterface);
 }
开发者ID:melanc,项目名称:devel,代码行数:12,代码来源:ProphecyTestCase.php

示例2: getAnnotationsExtractorResults

 protected function getAnnotationsExtractorResults()
 {
     $extractorResultProphecy = $this->prophet->prophesize('Team3\\PayU\\PropertyExtractor\\ExtractorResult');
     $extractorResultProphecy->getPropertyName()->willReturn($this->getPropertyName());
     $extractorResultProphecy->getValue()->willReturn($this->getValue());
     return [$extractorResultProphecy];
 }
开发者ID:krzysztof-gzocha,项目名称:payu,代码行数:7,代码来源:UserOrderTransformerSpec.php

示例3: createBinary

 /**
  * Create a binary mock.
  *
  * @param $name
  * @param $supported
  * @param $exists
  */
 public function createBinary($name, $supported, $exists)
 {
     $binary = $this->prophet->prophesize('Peridot\\WebDriverManager\\Binary\\BinaryInterface');
     $binary->isSupported()->willReturn($supported);
     $binary->getName()->willReturn($name);
     $binary->exists(Argument::any())->willReturn($exists);
     return $binary;
 }
开发者ID:peridot-php,项目名称:webdriver-manager,代码行数:15,代码来源:BinaryHelper.php

示例4: mockFlashMessenger

 /**
  * Mock the flashmessenger
  *
  * @param $flashMessenger
  */
 protected function mockFlashMessenger($flashMessenger)
 {
     $prophet = new Prophet();
     $serviceManager = $prophet->prophesize('\\Zend\\ServiceManager\\ServiceManager');
     $pluginManager = $prophet->prophesize('\\Zend\\Mvc\\Controller\\PluginManager');
     $serviceManager->get('ControllerPluginManager')->willReturn($pluginManager);
     $pluginManager->get('flashmessenger')->willReturn($flashMessenger->getWrappedObject());
     $this->createService($serviceManager);
 }
开发者ID:phpro,项目名称:zf-smartcrud,代码行数:14,代码来源:FlashMessengerSpec.php

示例5: it_should_not_replace_request_param_if_format_is_not_supported

 public function it_should_not_replace_request_param_if_format_is_not_supported()
 {
     $requestParam = $this->prophet->prophesize('Symfony\\Component\\HttpFoundation\\ParameterBag');
     $request = Request::create('/');
     $request->request = $requestParam->reveal();
     $requestParam->replace(Argument::any())->shouldNotBeCalled();
     $this->decoderProvider->supports(Argument::any())->willReturn(false);
     $this->__invoke($request);
 }
开发者ID:bcen,项目名称:silex-dispatcher,代码行数:9,代码来源:DeserializerSpec.php

示例6: let

 public function let()
 {
     $this->prophet = new Prophet();
     $this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
     $this->formatNegotiator = $this->prophet->prophesize('FOS\\Rest\\Util\\FormatNegotiator');
     $this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
     $this->route->getOption(RouteOptions::REST)->willReturn(true);
     $this->routes->get(Argument::any())->willReturn($this->route->reveal());
     $this->beConstructedWith($this->routes->reveal(), $this->formatNegotiator->reveal());
 }
开发者ID:bcen,项目名称:silex-dispatcher,代码行数:10,代码来源:ContentNegotiatorSpec.php

示例7: setUp

 public function setUp()
 {
     unset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']);
     $prophet = new Prophet();
     $this->packageManagerProphecy = $prophet->prophesize(PackageManager::class);
     $this->dbProphecy = $prophet->prophesize(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
     $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
     $this->updateWizard = new UpdateWizard();
     ExtensionManagementUtility::setPackageManager($this->packageManagerProphecy->reveal());
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:10,代码来源:ContentTypesToTextMediaUpdateTest.php

示例8: setUp

 /**
  *
  */
 protected function setUp()
 {
     $prophet = new Prophet();
     $this->prophet = $prophet;
     $this->formatter = $this->prophet->prophesize(FormatterInterface::class);
     $this->writer = $this->prophet->prophesize(WriterInterface::class);
     $this->dumper = new Dumper();
     $this->dumper->setFormatter($this->formatter->reveal());
     $this->dumper->setWriter($this->writer->reveal());
 }
开发者ID:glooby,项目名称:debug-bundle,代码行数:13,代码来源:DumperTestTest.php

示例9: let

 public function let()
 {
     $this->prophet = new Prophet();
     $this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
     $this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
     $this->event = $this->prophet->prophesize('Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent');
     $this->route->getOption(RouteOptions::REST)->willReturn(true);
     $this->routes->get(Argument::any())->willReturn($this->route->reveal());
     $this->beConstructedWith($this->routes->reveal());
 }
开发者ID:bcen,项目名称:silex-dispatcher,代码行数:10,代码来源:PaginationListenerSpec.php

示例10: it_can_match_repeating_multiple_segments

 public function it_can_match_repeating_multiple_segments()
 {
     $prophet = new Prophet();
     $httpProphecy = $prophet->prophesize('Zend\\Uri\\Http');
     $httpProphecy->getPath()->willReturn('/a/foo/bar/b/c/bar/bass/d');
     $requestProphecy = $prophet->prophesize('Zend\\Http\\PhpEnvironment\\Request');
     $requestProphecy->getUri()->willReturn($httpProphecy->reveal());
     $this->beConstructedWith('/a[section]/b/c[other_section]/d', ['section' => '/[a-zA-Z][a-zA-Z0-9_-]+', 'other_section' => '/[a-zA-Z][a-zA-Z0-9_-]+'], ['controller' => 'Controller', 'action' => 'create']);
     $this->match($requestProphecy->reveal())->shouldReturnAnInstanceOf('Zend\\Mvc\\Router\\Http\\RouteMatch');
 }
开发者ID:Tohmua,项目名称:RepeatingSegment,代码行数:10,代码来源:RepeatingSegmentSpec.php

示例11: let

 public function let()
 {
     $this->prophet = new Prophet();
     $this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
     $this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
     $this->annotationResourceOption = $this->prophet->prophesize('SDispatcher\\Common\\AnnotationResourceOption');
     $this->route->getOption(RouteOptions::REST)->willReturn(true);
     $this->routes->get(Argument::any())->willReturn($this->route->reveal());
     $this->beConstructedWith($this->routes->reveal(), $this->annotationResourceOption->reveal());
 }
开发者ID:bcen,项目名称:silex-dispatcher,代码行数:10,代码来源:RouteOptionInspectorSpec.php

示例12: Prophet

 function it_matches_a_belongs_to_many_relationship()
 {
     $p = new Prophet();
     $related = $p->prophesize('PhpSpec\\Laravel\\Test\\Example');
     $belongsTo = $p->prophesize('Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany');
     $belongsTo->getRelated()->willReturn($related->reveal());
     $this->positiveMatch('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\Example'));
     $this->shouldThrow('PhpSpec\\Exception\\Example\\FailureException')->during('positiveMatch', array('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\OtherExample')));
     $this->negativeMatch('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\OtherExample'));
     $this->shouldThrow('PhpSpec\\Exception\\Example\\FailureException')->during('negativeMatch', array('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\Example')));
 }
开发者ID:visualturk,项目名称:phpspec-laravel,代码行数:11,代码来源:DefineRelationshipMatcherSpec.php

示例13: testRootEntity

 /**
  * Test Create, Endpoint, Get/Set methods.
  */
 public function testRootEntity()
 {
     $root = Root::create();
     $this->assertInstanceOf('Shoko\\TwitchApiBundle\\Model\\Entity\\Root', $root);
     $this->assertEquals(null, $root->getToken());
     $token = $this->prophet->prophesize('Shoko\\TwitchApiBundle\\Model\\ValueObject\\Token');
     $this->assertEquals($token->reveal(), $root->setToken($token->reveal())->getToken());
     $this->assertEquals(array(), $root->getLinks());
     $link = 'some_link';
     $this->assertEquals([$link], $root->setLinks([$link])->getLinks());
 }
开发者ID:shokohsc,项目名称:TwitchApiBundle,代码行数:14,代码来源:RootTest.php

示例14: testNoopNext

 public function testNoopNext()
 {
     $prophet = new Prophet();
     $reqProphecy = $prophet->prophesize(ServerRequestInterface::class);
     $resProphecy = $prophet->prophesize(ResponseInterface::class);
     $req = $reqProphecy->reveal();
     $res = $resProphecy->reveal();
     /** @noinspection PhpParamsInspection */
     $returnValue = NimoUtility::noopNext($req, $res);
     $this->assertSame($res, $returnValue);
 }
开发者ID:litphp,项目名称:nimo,代码行数:11,代码来源:NimoUtilityTest.php

示例15: createMissingCollabolators

 /**
  * @param CollaboratorManager $collaborators
  * @param \ReflectionMethod $beforeMethod
  */
 private function createMissingCollabolators(CollaboratorManager $collaborators, \ReflectionMethod $beforeMethod)
 {
     foreach ($beforeMethod->getParameters() as $parameter) {
         if (!$collaborators->has($parameter->getName())) {
             $collaborator = new Collaborator($this->prophet->prophesize());
             if (null !== ($class = $parameter->getClass())) {
                 $collaborator->beADoubleOf($class->getName());
             }
             $collaborators->set($parameter->getName(), $collaborator);
         }
     }
 }
开发者ID:coduo,项目名称:phpspec-prepare-extension,代码行数:16,代码来源:BeforeMaintainer.php


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