本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例9: testInvoke
public function testInvoke()
{
$instance = $this->factory->__invoke($this->container->reveal(), '');
$this->assertInstanceOf(TwigRenderer::class, $instance);
}