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


PHP Prophecy\ObjectProphecy类代码示例

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


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

示例1: check

 /**
  * Tests that there were no calls made.
  *
  * @param Call[]         $calls
  * @param ObjectProphecy $object
  * @param MethodProphecy $method
  *
  * @throws \Prophecy\Exception\Prediction\UnexpectedCallsException
  */
 public function check(array $calls, ObjectProphecy $object, MethodProphecy $method)
 {
     if (!count($calls)) {
         return;
     }
     throw new UnexpectedCallsException(sprintf("No calls expected that match:\n" . "  %s->%s(%s)\n" . "but %d were made:\n%s", get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), count($calls), $this->util->stringifyCalls($calls)), $method, $calls);
 }
开发者ID:burimshala,项目名称:numbertowords,代码行数:16,代码来源:NoCallsPrediction.php

示例2: buildFakeObject

 /**
  * Builds a fake object using Prophecy
  */
 public function buildFakeObject()
 {
     if (!isset($this->prophecy)) {
         $this->initProphecy();
     }
     return $this->prophecy->reveal();
 }
开发者ID:mattjmattj,项目名称:maybe,代码行数:10,代码来源:Maybe.php

示例3: testInvokesSignatureVerifier

 public function testInvokesSignatureVerifier()
 {
     $expected = new GnupgVerificationResult(['fingerprint' => 'foobar', 'summary' => 'baz']);
     $this->verifier->verify('foo', 'bar')->willReturn($expected);
     $service = new SignatureService($this->verifier->reveal());
     $this->assertEquals($expected, $service->verify('foo', 'bar'));
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:7,代码来源:SignatureServiceTest.php

示例4: datesAreReadFromQuery

 /**
  * @test
  */
 public function datesAreReadFromQuery()
 {
     $shortCode = 'abc123';
     $this->visitsTracker->info($shortCode, new DateRange(null, new \DateTime('2016-01-01 00:00:00')))->willReturn([])->shouldBeCalledTimes(1);
     $response = $this->action->__invoke(ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode)->withQueryParams(['endDate' => '2016-01-01 00:00:00']), new Response());
     $this->assertEquals(200, $response->getStatusCode());
 }
开发者ID:shlinkio,项目名称:shlink,代码行数:10,代码来源:GetVisitsActionTest.php

示例5: setUp

 /**
  * Create a new database connection mock object for every test.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->typoScriptFrontendController = $this->prophesize(TypoScriptFrontendController::class);
     $GLOBALS['TSFE'] = $this->typoScriptFrontendController->reveal();
     $this->subject = GeneralUtility::makeInstance(QueryContext::class);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:12,代码来源:QueryContextTest.php

示例6: tagsListIsReturnedIfCorrectShortCodeIsProvided

 /**
  * @test
  */
 public function tagsListIsReturnedIfCorrectShortCodeIsProvided()
 {
     $shortCode = 'abc123';
     $this->shortUrlService->setTagsByShortCode($shortCode, [])->willReturn(new ShortUrl())->shouldBeCalledTimes(1);
     $response = $this->action->__invoke(ServerRequestFactory::fromGlobals()->withAttribute('shortCode', 'abc123')->withParsedBody(['tags' => []]), new Response());
     $this->assertEquals(200, $response->getStatusCode());
 }
开发者ID:shlinkio,项目名称:shlink,代码行数:10,代码来源:EditTagsActionTest.php

示例7: invalidApiKeyReturnsErrorResponse

 /**
  * @test
  */
 public function invalidApiKeyReturnsErrorResponse()
 {
     $this->apiKeyService->getByKey('foo')->willReturn((new ApiKey())->setEnabled(false))->shouldBeCalledTimes(1);
     $request = ServerRequestFactory::fromGlobals()->withParsedBody(['apiKey' => 'foo']);
     $response = $this->action->__invoke($request, new Response());
     $this->assertEquals(401, $response->getStatusCode());
 }
开发者ID:shlinkio,项目名称:shlink,代码行数:10,代码来源:AuthenticateActionTest.php

示例8: it_should_return_406_response_if_no_best_format_found

 public function it_should_return_406_response_if_no_best_format_found()
 {
     $this->formatNegotiator->getBestFormat(Argument::cetera())->willReturn(null);
     $this->route->getOption(Argument::any())->shouldBeCalled();
     $request = Request::create('/?format=json');
     $this->__invoke($request)->shouldReturn406Response();
 }
开发者ID:bcen,项目名称:silex-dispatcher,代码行数:7,代码来源:ContentNegotiatorSpec.php

示例9: updateWizardDoesRunIfCssStyledContentIsNotInstalledAndExistingFlexFormContent

 /**
  * @test
  * @return void
  */
 public function updateWizardDoesRunIfCssStyledContentIsNotInstalledAndExistingFlexFormContent()
 {
     $this->packageManagerProphecy->isPackageActive('css_styled_content')->willReturn(false);
     $this->dbProphecy->exec_SELECTcountRows(Argument::cetera())->willReturn(1);
     $description = '';
     $this->assertTrue($this->updateWizard->checkForUpdate($description));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:11,代码来源:TableFlexFormToTtContentFieldsUpdateTest.php

示例10: testWrites

 /**
  *
  */
 public function testWrites()
 {
     $this->formatter->format(Argument::any())->shouldBeCalledTimes(1);
     $this->writer->write(Argument::any(), Argument::any())->shouldBeCalledTimes(1);
     $this->dumper->setEnabled(true);
     $this->dumper->dump('id', ['test' => 1]);
 }
开发者ID:glooby,项目名称:debug-bundle,代码行数:10,代码来源:DumperTestTest.php

示例11: testIsThrowingNonExistentFormException

 /**
  * @expectedException \Linio\DynamicFormBundle\Exception\FormlyMapperException
  */
 public function testIsThrowingNonExistentFormException()
 {
     $formName = 'foo';
     $this->formFactoryMock->getConfiguration($formName)->willThrow('Linio\\DynamicFormBundle\\Exception\\NonExistentFormException');
     $this->formlyMapper->setFormFactory($this->formFactoryMock->reveal());
     $this->formlyMapper->map($formName);
 }
开发者ID:xurumelous,项目名称:dynamic-form-bundle,代码行数:10,代码来源:FormlyMapperTest.php

示例12: updateWizardDoesNotRunIfCssStyledContentIsInstalled

 /**
  * @test
  * @return void
  */
 public function updateWizardDoesNotRunIfCssStyledContentIsInstalled()
 {
     $this->packageManagerProphecy->isPackageActive('fluid_styled_content')->willReturn(true);
     $this->packageManagerProphecy->isPackageActive('css_styled_content')->willReturn(true);
     $description = '';
     $this->assertFalse($this->updateWizard->checkForUpdate($description));
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:11,代码来源:ContentTypesToTextMediaUpdateTest.php

示例13: it_adds_entries_if_there_are_present_in_xml

 /**
  * @test
  */
 public function it_adds_entries_if_there_are_present_in_xml()
 {
     $record = $this->prophesize(DTO\Record::class);
     $this->mockedEntryDecoder->addTransactionDetails(Argument::type(DTO\Entry::class), Argument::type('\\SimpleXMLElement'))->shouldBeCalled();
     $record->addEntry(Argument::type(DTO\Entry::class))->shouldBeCalled();
     $this->decoder->addEntries($record->reveal(), $this->getXmlRecord());
 }
开发者ID:genkgo,项目名称:camt,代码行数:10,代码来源:RecordTest.php

示例14: it_should_set_route_option_if_controller_found

 public function it_should_set_route_option_if_controller_found()
 {
     $request = Request::create('/');
     $request->attributes->set('_controller', 'spec\\SDispatcher\\Middleware\\RouteOptionInspectorSpec');
     $this->route->addOptions(Argument::any())->shouldBeCalled();
     $this->__invoke($request);
 }
开发者ID:bcen,项目名称:silex-dispatcher,代码行数:7,代码来源:RouteOptionInspectorSpec.php

示例15: translatePluralFallbacksToTranslator

 /**
  * @test
  */
 public function translatePluralFallbacksToTranslator()
 {
     $this->translator->translatePlural('foo', 'bar', 'baz', 'default', null)->shouldBeCalledTimes(1);
     $this->extension->translatePlural('foo', 'bar', 'baz');
     $this->translator->translatePlural('foo', 'bar', 'baz', 'another', 'en')->shouldBeCalledTimes(1);
     $this->extension->translatePlural('foo', 'bar', 'baz', 'another', 'en');
 }
开发者ID:shlinkio,项目名称:shlink,代码行数:10,代码来源:TranslatorExtensionTest.php


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