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