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


PHP Application::setCatchExceptions方法代码示例

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


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

示例1: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
 }
开发者ID:aboutcoders,项目名称:enum-serializer-bundle,代码行数:11,代码来源:ServiceConfigurationTest.php

示例2: setupSubject

 /**
  * @before
  */
 public function setupSubject()
 {
     $this->supervisorManager = $this->getMockBuilder('YZ\\SupervisorBundle\\Manager\\SupervisorManager')->disableOriginalConstructor()->getMock();
     self::bootKernel();
     static::$kernel->getContainer()->set('supervisor.manager', $this->supervisorManager);
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
 }
开发者ID:aboutcoders,项目名称:supervisor-command-bundle,代码行数:12,代码来源:SupervisorListCommandTest.php

示例3: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     $this->function_exists = $this->getFunctionMock('Abc\\ProcessControl', 'function_exists');
 }
开发者ID:aboutcoders,项目名称:process-control-bundle,代码行数:12,代码来源:BundleIntegrationTest.php

示例4: getApplication

 /**
  * @return Application
  */
 protected static function getApplication()
 {
     if (null === self::$application) {
         $client = static::createClient();
         self::$application = new Application($client->getKernel());
         self::$application->setAutoExit(false);
         self::$application->setCatchExceptions(false);
     }
     return self::$application;
 }
开发者ID:aboutcoders,项目名称:job-bundle,代码行数:13,代码来源:DatabaseWebTestCase.php

示例5: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     $this->runConsole("doctrine:schema:drop", array("--force" => true));
     $this->runConsole("doctrine:schema:update", array("--force" => true));
 }
开发者ID:aboutcoders,项目名称:file-distribution-bundle,代码行数:14,代码来源:FilesystemManagerIntegrationTest.php

示例6: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     $this->metadataFactory = $this->container->get('abc.job.metadata_factory');
     /** @var ClassMetadata $classMetadata */
     $this->classMetadata = $this->metadataFactory->getMetadataForClass(AnnotatedJob::class)->getRootClassMetadata();
 }
开发者ID:aboutcoders,项目名称:job-bundle,代码行数:14,代码来源:AnnotationTest.php

示例7: initDatabase

 private static function initDatabase()
 {
     $console = new Application(static::$kernel);
     $console->setAutoExit(false);
     /**
      * SQLite is not supported yet
      *
      * @link https://github.com/doctrine/dbal/pull/2402
      */
     $commands = ['doctrine:database:create' => ['--if-not-exists' => true], 'doctrine:schema:drop' => ['--full-database' => true, '--force' => true], 'doctrine:migrations:migrate' => [], 'doctrine:fixtures:load' => []];
     foreach ($commands as $command => $args) {
         /** apply common commands options */
         $args['--env'] = 'test';
         $args['--quiet'] = true;
         $args['--no-interaction'] = true;
         $args['command'] = $command;
         try {
             $console->setCatchExceptions(false);
             $console->run(new ArrayInput($args));
         } catch (\Exception $e) {
             echo PHP_EOL . $e->getMessage() . PHP_EOL;
             echo PHP_EOL . $e->getTraceAsString() . PHP_EOL;
             throw $e;
         }
     }
 }
开发者ID:eugene-matvejev,项目名称:battleship-game-api,代码行数:26,代码来源:AbstractKernelTestSuite.php

示例8: coreTest

 protected function coreTest(array $arguments)
 {
     $input = new ArrayInput($arguments);
     $application = new Application(static::$kernel);
     $application->setCatchExceptions(false);
     $application->doRun($input, new NullOutput());
     // Ensure that all *.meta files are fresh
     $finder = new Finder();
     $metaFiles = $finder->files()->in(static::$kernel->getCacheDir())->name('*.php.meta');
     // simply check that cache is warmed up
     $this->assertGreaterThanOrEqual(1, count($metaFiles));
     foreach ($metaFiles as $file) {
         $configCache = new ConfigCache(substr($file, 0, -5), true);
         $this->assertTrue($configCache->isFresh(), sprintf('Meta file "%s" is not fresh', (string) $file));
     }
     // check that app kernel file present in meta file of container's cache
     $containerRef = new \ReflectionObject(static::$kernel->getContainer());
     $containerFile = $containerRef->getFileName();
     $containerMetaFile = $containerFile . '.meta';
     $kernelRef = new \ReflectionObject(static::$kernel);
     $kernelFile = $kernelRef->getFileName();
     /** @var ResourceInterface[] $meta */
     $meta = unserialize(file_get_contents($containerMetaFile));
     $found = false;
     foreach ($meta as $resource) {
         if ((string) $resource === $kernelFile) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Kernel file should present as resource');
     $this->assertRegExp(sprintf('/\'kernel.name\'\\s*=>\\s*\'%s\'/', static::$kernel->getName()), file_get_contents($containerFile), 'kernel.name is properly set on the dumped container');
     $this->assertEquals(ini_get('memory_limit'), '1024M');
 }
开发者ID:skillberto,项目名称:ConsoleExtendBundle,代码行数:34,代码来源:CacheClearCommandTest.php

示例9: testCacheIsFreshAfterCacheClearedWithWarmup

 public function testCacheIsFreshAfterCacheClearedWithWarmup()
 {
     $input = new ArrayInput(array('cache:clear'));
     $application = new Application($this->kernel);
     $application->setCatchExceptions(false);
     $application->doRun($input, new NullOutput());
     // Ensure that all *.meta files are fresh
     $finder = new Finder();
     $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
     // simply check that cache is warmed up
     $this->assertGreaterThanOrEqual(1, count($metaFiles));
     foreach ($metaFiles as $file) {
         $configCache = new ConfigCache(substr($file, 0, -5), true);
         $this->assertTrue($configCache->isFresh(), sprintf('Meta file "%s" is not fresh', (string) $file));
     }
     // check that app kernel file present in meta file of container's cache
     $containerRef = new \ReflectionObject($this->kernel->getContainer());
     $containerFile = $containerRef->getFileName();
     $containerMetaFile = $containerFile . '.meta';
     $kernelRef = new \ReflectionObject($this->kernel);
     $kernelFile = $kernelRef->getFileName();
     /** @var ResourceInterface[] $meta */
     $meta = unserialize(file_get_contents($containerMetaFile));
     $found = false;
     foreach ($meta as $resource) {
         if ((string) $resource === $kernelFile) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Kernel file should present as resource');
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:32,代码来源:CacheClearCommandTest.php

示例10: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel($this->kernelOptions);
     $this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     if (count($this->entityManagerNames) > 0) {
         foreach ($this->entityManagerNames as $name) {
             $this->runConsole("doctrine:schema:drop", ['--force' => true, '--em' => $name]);
             $this->runConsole("doctrine:schema:update", ['--force' => true, '--em' => $name]);
         }
     } else {
         $this->runConsole("doctrine:schema:drop", array("--force" => true));
         $this->runConsole("doctrine:schema:update", array("--force" => true));
     }
 }
开发者ID:aboutcoders,项目名称:job-bundle,代码行数:20,代码来源:DatabaseKernelTestCase.php

示例11: testExecute

 public function testExecute()
 {
     self::bootKernel();
     $application = new Application(static::$kernel);
     $application->setCatchExceptions(false);
     $application->setAutoExit(false);
     $tester = new ApplicationTester($application);
     $tester->run(['command' => 'api:swagger:export']);
     $this->assertJson($tester->getDisplay());
 }
开发者ID:api-platform,项目名称:core,代码行数:10,代码来源:SwaggerCommandTest.php

示例12: testBundleCommandsHaveRightContainer

 public function testBundleCommandsHaveRightContainer()
 {
     $command = $this->getMockForAbstractClass('Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand', array('foo'), '', true, true, true, array('setContainer'));
     $command->setCode(function () {
     });
     $command->expects($this->exactly(2))->method('setContainer');
     $application = new Application($this->getKernel(array()));
     $application->setAutoExit(false);
     $application->setCatchExceptions(false);
     $application->add($command);
     $tester = new ApplicationTester($application);
     // set container is called here
     $tester->run(array('command' => 'foo'));
     // as the container might have change between two runs, setContainer must called again
     $tester->run(array('command' => 'foo'));
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:16,代码来源:ApplicationTest.php

示例13: testCommand

 /**
  * @dataProvider provideTestCommand
  *
  * @param $command
  * @param $reportFile
  */
 public function testCommand($command, $arguments, $reportFile, $inputStream = null)
 {
     $client = static::createClient();
     $application = new Application($client->getKernel());
     $application->setCatchExceptions(false);
     $output = new BufferedOutput();
     $application->setAutoExit(false);
     if ($inputStream) {
         $application->getHelperSet()->get('dialog')->setInputStream($this->getInputStream($inputStream));
     }
     //We push a empty argument that is ignore by the application and we push the command itself
     array_unshift($arguments, null, $command);
     $application->run(new ArgvInput($arguments), $output);
     if ($this->dev) {
         file_put_contents($reportFile, $this->report($application));
     }
     $this->assertStringEqualsFile($reportFile, $this->report($application));
 }
开发者ID:mpoiriert,项目名称:nucleus-migration-bundle,代码行数:24,代码来源:NucleusMigrationExtensionTest.php

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

示例15: execCommand

 /**
  * Execute a symfony command.
  *
  * $this->executeCommand('sulu:security:user:create', array(
  *     'firstName' => 'foo',
  *     '--option' => 'bar',
  * ));
  *
  * @param string $command Command to execute
  * @param array  $args    Arguments and options
  *
  * @return int Exit code of command
  */
 protected function execCommand($command, $args)
 {
     $kernel = $this->kernel;
     array_unshift($args, $command);
     $input = new ArrayInput($args);
     $application = new Application($kernel);
     $application->all();
     $application->setAutoExit(false);
     $application->setCatchExceptions(false);
     $command = $application->find($command);
     $output = new StreamOutput(fopen('php://memory', 'w', false));
     $exitCode = $application->run($input, $output);
     if ($exitCode !== 0) {
         rewind($output->getStream());
         $output = stream_get_contents($output->getStream());
         throw new \Exception(sprintf('Command in BaseContext exited with code "%s": "%s"', $exitCode, $output));
     }
     return $exitCode;
 }
开发者ID:sulu,项目名称:sulu,代码行数:32,代码来源:BaseContext.php


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