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


PHP Client::getContainer方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->client = static::createClient();
     $this->client->followRedirects();
     $this->container = $this->client->getContainer();
     $this->loadFixtures($this->getFixtures());
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:7,代码来源:AbstractControllerTest.php

示例2: testControllerNoticeToException

 public function testControllerNoticeToException()
 {
     $this->client = $this->createClient();
     $errorOccured = false;
     $syslogProcessorMock = $this->getMockBuilder('Keboola\\Syrup\\Monolog\\Processor\\SyslogProcessor')->disableOriginalConstructor()->getMock();
     $syslogProcessorMock->expects($this->any())->method("processRecord")->with($this->callback(function ($subject) use(&$errorOccured) {
         if ($subject['message'] == 'Notice: Undefined offset: 3') {
             $e = $subject['context']['exception'];
             $errorOccured = true;
             return $e instanceof \Symfony\Component\Debug\Exception\ContextErrorException;
         }
         return true;
     }))->willReturn(['level' => 100]);
     $container = $this->client->getContainer();
     $container->set('syrup.monolog.syslog_processor', $syslogProcessorMock);
     $this->client->request('GET', '/tests/notice');
     $response = $this->client->getResponse();
     $responseJson = json_decode($response->getContent(), true);
     $this->assertEquals('error', $responseJson['status']);
     $this->assertEquals('Application error', $responseJson['error']);
     $this->assertEquals(500, $responseJson['code']);
     $this->assertArrayHasKey('exceptionId', $responseJson);
     $this->assertArrayHasKey('runId', $responseJson);
     $this->assertTrue($errorOccured);
 }
开发者ID:keboola,项目名称:syrup,代码行数:25,代码来源:ErrorHandlingTest.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->client = static::createClient();
     $this->twig = $this->client->getContainer()->get('twig');
     $this->loginHelper = new LoginTestHelper($this->client);
 }
开发者ID:asev,项目名称:SettingsBundle,代码行数:10,代码来源:PersonalSettingWidgetExtensionTest.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     static::$client = static::createClient();
     static::$router = self::$client->getContainer()->get('router');
     static::$em = self::$client->getContainer()->get('doctrine.orm.entity_manager');
     static::$container = self::getContainer();
 }
开发者ID:bzis,项目名称:zomba,代码行数:7,代码来源:TestCase.php

示例5: testGetUnpublished

 public function testGetUnpublished()
 {
     /** @var $service PhpcrBlockLoader */
     $service = $this->client->getContainer()->get('cmf.block.service');
     $this->assertInstanceOf('Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock', $service->load(array('name' => '/test/blocks/block-1')));
     // this block is not published, should be empty
     $this->assertInstanceOf('Sonata\BlockBundle\Model\EmptyBlock', $service->load(array('name' => '/test/blocks/block-2')));
 }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:8,代码来源:PHPCRBlockLoaderTest.php

示例6: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->client = static::createClient();
     $this->container = $this->client->getContainer();
     $this->em = $this->container->get('doctrine')->getManager();
     $this->validator = $this->container->get('validator');
     $this->setCurrentShop();
 }
开发者ID:Newman101,项目名称:WellCommerce,代码行数:11,代码来源:AbstractTestCase.php

示例7: setUp

 protected function setUp()
 {
     static::$client = static::createClient();
     $container = static::$client->getContainer();
     $sapiToken = $container->getParameter('storage_api.test.token');
     $sapiUrl = $container->getParameter('storage_api.test.url');
     static::$client->setServerParameters(array('HTTP_X-StorageApi-Token' => $sapiToken));
 }
开发者ID:keboola,项目名称:google-analytics-bundle,代码行数:8,代码来源:MailerTest.php

示例8: setUp

 protected function setUp()
 {
     if (!self::$container) {
         self::$client = static::createClient();
         self::$container = self::$client->getContainer();
         //            self::loginAsUser();
     }
 }
开发者ID:Gemorroj,项目名称:forum,代码行数:8,代码来源:ForumWebTestCase.php

示例9: tearDown

 public function tearDown()
 {
     foreach ($this->client->getContainer()->getMockedServices() as $id => $service) {
         $this->client->getContainer()->unmock($id);
     }
     \Mockery::close();
     $this->client = null;
     parent::tearDown();
 }
开发者ID:llvdl,项目名称:DominoSymfony,代码行数:9,代码来源:MockeryWebTestCase.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->client = static::createClient();
     $this->client->restart();
     if ($this->logger === null) {
         $this->logger = $this->client->getContainer()->get('monolog.logger.devel');
     }
 }
开发者ID:ubermichael,项目名称:symftest,代码行数:9,代码来源:LOMWebTestCase.php

示例11: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->client = static::createClient();
     $this->client->followRedirects();
     $this->kern = $this->client->getKernel();
     $this->container = $this->client->getContainer();
     $this->em = $this->container->get('doctrine.orm.entity_manager');
 }
开发者ID:Reallymute,项目名称:IRMApplicative,代码行数:9,代码来源:CarmaWebTestCase.php

示例12: executeCommand

 private function executeCommand(Command $command, Input $input)
 {
     $command->setApplication($this->application);
     $input->setInteractive(false);
     if ($command instanceof ContainerAwareCommand) {
         $command->setContainer($this->client->getContainer());
     }
     $command->run($input, new NullOutput());
 }
开发者ID:ajouve,项目名称:doctrine-fixtures-test,代码行数:9,代码来源:FixtureTestCase.php

示例13: getInitClient

 /**
  * @return \Symfony\Bundle\FrameworkBundle\Client
  */
 protected static function getInitClient()
 {
     if (self::$client) {
         return self::$client;
     }
     self::$client = self::createClient();
     static::$kernel = self::$client->getKernel();
     self::$container = self::$client->getContainer();
     return self::$client;
 }
开发者ID:avelov,项目名称:techery_friends,代码行数:13,代码来源:AbstractTesting.php

示例14: signInAsAdmin

 /**
  *
  */
 protected function signInAsAdmin()
 {
     $session = $this->client->getContainer()->get('session');
     $firewall = 'main';
     $token = new UsernamePasswordToken('admin', null, $firewall, array('ROLE_ADMIN'));
     $session->set('_security_' . $firewall, serialize($token));
     $session->save();
     $cookie = new Cookie($session->getName(), $session->getId());
     $this->client->getCookieJar()->set($cookie);
 }
开发者ID:Nemrtvej,项目名称:symfony-template,代码行数:13,代码来源:ApplicationAvailabilityFunctionalTest.php

示例15: logIn

 /**
  * @param User $user
  */
 protected function logIn(User $user)
 {
     $session = $this->client->getContainer()->get('session');
     $firewall = 'main';
     $token = new UsernamePasswordToken($user, null, $firewall, $user->getRoles());
     $session->set('_security_' . $firewall, serialize($token));
     $session->save();
     $cookie = new Cookie($session->getName(), $session->getId());
     $this->client->getCookieJar()->set($cookie);
 }
开发者ID:philipsorst,项目名称:ddr-symfony-stack.php,代码行数:13,代码来源:BaseIntegrationTest.php


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