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


PHP Client::getKernel方法代码示例

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


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

示例1: runCommand

 protected function runCommand($command)
 {
     $command = sprintf('%s --quiet', $command);
     $application = new Application($this->client->getKernel());
     $application->setAutoExit(false);
     return $application->run(new StringInput($command));
 }
开发者ID:stalxed,项目名称:TbbcMoneyBundle,代码行数:7,代码来源:ConfigTest.php

示例2: setUp

 public function setUp()
 {
     $this->client = $this->createClient();
     $this->app = new Application($this->client->getKernel());
     $this->app->setAutoExit(false);
     $this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
     $this->router = static::$kernel->getContainer()->get('router');
 }
开发者ID:hasantayyar,项目名称:ojs,代码行数:8,代码来源:BaseTestCase.php

示例3: 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

示例4: runCommand

 protected function runCommand(array $arguments = [])
 {
     $application = new Application($this->client->getKernel());
     $application->setAutoExit(false);
     $arguments['--quiet'] = true;
     $arguments['-e'] = 'test';
     $input = new ArrayInput($arguments);
     $application->run($input, new ConsoleOutput());
 }
开发者ID:vsmihaylovsky,项目名称:GeekHubSymfonyShop,代码行数:9,代码来源:TestBaseWeb.php

示例5: getClient

 /**
  * Creates if needed and returns client instance
  *
  * @param bool  $reinitialize
  * @param array $options
  *
  * @return Client
  */
 protected static function getClient($reinitialize = false, array $options = [])
 {
     if (!static::$client || $reinitialize) {
         static::$client = static::createClient($options);
     }
     // core is loaded (for tests without calling of getClient(true))
     static::$client->getKernel()->boot();
     return static::$client;
 }
开发者ID:intaro,项目名称:symfony-testing-tools,代码行数:17,代码来源:WebTestCase.php

示例6: 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

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->client = static::createClient();
     $this->application = new Application($this->client->getKernel());
     $this->application->setAutoExit(false);
     $this->executeCommand(new CreateDatabaseDoctrineCommand(), new ArrayInput([]));
     $this->executeCommand(new MigrationsMigrateDoctrineCommand(), new ArrayInput([]));
     $this->executeCommand(new LoadDataFixturesDoctrineCommand(), new ArrayInput([]));
 }
开发者ID:ajouve,项目名称:doctrine-fixtures-test,代码行数:10,代码来源:FixtureTestCase.php

示例8: setUp

 /**
  * Setup HTTP client, command runner and Storage API client for each test
  */
 protected function setUp()
 {
     $this->httpClient = static::createClient();
     $container = $this->httpClient->getContainer();
     if (!$this->storageApiToken) {
         $this->storageApiToken = $container->getParameter('storage_api.test.token');
     }
     $this->httpClient->setServerParameters(['HTTP_X-StorageApi-Token' => $this->storageApiToken]);
     $this->jobMapper = $container->get('syrup.elasticsearch.current_component_job_mapper');
     $application = new Application($this->httpClient->getKernel());
     $application->add(new JobCommand());
     $command = $application->find('syrup:run-job');
     $this->commandTester = new CommandTester($command);
     $this->storageApiClient = new StorageApiClient(['token' => $this->storageApiToken, 'url' => $container->getParameter('storage_api.test.url')]);
 }
开发者ID:ErikZigo,项目名称:syrup,代码行数:18,代码来源:AbstractFunctionalTest.php

示例9: runCommand

 /**
  * Runs a command and returns it output
  */
 public function runCommand(Client $client, $command)
 {
     $application = new Application($client->getKernel());
     $application->setAutoExit(false);
     $input = new StringInput($command);
     $output = new StreamOutput(fopen('php://memory', 'w', false));
     $statusCode = $application->run($input, $output);
     rewind($output->getStream());
     $result = stream_get_contents($output->getStream());
     return array($statusCode, $result);
 }
开发者ID:phecho,项目名称:gitonomy,代码行数:14,代码来源:CommandTestCase.php

示例10: setUp

 protected function setUp()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     $container = static::$kernel->getContainer();
     $this->em = $container->get('doctrine')->getManager();
     $this->locale = $container->getParameter('locale');
     $this->secondLocale = array_values(array_diff($container->getParameter('locale_support'), [$this->locale]))[0];
     $this->router = $container->get('router');
     $this->sampleObjectLoader = $container->get('ojs_core.sample.object_loader');
     $baseUrl = $container->getParameter('base_host');
     $this->client = static::makeClient(array(), array('HTTP_HOST' => $baseUrl));
     $this->app = new Application($this->client->getKernel());
     $this->app->setAutoExit(false);
     $isPhpunitFastest = getenv('ENV_TEST_IS_FIRST_ON_CHANNEL');
     if ($isPhpunitFastest !== false) {
         return;
     }
     if (!$this->useCachedDatabase()) {
         $this->databaseInit();
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:22,代码来源:BaseTestSetup.php

示例11: setUp

 public function setUp()
 {
     /** @var \Symfony\Bundle\FrameworkBundle\Client client */
     $this->client = static::createClient();
     $this->em = $this->client->getKernel()->getContainer()->get('doctrine')->getManager();
     $this->url = $this->client->getKernel()->getContainer()->getParameter('domain');
     $this->client_id = $this->client->getKernel()->getContainer()->getParameter('client_id');
     $this->client_secret = $this->client->getKernel()->getContainer()->getParameter('client_secret');
     $this->client_username = $this->client->getKernel()->getContainer()->getParameter('client_test_username');
     $this->client_password = $this->client->getKernel()->getContainer()->getParameter('client_test_password');
     $this->oAuthLogin();
 }
开发者ID:BeerCoders,项目名称:portfolio-api,代码行数:12,代码来源:BaseTestCase.php

示例12: runCommand

 public function runCommand(Client $client, $command)
 {
     $application = new Application($client->getKernel());
     $application->setAutoExit(false);
     $fp = tmpfile();
     $input = new StringInput($command);
     $output = new StreamOutput($fp);
     $application->run($input, $output);
     fseek($fp, 0);
     $output = '';
     while (!feof($fp)) {
         $output = fread($fp, 1024 * 1024);
     }
     fclose($fp);
     return $output;
 }
开发者ID:adm-bome,项目名称:NgAdminGeneratorBundle,代码行数:16,代码来源:AbstractCommandTestCase.php

示例13: execute

 /**
  * @return $this
  */
 public function execute()
 {
     $this->client->disableReboot();
     $this->client->getKernel()->shutdown();
     $this->client->getKernel()->boot();
     $event = new RequestHelperEvent($this);
     $event->setBody($this->body);
     $this->eventDispatcher->dispatch(static::EVENT_PRE_REQUEST, $event);
     $this->client->request($this->method, $this->uri, $this->parameters, $this->files, $this->servers, $event->getBody());
     $this->eventDispatcher->dispatch(static::EVENT_POST_REQUEST, new RequestHelperEvent($this));
     // $this->eventDispatcher->dispatch(static::EVENT_ASSERT, new RequestHelperEvent($this));
     foreach (array_filter($this->assertions) as $callback) {
         call_user_func($callback, $this);
     }
     return $this;
 }
开发者ID:mpoiriert,项目名称:draw-test-helper-bundle,代码行数:19,代码来源:RequestHelper.php

示例14: setupUserRepositoryMock

 /**
  * @param $options
  */
 public function setupUserRepositoryMock($options)
 {
     if (array_key_exists('user_repository', $options)) {
         if (!array_key_exists('find_one_by', $options['user_repository'])) {
             $calls = 2;
             $callable = array($this, 'findOneBy');
         } else {
             $calls = $options['user_repository']['find_one_by']['calls'];
             $callable = array($this, 'findOneByBis');
         }
         $mockBuilder = $this->getMockBuilder('WTW\\UserBundle\\Repository\\UserRepository')->disableOriginalConstructor()->disableAutoload();
         $mock = $mockBuilder->setMethods(['findOneBy'])->getMock();
         $mock->expects($this->exactly($calls))->method('findOneBy')->will($this->returnCallback($callable));
         $this->client->getKernel()->getContainer()->set('wtw_user.repository.user', $mock);
     }
 }
开发者ID:WeavingTheWeb,项目名称:devobs,代码行数:19,代码来源:ProduceUserFriendlistCommandTest.php

示例15: runCommand

 /**
  * Runs a command and returns it output
  */
 public function runCommand(Client $client, $command, $exceptionOnExitCode = true)
 {
     $application = new Application($client->getKernel());
     $application->setAutoExit(false);
     $input = new StringInput($command);
     $output = new StreamOutput($fp = tmpfile());
     $application->setCatchExceptions(false);
     $return = $application->run($input, $output);
     fseek($fp, 0);
     $output = '';
     while (!feof($fp)) {
         $output .= fread($fp, 4096);
     }
     fclose($fp);
     if ($exceptionOnExitCode && $return !== 0) {
         throw new \RuntimeException(sprintf('Return code is not 0: %s', $output));
     }
     return $output;
 }
开发者ID:awesemo,项目名称:cms-sandbox,代码行数:22,代码来源:CommandTestCase.php


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