本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Console\Application::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::find方法的具体用法?PHP Application::find怎么用?PHP Application::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Console\Application
的用法示例。
在下文中一共展示了Application::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecute
public function testExecute()
{
$expected = '/^.+ [a-z0-9]+@local.+api-key: [a-f0-9]+ secret: [a-f0-9]+$/';
$commandTester = new CommandTester($this->instance->find('hayapi:create-user'));
$commandTester->execute(array('username' => $this->userIdentifier, 'email' => $this->userIdentifier, 'password' => $this->userIdentifier), array('interactive'));
$this->assertRegExp($expected, $commandTester->getDisplay());
}
示例2: testCompile
public function testCompile()
{
$command = $this->application->find('help');
$commandTester = new CommandTester($command);
$commandTester->execute([], ['interactive' => false]);
$this->assertTrue(true);
}
示例3: testExecute
public function testExecute()
{
$expected = '/^Hashing pid data/';
$commandTester = new CommandTester($this->instance->find('haytool:pid-obfuscation'));
$commandTester->execute(array());
$this->assertRegExp($expected, $commandTester->getDisplay());
}
示例4: testExecute
public function testExecute()
{
$expected = 'Connection opened to foo:22/path/';
$commandTester = new CommandTester($this->instance->find('haytool:file-upload'));
$commandTester->execute(array());
$this->assertStringStartsWith($expected, $commandTester->getDisplay());
}
示例5: testFixturesRegistering
/**
* @dataProvider loadCommandProvider
*
* @param array $inputs
* @param string $expected
*/
public function testFixturesRegistering(array $inputs, $expected)
{
$command = $this->application->find('hautelook_alice:fixtures:load');
$commandTester = new CommandTester($command);
$commandTester->execute($inputs, ['interactive' => false]);
$this->assertEquals(trim($expected, ' '), trim($commandTester->getDisplay(), ' '));
}
示例6: iRunSyliusInstallSampleDataCommand
/**
* @Given I run Sylius Install Load Sample Data command
*/
public function iRunSyliusInstallSampleDataCommand()
{
$this->application = new Application($this->kernel);
$this->application->add(new InstallSampleDataCommand());
$this->command = $this->application->find('sylius:install:sample-data');
$this->tester = new CommandTester($this->command);
}
示例7: testExecuteWithNoResults
public function testExecuteWithNoResults()
{
$expected = 'No analytics results found for the period, have you completed the rollup?';
$commandTester = new CommandTester($this->instance->find('analytics:daily-rollup'));
$commandTester->execute(array());
$display = $commandTester->getDisplay();
$this->assertContains($expected, $display);
}
示例8: testSkipAllJob
public function testSkipAllJob()
{
$this->mockCronHelper();
$command = $this->application->find('oro:cron');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName(), '--skipCheckDaemon' => true));
$result = $this->runCommand(CronCommand::COMMAND_NAME, []);
$this->assertNotEmpty($result);
$this->checkMessage('AllJobSkip', $result);
}
示例9: commandExists
/**
* Indicates if a command exists
*
* @param string $command A command name (i.e.: cache:clear)
* @return bool
*/
public function commandExists($command)
{
try {
$this->_app->find($command);
$exists = true;
} catch (InvalidArgumentException $e) {
$exists = false;
}
return $exists;
}
示例10: testExecuteWeekly
public function testExecuteWeekly()
{
$expected = '/^(\\w+\\s){5}\\d{4}-\\d{2}-\\d{2}T(00:){2}00\\+0{4}\\s\\w+\\s\\d{4}-\\d{2}-\\d{2}T23:59:59\\+0{4}/';
$commandTester = new CommandTester($this->instance->find('analytics:prepare'));
$commandTester->execute(array('--period' => PrepareAnalyticsCommand::OUTPUT_WEEKLY));
$display = $commandTester->getDisplay();
$this->assertRegExp($expected, $display);
$this->assertContains(PrepareAnalyticsCommand::OUTPUT_WEEKLY, $display);
$this->assertContains('Extracted information on 0 quiz starts', $display);
}
示例11: testExecute
public function testExecute()
{
$expectedUpdate = 'Updated county Bar with id 1';
$expectedCreate = 'Created county Bar with id ' . PHP_INT_MAX;
$path = 'phpunit.xml';
$commandTester = new CommandTester($this->instance->find('haytool:lha-counties'));
$commandTester->execute(array('path' => $path, 'includeFirstLine' => true));
$this->assertStringStartsWith($expectedUpdate, $commandTester->getDisplay());
$commandTester->execute(array('path' => $path, 'includeFirstLine' => true));
$this->assertStringStartsWith($expectedCreate, $commandTester->getDisplay());
}
示例12: testExecute
public function testExecute()
{
$expectedUpdate = 'Updated Authority for Bar with id 1';
$expectedCreate = 'Created Authority for Bar with id ' . PHP_INT_MAX;
$path = 'src/TransformCore/PHE/LocalHealthAuthorityBundle/Tests/Data/import.csv';
$commandTester = new CommandTester($this->instance->find('haytool:lha-authority'));
$commandTester->execute(array('path' => $path));
$this->assertStringStartsWith($expectedUpdate, $commandTester->getDisplay());
$commandTester->execute(array('path' => $path));
$this->assertStringStartsWith($expectedCreate, $commandTester->getDisplay());
}
示例13: testExecute
public function testExecute()
{
$supervisor = $this->getMockBuilder('Supervisor\\Supervisor')->disableOriginalConstructor()->getMock();
$supervisor->expects($this->any())->method('checkConnection')->willReturn(true);
$supervisor->expects($this->any())->method('getName')->willReturn('niceNameFoo');
$this->supervisorManager->expects($this->any())->method('getSupervisors')->willReturn(array($supervisor));
$this->application->add(new SupervisorListCommand());
$command = $this->application->find('abc:supervisor:list');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()));
$this->assertRegExp('/Instance: niceNameFoo/', $commandTester->getDisplay());
}
示例14: testExecute
public function testExecute()
{
$application = new Application($this->kernel);
$application->add(new QueueCreateCommand());
$command = $application->find('jobqueue:create');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName(), 'queue-name' => 'my:queue1', '--timeout' => 10), array('interactive' => false));
$application->add(new QueueDeleteCommand());
$command = $application->find('jobqueue:delete');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName(), 'queue-name' => 'my:queue1'), array('interactive' => false));
$this->assertRegExp('/Queue "my:queue1" deleted/', $commandTester->getDisplay(), 'Deleted queue');
}
示例15: testExecute
/**
* Test execute with all the options
*
* @group command
*/
public function testExecute()
{
static::$application->add(new ImportTranslationsCommand());
$command = static::$application->find("lexik:translations:import");
$command->setContainer(static::$kernel->getContainer());
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName(), 'bundle' => 'LexikTranslationBundle', '--cache-clear' => true, '--force' => true, '--locales' => array('en', 'fr')));
$resultLines = explode("\n", $commandTester->getDisplay());
$this->assertEquals('# LexikTranslationBundle:', $resultLines[0]);
$this->assertLanguageDumped($resultLines[1]);
$this->assertLanguageDumped($resultLines[2]);
$this->assertEquals('Removing translations cache files ...', $resultLines[3]);
}