當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectProphecy::get方法代碼示例

本文整理匯總了PHP中Prophecy\Prophecy\ObjectProphecy::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectProphecy::get方法的具體用法?PHP ObjectProphecy::get怎麽用?PHP ObjectProphecy::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Prophecy\Prophecy\ObjectProphecy的用法示例。


在下文中一共展示了ObjectProphecy::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 public function setUp()
 {
     $this->factory = new RendererFactory();
     $this->container = $this->prophesize(ContainerInterface::class);
     $this->container->get('translator')->willReturn(Translator::factory([]));
     $this->container->get('config')->willReturn(['navigation' => [], 'recaptcha' => []]);
     $this->container->get(RouteAssembler::class)->willReturn($this->prophesize(RouteAssembler::class)->reveal());
 }
開發者ID:kukoman,項目名稱:website-expressive,代碼行數:8,代碼來源:RendererFactoryTest.php

示例2: testAjaxImageUploadForm

 public function testAjaxImageUploadForm()
 {
     $app = $this->prophesize('Zend\\Mvc\\Application');
     $app->getMvcEvent()->willReturn($this->prophesize('Zend\\Mvc\\MvcEvent'));
     $this->locator->get('Application')->willReturn($app);
     $form = $this->ajaxImageUploadFormFactory->createService($this->controllerManager->reveal());
     $this->assertInstanceOf('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm', $form);
 }
開發者ID:shitikovkirill,項目名稱:LearnZF2,代碼行數:8,代碼來源:AjaxImageUploadFormFactoryTest.php

示例3: testReturnIndexControllerFromFactory

 public function testReturnIndexControllerFromFactory()
 {
     $formElementManager = $this->prophesize('Zend\\Form\\FormElementManager');
     $ajaxImageUploadForm = $this->prophesize('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm');
     $formElementManager->get('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm')->willReturn($ajaxImageUploadForm);
     $this->serviceLocator->get('FormElementManager')->willReturn($formElementManager);
     $controller = $this->indexControllerFactory->__invoke($this->indexControllerManager->reveal());
     $this->assertInstanceOf('LearnZF2AjaxImageGallery\\Controller\\IndexController', $controller);
 }
開發者ID:shitikovkirill,項目名稱:LearnZF2,代碼行數:9,代碼來源:IndexControllerFactoryTest.php

示例4: testThrowsExceptionIfKeyWasNotFound

 /**
  * @expectedException \PharIo\Phive\DownloadFailedException
  */
 public function testThrowsExceptionIfKeyWasNotFound()
 {
     $response = $this->prophesize(CurlResponse::class);
     $response->getHttpCode()->willReturn(404);
     $response->getErrorMessage()->willReturn('Not Found');
     $this->curl->get(Argument::any(), Argument::any())->willReturn($response);
     $downloader = new GnupgKeyDownloader($this->curl->reveal(), [new Url('https://example.com')], $this->output->reveal());
     $downloader->download('12345678');
 }
開發者ID:paul-schulleri,項目名稱:phive,代碼行數:12,代碼來源:GnupgKeyDownloaderTest.php

示例5: testNormalizeWithNoEntity

 /**
  * @covers ::normalize
  */
 public function testNormalizeWithNoEntity()
 {
     $entity_reference = $this->prophesize(TypedDataInterface::class);
     $entity_reference->getValue()->willReturn(NULL)->shouldBeCalled();
     $this->fieldItem->get('entity')->willReturn($entity_reference->reveal())->shouldBeCalled();
     $normalized = $this->normalizer->normalize($this->fieldItem->reveal());
     $expected = ['target_id' => ['value' => 'test']];
     $this->assertSame($expected, $normalized);
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:12,代碼來源:EntityReferenceFieldItemNormalizerTest.php

示例6: testIsGrantedMaskComparison

 /**
  * @dataProvider isGrantedMaskComparisonProvider
  */
 public function testIsGrantedMaskComparison($action, $requiredMask, $mask, $result)
 {
     $this->maskBuilder->resolveMask(Argument::exact($action))->willReturn($requiredMask);
     $this->maskBuilder->get()->willReturn($mask);
     if ($result) {
         $this->assertTrue($this->permission->isGranted($action));
     } else {
         $this->assertfalse($this->permission->isGranted($action));
     }
 }
開發者ID:alexdpy,項目名稱:acl,代碼行數:13,代碼來源:PermissionTest.php

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

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

示例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->decoderProvider = $this->prophet->prophesize('SDispatcher\\Common\\FOSDecoderProvider');
     $this->route->getOption(RouteOptions::REST)->willReturn(true);
     $this->routes->get(Argument::any())->willReturn($this->route->reveal());
     $this->beConstructedWith($this->routes->reveal(), $this->decoderProvider->reveal());
 }
開發者ID:bcen,項目名稱:silex-dispatcher,代碼行數:10,代碼來源:DeserializerSpec.php

示例10: 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->response = $this->prophet->prophesize('SDispatcher\\DataResponse');
     $this->encoder = $this->prophet->prophesize('Symfony\\Component\\Serializer\\Encoder\\EncoderInterface');
     $this->route->getOption(RouteOptions::REST)->willReturn(true);
     $this->routes->get(Argument::any())->willReturn($this->route->reveal());
     $this->beConstructedWith($this->routes->reveal(), $this->encoder->reveal());
 }
開發者ID:bcen,項目名稱:silex-dispatcher,代碼行數:11,代碼來源:SerializerSpec.php

示例11: testEnumLabel

 public function testEnumLabel()
 {
     $enum = $this->prophesize('EnumBundle\\Enum\\EnumInterface');
     $enum->getChoices()->willReturn(['foo' => 'FOO', 'bar' => 'BAR']);
     $this->registry->get('test')->willReturn($enum->reveal());
     $twig = $this->createEnvironment();
     $this->assertSame('FOO', $twig->createTemplate("{{ 'foo'|enum_label('test') }}")->render([]));
     $this->assertSame('BAR', $twig->createTemplate("{{ enum_label('bar', 'test') }}")->render([]));
     $this->assertSame('not_exist', $twig->createTemplate("{{ 'not_exist'|enum_label('test') }}")->render([]));
     $this->assertSame('not_exist', $twig->createTemplate("{{ enum_label('not_exist', 'test') }}")->render([]));
 }
開發者ID:J-Ben87,項目名稱:enum-bundle,代碼行數:11,代碼來源:EnumExtensionTest.php

示例12: testGetJsonResponseFailure

 /**
  * @expectedException \PSU\Exception\HttpClientException
  */
 public function testGetJsonResponseFailure()
 {
     // test values
     $url = 'http://foo.com';
     //mock methods
     $this->responseInterface->getStatusCode()->willReturn(500)->shouldBeCalledTimes(1);
     $this->clientInterface->get(Argument::exact($url))->willReturn($this->responseInterface->reveal())->shouldBeCalledTimes(1);
     // init object
     $guzzlAdapter = new GuzzlApapter($this->clientInterface->reveal());
     // test
     $this->assertNull($guzzlAdapter->getJsonResponse($url));
 }
開發者ID:msiebeneicher,項目名稱:phar-self-updater,代碼行數:15,代碼來源:GuzzlAdapterTest.php

示例13: testWithConfig

 public function testWithConfig()
 {
     $paths = ['ns1' => [__DIR__ . '/partials'], 'ns2' => [__DIR__ . '/templates']];
     $config = ['extension' => 'handlebars', 'separator' => '.', 'paths' => $paths];
     $factory = new ResolverFactory();
     $this->container->get(HandlebarsRendererFactory::CONFIG_KEY)->willReturn($config);
     /* @var AggregateResolver $resolver */
     $resolver = $factory($this->container->reveal());
     /* @var FilesystemResolver $filesystemResolver */
     $filesystemResolver = $resolver->fetchByType(FilesystemResolver::class);
     $this->assertEquals('handlebars', $filesystemResolver->getExtension());
     $this->assertEquals('.', $filesystemResolver->getSeparator());
     $paths = $filesystemResolver->getPaths();
     $this->assertArrayHasKey('ns1', $paths);
     $this->assertArrayHasKey('ns2', $paths);
 }
開發者ID:kynx,項目名稱:expressive-handlebars-v8js,代碼行數:16,代碼來源:ResolverFactoryTest.php

示例14: _createRepositoryConnector

 /**
  * Creates repository connector.
  *
  * @param string $username                     Username.
  * @param string $password                     Password.
  * @param string $last_revision_cache_duration Last revision cache duration.
  *
  * @return Connector
  */
 private function _createRepositoryConnector($username, $password, $last_revision_cache_duration = '10 minutes')
 {
     $this->_configEditor->get('repository-connector.username')->willReturn($username)->shouldBeCalled();
     $this->_configEditor->get('repository-connector.password')->willReturn($password)->shouldBeCalled();
     $this->_configEditor->get('repository-connector.last-revision-cache-duration')->willReturn($last_revision_cache_duration)->shouldBeCalled();
     return new Connector($this->_configEditor->reveal(), $this->_processFactory->reveal(), $this->_io->reveal(), $this->_cacheManager->reveal(), $this->_revisionListParser->reveal());
 }
開發者ID:console-helpers,項目名稱:svn-buddy,代碼行數:16,代碼來源:ConnectorTest.php

示例15: processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface

 /**
  * @test
  */
 public function processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface()
 {
     $typoScript = array(10 => $this->getUniqueId('postprocess'), 20 => PostProcessorWithoutInterfaceFixture::class);
     $this->objectManagerProphecy->get(Argument::cetera())->will(function ($arguments) {
         return new $arguments[0]($arguments[1], $arguments[2]);
     });
     $subject = $this->createSubject($typoScript);
     $this->assertEquals('', $subject->process());
 }
開發者ID:rickymathew,項目名稱:TYPO3.CMS,代碼行數:12,代碼來源:PostProcessorTest.php


注:本文中的Prophecy\Prophecy\ObjectProphecy::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。