本文整理汇总了PHP中Symfony\Component\Console\Tester\ApplicationTester::getDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationTester::getDisplay方法的具体用法?PHP ApplicationTester::getDisplay怎么用?PHP ApplicationTester::getDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Tester\ApplicationTester
的用法示例。
在下文中一共展示了ApplicationTester::getDisplay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
/**
* Execute command with tester.
*
* @param string $command
* @param array $args
* @param array $options
* @return string Display result.
*/
protected function exec($command, $args = [], $options = [])
{
$this->tester->run(['command' => $command] + $args, $options);
// Clear realpath cache.
clearstatcache(self::$deployPath);
return $this->tester->getDisplay();
}
示例2: iShouldSee
/**
* @Then I should see:
*/
public function iShouldSee(PyStringNode $content)
{
$displayArray = explode("\n", $this->tester->getDisplay());
array_walk($displayArray, function (&$line) {
$line = rtrim($line);
});
expect($displayArray)->shouldBeLike($content->getStrings());
}
示例3: test_CommandSkipsExisitingUsers_IfSkipExistingOptionUsed
public function test_CommandSkipsExisitingUsers_IfSkipExistingOptionUsed()
{
$this->addPreexistingSuperUser();
$result = $this->applicationTester->run(array('command' => 'loginldap:synchronize-users', '--login' => array('ironman', 'captainamerica'), '--skip-existing' => true, '-v' => true));
$this->assertEquals(0, $result, $this->getCommandDisplayOutputErrorMessage());
$this->assertContains("Skipping 'captainamerica', already exists in Piwik...", $this->applicationTester->getDisplay());
$users = $this->getLdapUserLogins();
$this->assertEquals(array('ironman'), $users);
}
示例4: iRunCommand
/**
* @param string $command
* @param string $file
* @param PyStringNode $options
*
* @When /^I run (?P<command>[a-zA-Z0-9\.\:]*) command with file \"(?P<file>[^\"]*)\"$/
* @When /^I run (?P<command>[a-zA-Z0-9\.\:]*) command with file \"(?P<file>[^\"]*)\" and options:$/
*/
public function iRunCommand($command, $file = null, PyStringNode $options = null)
{
$arguments = array('command' => $command, 'name' => 'Test');
$arguments['configuration-file'] = __DIR__ . "/../../" . $file;
$options = $this->parseOptions($options);
$arguments += $options;
$runOptions = array('interactive' => false, 'decorated' => false);
$this->lastExitCode = $this->tester->run($arguments, $runOptions);
$this->lastDisplay = $this->tester->getDisplay();
}
示例5: testLimit
public function testLimit()
{
$app = new Application();
$app->add(new FizzBuzzCommand());
$app->setAutoExit(false);
// For testing
$tester = new ApplicationTester($app);
$tester->run(array('--limit' => '15'), array('decorated' => false));
$this->assertContains("14", $tester->getDisplay(true));
$this->assertContains("Fizz Buzz", $tester->getDisplay(true));
$this->assertNotContains("16", $tester->getDisplay(true));
}
示例6: test_FixDuplicateLogActions_CorrectlyRemovesDuplicates_AndFixesReferencesInOtherTables
public function test_FixDuplicateLogActions_CorrectlyRemovesDuplicates_AndFixesReferencesInOtherTables()
{
$result = $this->applicationTester->run(array('command' => 'core:fix-duplicate-log-actions', '--invalidate-archives' => 0, '-vvv' => false));
$this->assertEquals(0, $result, "Command failed: " . $this->applicationTester->getDisplay());
$this->assertDuplicateActionsRemovedFromLogActionTable();
$this->assertDuplicatesFixedInLogLinkVisitActionTable();
$this->assertDuplicatesFixedInLogConversionTable();
$this->assertDuplicatesFixedInLogConversionItemTable();
$this->assertContains("Found and deleted 7 duplicate action entries", $this->applicationTester->getDisplay());
$expectedAffectedArchives = array(array('idsite' => '1', 'server_time' => '2012-01-01'), array('idsite' => '2', 'server_time' => '2013-01-01'), array('idsite' => '1', 'server_time' => '2012-02-01'), array('idsite' => '2', 'server_time' => '2012-01-09'), array('idsite' => '2', 'server_time' => '2012-03-01'));
foreach ($expectedAffectedArchives as $archive) {
$this->assertContains("[ idSite = {$archive['idsite']}, date = {$archive['server_time']} ]", $this->applicationTester->getDisplay());
}
}
示例7: testRunWithConfigThrowExceptionIfExtensionClassDoesNotImplementsInterface
public function testRunWithConfigThrowExceptionIfExtensionClassDoesNotImplementsInterface()
{
$application = new ApplicationTester($this->carew);
$statusCode = $application->run(array('command' => 'list', '--base-dir' => __DIR__ . '/Command/fixtures/config-exception-class-not-implements'));
$this->assertSame(1, $statusCode);
$this->assertContains('The class "stdClass" does not implements ExtensionInterface. See "config.yml".', $application->getDisplay());
}
示例8: checkApplicationOutput
private function checkApplicationOutput($output)
{
$expected = $this->normalize($output);
$actual = $this->normalize($this->tester->getDisplay(true));
if (strpos($actual, $expected) === false) {
throw new \Exception(sprintf("Application output did not contain expected '%s'. Actual output:\n'%s'", $expected, $this->tester->getDisplay()));
}
}
示例9: testRun
public function testRun()
{
$application = new Application();
$application->setAutoExit(false);
$applicationTester = new ApplicationTester($application);
$applicationTester->run([]);
$this->assertContains('WebHelper version 0.2', $applicationTester->getDisplay([]));
}
示例10: testExecute
public function testExecute()
{
$application = new Stratum();
$application->setAutoExit(false);
$tester = new ApplicationTester($application);
$tester->run(['config file' => 'test/MySql/etc/stratum.cfg']);
$this->assertSame(0, $tester->getStatusCode(), $tester->getDisplay());
}
示例11: testLoadedCommandRuns
public function testLoadedCommandRuns()
{
$this->markTestSkipped('The ' . __CLASS__ . ' Symfony ... Console App ... so difficult to extend and test :[');
$consoleApp = new Console();
$consoleApp->setAutoExit(false);
$tester = new ApplicationTester($consoleApp);
$tester->run(array('command' => 'test:command', 'name' => 'Skip', '--skip-app-path' => './tests/fixtures/app'));
$this->assertContains('Nice name you got there, Skip.', $tester->getDisplay());
}
示例12: testDebugOutput
/**
* Confirm that all the core commands with bootstrap level
* `BOOT_SUGAR_ROOT` will be available by default.
*/
public function testDebugOutput()
{
$kernel = $this->getKernel(Kernel::BOOT_INSULIN, null, true);
$insulin = new Application($kernel);
$insulin->setAutoExit(false);
$insulinTester = new ApplicationTester($insulin);
$insulinTester->run(array('command' => 'list'));
$this->assertRegExp('/Memory usage: (.*)MB \\(peak: (.*)MB\\), time: (.*)s/', $insulinTester->getDisplay());
}
示例13: testInvalidConnectionCausesError
public function testInvalidConnectionCausesError()
{
$kernel = $this->createKernel('badconn.yml');
$console = new Application($kernel);
$console->setAutoExit(false);
$tester = new ApplicationTester($console);
$this->assertGreaterThan(0, $tester->run(['pheanstalk:stats', 'tube' => ['default']]));
$this->assertContains('Pheanstalk\\Exception', $tester->getDisplay());
}
示例14: testAddsCommands
/**
* @covers ImboCli\Application::__construct
*/
public function testAddsCommands()
{
$application = new Application();
$application->setAutoExit(false);
$applicationTester = new ApplicationTester($application);
$applicationTester->run(array('command' => 'list'));
$output = $applicationTester->getDisplay();
$this->assertContains('generate-private-key', $output);
}
示例15: testTestBeforeAndAfterAncestryCommand
public function testTestBeforeAndAfterAncestryCommand()
{
$application = new Application($this->container);
$application->setAutoExit(false);
$applicationTester = new ApplicationTester($application);
$applicationTester->run(array("command" => "testAncestry1", "--verbose" => 3));
$output = $applicationTester->getDisplay();
$this->assertRegExp("/Skip a before task testAncestry1 to prevent infinite loop. Because of existing it in ancestry tasks./", $output);
// echo $output;
}