当前位置: 首页>>代码示例>>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;未经允许,请勿转载。