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