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


PHP Prophecy\Prophet类代码示例

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


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

示例1: createCategoryDouble

 /**
  * @param $id
  * @return ObjectProphecy
  */
 private function createCategoryDouble($id)
 {
     $prophet = new Prophet();
     $categoryDouble = $prophet->prophesize('Prh\\BlogBundle\\Entity\\Category');
     $categoryDouble->getId()->willReturn($id);
     return $categoryDouble;
 }
开发者ID:prevueltas,项目名称:blog-bundle,代码行数:11,代码来源:PostServiceTest.php

示例2: Prophet

 function it_should_be_able_to_run_processes()
 {
     $prophet = new Prophet();
     $processes = [];
     for ($i = 0; $i < 20; $i++) {
         $process = $prophet->prophesize(Process::class);
         $process->started = false;
         $process->terminated = false;
         $process->start()->will(function () use($process) {
             $process->started = true;
         })->shouldBeCalledTimes(1);
         $process->isTerminated()->will(function () use($process) {
             if (!$process->terminated) {
                 $process->terminated = true;
                 return false;
             }
             return true;
         })->shouldBeCalledTimes(2);
         // The number of times isStarted() is called starts at 3
         // and increases by 2 after each chunk of five processes.
         $process->isStarted()->will(function () use($process) {
             return $process->started;
         })->shouldBeCalledTimes(floor($i / 5) * 2 + 3);
         $processes[] = $process->reveal();
     }
     $this->run($processes);
     $prophet->checkPredictions();
 }
开发者ID:phpro,项目名称:grumphp,代码行数:28,代码来源:AsyncProcessRunnerSpec.php

示例3: testXMLGeneration

 /**
  * @param Payment            $payment
  * @param TransactionDetails $transactionDetails
  *
  * @dataProvider dataProvider
  */
 public function testXMLGeneration($payment, $transactionDetails)
 {
     $prophet = new Prophet();
     $orderService = $prophet->prophesize('Checkdomain\\TeleCash\\IPG\\API\\Service\\OrderService');
     $sellHosted = new SellHostedData($orderService->reveal(), $payment, $transactionDetails);
     $document = $sellHosted->getDocument();
     $document->appendChild($sellHosted->getElement());
     $elementCCType = $document->getElementsByTagName('ns1:CreditCardTxType');
     $this->assertEquals(1, $elementCCType->length, 'Expected element CreditCardTxType not found');
     $children = [];
     /** @var \DOMNode $child */
     foreach ($elementCCType->item(0)->childNodes as $child) {
         $children[$child->nodeName] = $child->nodeValue;
     }
     $this->assertArrayHasKey('ns1:Type', $children, 'Expected element Type not found');
     $this->assertEquals('sale', $children['ns1:Type'], 'Type did not match');
     $elementPayment = $document->getElementsByTagName('ns1:Payment');
     $this->assertEquals(1, $elementPayment->length, 'Expected element Payment not found');
     if ($transactionDetails !== null) {
         $elementDetails = $document->getElementsByTagName('ns2:TransactionDetails');
         $this->assertEquals(1, $elementDetails->length, 'Expected element TransactionDetails not found');
     } else {
         $elementDetails = $document->getElementsByTagName('ns2:TransactionDetails');
         $this->assertEquals(0, $elementDetails->length, 'Unexpected element TransactionDetails was found');
     }
 }
开发者ID:checkdomain,项目名称:telecash,代码行数:32,代码来源:SellHostedDataTest.php

示例4: mockAuthorizeService

 /**
  * Mock the authorization service
  *
  * @param bool $isAllowed
  */
 protected function mockAuthorizeService($isAllowed = true)
 {
     $prophet = new Prophet();
     $authorizeService = $prophet->prophesize('\\BjyAuthorize\\Service\\Authorize');
     $authorizeService->isAllowed(Argument::cetera())->willReturn($isAllowed);
     $this->mockListenerFactory($authorizeService->reveal());
 }
开发者ID:phpro,项目名称:zf-smartcrud,代码行数:12,代码来源:BjyAuthorizeSpec.php

示例5: stubMetaData

 /**
  * @param \Doctrine\Common\Persistence\ObjectManager $objectManager
  */
 protected function stubMetaData($objectManager)
 {
     $prophet = new Prophet();
     $meta = $prophet->prophesize('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata');
     $meta->getIdentifierFieldNames()->willReturn(['id']);
     $meta->getIdentifierValues(Argument::any())->willReturn([1]);
     $objectManager->getClassMetadata('stdClass')->willReturn($meta);
 }
开发者ID:stefliekens,项目名称:zf-apigility-doctrine-bulk,代码行数:11,代码来源:AbstractListenerSpec.php

示例6: Prophet

 function it_should_throw_exception_when_buildpath_not_exist()
 {
     $prophet = new Prophet();
     $file = $prophet->prophesize('Illuminate\\Filesystem\\Filesystem');
     $file->makeDirectory('dir_bar', 0775, true)->willReturn(false);
     $this->beConstructedWith(null, null, $file);
     $this->shouldThrow('Devfactory\\Minify\\Exceptions\\DirNotExistException')->duringMake('dir_bar');
 }
开发者ID:phantsang,项目名称:1u0U39rjwJO4Vmnt99uk9j6,代码行数:8,代码来源:JavaScriptSpec.php

示例7: addMockDriver

 /**
  * Add a mock driver
  * 
  * @param string $name
  * @return string
  */
 protected static function addMockDriver($name)
 {
     $prophet = new Prophet();
     $prophecy = $prophet->prophesize('Jasny\\DB\\Connection');
     $class = get_class($prophecy->reveal());
     DB::$drivers[$name] = $class;
     return $class;
 }
开发者ID:Sarfaraaz,项目名称:db,代码行数:14,代码来源:DBTest.php

示例8: expectingWithoutOptionalParameter

 /**
  * Calling no optional parameter
  *
  * @test
  * @see https://github.com/php-mock/php-mock-prophecy/issues/1
  */
 public function expectingWithoutOptionalParameter()
 {
     $prophet = new Prophet();
     $prophecy = $prophet->prophesize(OptionalParameterHolder::class);
     $prophecy->call("arg1")->willReturn("mocked");
     $mock = $prophecy->reveal();
     $this->assertEquals("mocked", $mock->call("arg1"));
     $prophet->checkPredictions();
 }
开发者ID:php-mock,项目名称:php-mock-prophecy,代码行数:15,代码来源:RegressionTest.php

示例9: 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

示例10: mockConfiguration

 /**
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  */
 protected function mockConfiguration($serviceLocator)
 {
     $serviceLocator->has('Config')->willReturn(true);
     $serviceLocator->get('Config')->willReturn(array('phpro-smartcrud-gateway' => array('custom-gateway' => array('type' => 'smartcrud.base.gateway', 'options' => array('object_manager' => 'ObjectManager')), 'fault-gateway' => array('type' => 'fault-gateway'))));
     $prophet = new Prophet();
     $objectManager = $prophet->prophesize('Doctrine\\Common\\Persistence\\ObjectManager');
     $serviceLocator->has('ObjectManager')->willReturn(true);
     $serviceLocator->get('ObjectManager')->willReturn($objectManager);
 }
开发者ID:phpro,项目名称:zf-smartcrud,代码行数:12,代码来源:AbstractGatewayFactorySpec.php

示例11: mockFile

 protected function mockFile($name, $isRename = false, $isDelete = false)
 {
     $prophet = new Prophet();
     $file = $prophet->prophesize('Gitonomy\\Git\\Diff\\File');
     $file->getName()->willReturn($name);
     $file->getNewName()->willReturn($name);
     $file->isRename()->willReturn($isRename);
     $file->isDeletion()->willReturn($isDelete);
     return $file->reveal();
 }
开发者ID:hunslater,项目名称:grumphp,代码行数:10,代码来源:ChangedFilesSpec.php

示例12: 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

示例13: mockFile

 protected function mockFile($name, $isRename = false, $isDelete = false)
 {
     $prophet = new Prophet();
     $file = $prophet->prophesize(File::class);
     $file->getName()->willReturn($name);
     $file->getNewName()->willReturn($name);
     $file->isRename()->willReturn($isRename);
     $file->isDeletion()->willReturn($isDelete);
     return $file->reveal();
 }
开发者ID:phpro,项目名称:grumphp,代码行数:10,代码来源:ChangedFilesSpec.php

示例14: 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

示例15: getTestPluginService

 /**
  * Get the service with the stubbed registry
  * @return TestPluginService
  */
 protected function getTestPluginService()
 {
     $testPluginService = new TestPluginService();
     $prophet = new Prophet();
     $prophecy = $prophet->prophesize();
     $prophecy->willExtend(PluginRegistry::class);
     $prophecy->getMap()->willReturn(self::$pluginData);
     $testPluginService->setRegistry($prophecy->reveal());
     return $testPluginService;
 }
开发者ID:oat-sa,项目名称:extension-tao-test,代码行数:14,代码来源:TestRunnerFeatureServiceTest.php


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