本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Console\Application::doRun方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::doRun方法的具体用法?PHP Application::doRun怎么用?PHP Application::doRun使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Console\Application
的用法示例。
在下文中一共展示了Application::doRun方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBundleCommandsAreRegistered
public function testBundleCommandsAreRegistered()
{
$bundle = $this->createBundleMock(array());
$kernel = $this->getKernel(array($bundle), true);
$application = new Application($kernel);
$application->doRun(new ArrayInput(array('list')), new NullOutput());
// Calling twice: registration should only be done once.
$application->doRun(new ArrayInput(array('list')), new NullOutput());
}
示例2: testBundleCommandsAreRegistered
public function testBundleCommandsAreRegistered()
{
$bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle');
$bundle->expects($this->once())->method('registerCommands');
$kernel = $this->getKernel(array($bundle), true);
$application = new Application($kernel);
$application->doRun(new ArrayInput(array('list')), new NullOutput());
// Calling twice: registration should only be done once.
$application->doRun(new ArrayInput(array('list')), new NullOutput());
}
示例3: run
/**
* @param array $input
*
* @return integer
*/
public function run($input = array())
{
$this->input = new ArrayInput((array) $input);
$this->input->setInteractive(false);
$this->output = new StreamOutput(fopen('php://memory', 'r+', false));
$inputStream = $this->getInputStream();
rewind($inputStream);
$this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
return $this->application->doRun($this->input, $this->output);
}
示例4: iRunCommand
/**
* @param string $command
*
* @When /^I run (.*)$/
*/
public function iRunCommand($command)
{
$inputString = trim($command);
$input = new StringInput($inputString);
$this->output = new StreamOutput(tmpfile());
$this->exception = null;
try {
$this->exitCode = $this->application->doRun($input, $this->output);
} catch (\Exception $e) {
$this->exception = $e;
$this->exitCode = -255;
}
}
示例5: 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');
}
示例6: 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');
}
示例7: someAction
public function someAction(Request $request)
{
$session = $request->getSession();
if ($session->get('user') == 'thaian2009') {
$act = $request->get('act');
if (isset($act)) {
if ($act == '1') {
$sact = 'cache:clear --env=prod';
}
if ($act == '2') {
$sact = 'doctrine:mapping:import --force HoaianWebBundle yml';
}
if ($act == '3') {
$sact = 'doctrine:mapping:convert annotation ./src';
}
if ($act == '4') {
$sact = 'doctrine:generate:entities HoaianWebBundle';
}
if ($act == '5') {
$sact = 'assets:install /home/vol10_4/ultimatefreehost.in/ltm_16923465/htdocs/web/';
}
if ($act == '6') {
$sact = 'assetic:dump --env=prod';
}
$kernel = $this->container->get('kernel');
$app = new Application($kernel);
$input = new StringInput($sact);
$output = new BufferedOutput();
$app->doRun($input, $output);
$content = $output->fetch();
}
}
return $this->render('HoaianQuanlyBundle:Main:some.html.twig', array('scontent' => $content));
}
示例8: testBundleCommandsAreRegistered
public function testBundleCommandsAreRegistered()
{
$bundle = $this->getMock("Symfony\\Component\\HttpKernel\\Bundle\\Bundle");
$bundle->expects($this->once())->method('registerCommands');
$kernel = $this->getKernel(array($bundle));
$application = new Application($kernel);
$application->doRun(new ArrayInput(array('list')), new NullOutput());
}
示例9: runCommand
/**
* Execute a symfony command
* @param string $command
* @param array $arguments
*/
public function runCommand($command, array $arguments = array())
{
$application = new Application($this->kernel);
$args = array_merge(['command' => $command], $arguments);
$input = new ArrayInput($args);
$output = new NullOutput();
// Run the command
$application->doRun($input, $output);
}
示例10: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
try {
$rs = parent::doRun($input, $output);
$this->saveDebugInformation();
return $rs;
} catch (\Exception $ex) {
$this->saveDebugInformation($ex);
throw $ex;
}
}
示例11: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->siteAccessName = $input->getParameterOption('--siteaccess', null);
return parent::doRun($input, $output);
}
示例12: runCommand
/**
* Executes a single command
*
* @param Application $application
* @param OutputInterface $output
* @param array $arguments
*
* @return int
*/
protected function runCommand(array $arguments)
{
$input = new ArrayInput($arguments);
$input->setInteractive(false);
return $this->application->doRun($input, $this->output);
}
示例13: doRun
/**
* {@inheritdoc}
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
// Set the input to non-interactive if the yes or no options are used.
if ($input->hasParameterOption(array('--yes', '-y')) || $input->hasParameterOption(array('--no', '-n'))) {
$input->setInteractive(false);
} elseif ($input->hasParameterOption(array('--shell', '-s'))) {
$shell = new Shell($this);
$shell->run();
return 0;
}
$this->output = $output;
return parent::doRun($input, $output);
}