當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。