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


PHP ContainerInterface::reveal方法代码示例

本文整理汇总了PHP中Interop\Container\ContainerInterface::reveal方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerInterface::reveal方法的具体用法?PHP ContainerInterface::reveal怎么用?PHP ContainerInterface::reveal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interop\Container\ContainerInterface的用法示例。


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

示例1: callFactory

 /**
  * @return Cache
  */
 private function callFactory()
 {
     $callable = $this->factory;
     $doctrineCache = $callable($this->container->reveal());
     static::assertInstanceOf(Cache::class, $doctrineCache);
     return $doctrineCache;
 }
开发者ID:oqq,项目名称:ci-doctrine-factory,代码行数:10,代码来源:DoctrineCacheFactoryTest.php

示例2: testFactoryWithTemplate

 public function testFactoryWithTemplate()
 {
     $factory = new HelloActionFactory();
     $this->container->get(TemplateRendererInterface::class)->willRetur($this->prophesize(TemplateRendererInterface::class));
     $helloPage = $factory($this->container->reveal());
     $this->assertTrue($helloPage instanceof Response);
 }
开发者ID:victorynox,项目名称:TestR,代码行数:7,代码来源:HelloActionFactoryTest.php

示例3: testFormInstance

 public function testFormInstance()
 {
     $formName = 'foobar';
     $this->container->get($formName)->willReturn($this->prophesize(FormInterface::class));
     $factory = new ZendFormFactory();
     $formInstance = $factory($this->container->reveal(), $formName);
     static::assertInstanceOf(FormInterface::class, $formInstance);
 }
开发者ID:oqq,项目名称:ci-zend-form-twig-extension,代码行数:8,代码来源:ZendFormFactoryTest.php

示例4: testFactoryWithTemplate

 public function testFactoryWithTemplate()
 {
     $factory = new HomePageFactory();
     $this->container->has(TemplateInterface::class)->willReturn(true);
     $this->container->get(TemplateInterface::class)->willReturn($this->prophesize(TemplateInterface::class));
     $this->assertTrue($factory instanceof HomePageFactory);
     $homePage = $factory($this->container->reveal());
     $this->assertTrue($homePage instanceof HomePageAction);
 }
开发者ID:vrkansagara,项目名称:zend-expressive-skeleton,代码行数:9,代码来源:HomePageFactoryTest.php

示例5: testFactory

 public function testFactory()
 {
     $factory = new RedirectHandlerActionFactory();
     $this->container->get('config')->willReturn(['expressive-redirect-handler' => ['allow_not_routed_url' => false, 'default_url' => '/']]);
     $router = $this->prophesize(RouterInterface::class);
     $this->container->get(RouterInterface::class)->willReturn($router);
     $this->assertTrue($factory instanceof RedirectHandlerActionFactory);
     $homePage = $factory($this->container->reveal());
     $this->assertTrue($homePage instanceof RedirectHandlerAction);
 }
开发者ID:samsonasik,项目名称:ExpressiveRedirectHandler,代码行数:10,代码来源:RedirectHandlerActionFactoryTest.php

示例6: testWillInjectTemplateNamesFromConfigurationWhenPresent

 public function testWillInjectTemplateNamesFromConfigurationWhenPresent()
 {
     $config = ['zend-expressive' => ['error_handler' => ['template_404' => 'error::404', 'template_error' => 'error::500']]];
     $this->container->has(TemplateRendererInterface::class)->willReturn(false);
     $this->container->has('config')->willReturn(true);
     $this->container->get('config')->willReturn($config);
     $factory = $this->factory;
     $result = $factory($this->container->reveal());
     $this->assertInstanceOf(WhoopsErrorHandler::class, $result);
     $this->assertAttributeEquals('error::404', 'template404', $result);
     $this->assertAttributeEquals('error::500', 'templateError', $result);
 }
开发者ID:kenjis,项目名称:zend-expressive,代码行数:12,代码来源:WhoopsErrorHandlerFactoryTest.php

示例7: make

 /**
  * @param string $dsn
  * @param string $persistent_id
  * @param bool $rpc
  * @return ZeroMQMessageProducer
  */
 private function make($dsn = null, $persistent_id = null, $rpc = null)
 {
     $config = compact('dsn', 'persistent_id', 'rpc');
     $this->container->get('config')->willReturn(['prooph' => ['zeromq_producer' => $config]])->shouldBeCalled();
     $factory = new ZeroMQMessageProducerFactory();
     return $factory($this->container->reveal());
 }
开发者ID:sandrokeil,项目名称:psb-zeromq-producer,代码行数:13,代码来源:ZeroMQMessageProducerFactoryTest.php

示例8: testInvalidResourceException

 public function testInvalidResourceException()
 {
     $request = $this->request->withUri(new Uri('http://localhost/api/ping/666'))->withMethod('GET')->withAttribute('resource', 'SomeBogusResource')->withAttribute('resourceId', 1);
     $apiMiddleware = new ApiMiddleware($this->container->reveal());
     /** @var \Zend\Diactoros\Response\JsonResponse $response */
     $response = $apiMiddleware($request, new Response());
     $data = json_decode((string) $response->getBody(), true);
     $this->assertInstanceOf('Zend\\Diactoros\\Response\\JsonResponse', $response);
     $this->assertEquals(400, $response->getStatusCode());
     $this->assertArrayHasKey('errors', $data);
 }
开发者ID:xtreamwayz,项目名称:zend-expressive-app-poc,代码行数:11,代码来源:ApiMiddlewareTest.php

示例9: testInvoke

 public function testInvoke()
 {
     $instance = $this->factory->__invoke($this->container->reveal(), '');
     $this->assertInstanceOf(TwigRenderer::class, $instance);
 }
开发者ID:acelaya,项目名称:alejandrocelaya.com,代码行数:5,代码来源:RendererFactoryTest.php


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