@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | foreach ($this->tokens as $token) { |
| 288 | 288 | foreach ($values as $value) { |
| 289 | - if ($token === $value || 0 === strpos($token, $value.'=')) { |
|
| 289 | + if ($token === $value || 0 === strpos($token, $value . '=')) { |
|
| 290 | 290 | return true; |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $token = array_shift($tokens); |
| 316 | 316 | |
| 317 | 317 | foreach ($values as $value) { |
| 318 | - if ($token === $value || 0 === strpos($token, $value.'=')) { |
|
| 318 | + if ($token === $value || 0 === strpos($token, $value . '=')) { |
|
| 319 | 319 | if (false !== $pos = strpos($token, '=')) { |
| 320 | 320 | return substr($token, $pos + 1); |
| 321 | 321 | } |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | public function __toString() |
| 337 | 337 | { |
| 338 | 338 | $self = $this; |
| 339 | - $tokens = array_map(function ($token) use ($self) { |
|
| 339 | + $tokens = array_map(function($token) use ($self) { |
|
| 340 | 340 | if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { |
| 341 | - return $match[1].$self->escapeToken($match[2]); |
|
| 341 | + return $match[1] . $self->escapeToken($match[2]); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | if ($token && $token[0] !== '-') { |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $params = array(); |
| 123 | 123 | foreach ($this->parameters as $param => $val) { |
| 124 | 124 | if ($param && '-' === $param[0]) { |
| 125 | - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); |
|
| 125 | + $params[] = $param . ('' != $val ? '=' . $this->escapeToken($val) : ''); |
|
| 126 | 126 | } else { |
| 127 | 127 | $params[] = $this->escapeToken($val); |
| 128 | 128 | } |
@@ -398,11 +398,11 @@ |
||
| 398 | 398 | $elements = array(); |
| 399 | 399 | foreach ($this->getOptions() as $option) { |
| 400 | 400 | $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; |
| 401 | - $elements[] = sprintf('['.($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')).']', $shortcut, $option->getName()); |
|
| 401 | + $elements[] = sprintf('[' . ($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')) . ']', $shortcut, $option->getName()); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | foreach ($this->getArguments() as $argument) { |
| 405 | - $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName().($argument->isArray() ? '1' : '')); |
|
| 405 | + $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName() . ($argument->isArray() ? '1' : '')); |
|
| 406 | 406 | |
| 407 | 407 | if ($argument->isArray()) { |
| 408 | 408 | $elements[] = sprintf('... [%sN]', $argument->getName()); |
@@ -64,11 +64,11 @@ |
||
| 64 | 64 | $cursor = 0; |
| 65 | 65 | while ($cursor < $length) { |
| 66 | 66 | if (preg_match('/\s+/A', $input, $match, null, $cursor)) { |
| 67 | - } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { |
|
| 68 | - $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); |
|
| 69 | - } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { |
|
| 67 | + } elseif (preg_match('/([^="\'\s]+?)(=?)(' . self::REGEX_QUOTED_STRING . '+)/A', $input, $match, null, $cursor)) { |
|
| 68 | + $tokens[] = $match[1] . $match[2] . stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); |
|
| 69 | + } elseif (preg_match('/' . self::REGEX_QUOTED_STRING . '/A', $input, $match, null, $cursor)) { |
|
| 70 | 70 | $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)); |
| 71 | - } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { |
|
| 71 | + } elseif (preg_match('/' . self::REGEX_STRING . '/A', $input, $match, null, $cursor)) { |
|
| 72 | 72 | $tokens[] = stripcslashes($match[1]); |
| 73 | 73 | } else { |
| 74 | 74 | // should never happen |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | protected function doWrite($message, $newline) |
| 76 | 76 | { |
| 77 | - if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) { |
|
| 77 | + if (false === @fwrite($this->stream, $message . ($newline ? PHP_EOL : ''))) { |
|
| 78 | 78 | // should never happen |
| 79 | 79 | throw new \RuntimeException('Unable to write output.'); |
| 80 | 80 | } |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $errorMessage = $this->errorMessage; |
| 119 | 119 | $multiselect = $this->multiselect; |
| 120 | 120 | |
| 121 | - return function ($selected) use ($choices, $errorMessage, $multiselect) { |
|
| 121 | + return function($selected) use ($choices, $errorMessage, $multiselect) { |
|
| 122 | 122 | // Collapse all spaces. |
| 123 | 123 | $selectedChoices = str_replace(' ', '', $selected); |
| 124 | 124 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $default = $this->getDefault(); |
| 42 | 42 | |
| 43 | - return function ($answer) use ($default) { |
|
| 43 | + return function($answer) use ($default) { |
|
| 44 | 44 | if (is_bool($answer)) { |
| 45 | 45 | return $answer; |
| 46 | 46 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $this->hasReadline = function_exists('readline'); |
| 47 | 47 | $this->application = $application; |
| 48 | - $this->history = getenv('HOME').'/.history_'.$application->getName(); |
|
| 48 | + $this->history = getenv('HOME') . '/.history_' . $application->getName(); |
|
| 49 | 49 | $this->output = new ConsoleOutput(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | ; |
| 104 | 104 | |
| 105 | 105 | $output = $this->output; |
| 106 | - $process->run(function ($type, $data) use ($output) { |
|
| 106 | + $process->run(function($type, $data) use ($output) { |
|
| 107 | 107 | $output->writeln($data); |
| 108 | 108 | }); |
| 109 | 109 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | protected function getPrompt() |
| 146 | 146 | { |
| 147 | 147 | // using the formatter here is required when using readline |
| 148 | - return $this->output->getFormatter()->format($this->application->getName().' > '); |
|
| 148 | + return $this->output->getFormatter()->format($this->application->getName() . ' > '); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | protected function getOutput() |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $list = array('--help'); |
| 190 | 190 | foreach ($command->getDefinition()->getOptions() as $option) { |
| 191 | - $list[] = '--'.$option->getName(); |
|
| 191 | + $list[] = '--' . $option->getName(); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | return $list; |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public static function setUpBeforeClass() |
| 38 | 38 | { |
| 39 | - self::$fixturesPath = realpath(__DIR__.'/Fixtures/'); |
|
| 40 | - require_once self::$fixturesPath.'/FooCommand.php'; |
|
| 41 | - require_once self::$fixturesPath.'/Foo1Command.php'; |
|
| 42 | - require_once self::$fixturesPath.'/Foo2Command.php'; |
|
| 43 | - require_once self::$fixturesPath.'/Foo3Command.php'; |
|
| 44 | - require_once self::$fixturesPath.'/Foo4Command.php'; |
|
| 45 | - require_once self::$fixturesPath.'/Foo5Command.php'; |
|
| 46 | - require_once self::$fixturesPath.'/FoobarCommand.php'; |
|
| 47 | - require_once self::$fixturesPath.'/BarBucCommand.php'; |
|
| 48 | - require_once self::$fixturesPath.'/FooSubnamespaced1Command.php'; |
|
| 49 | - require_once self::$fixturesPath.'/FooSubnamespaced2Command.php'; |
|
| 39 | + self::$fixturesPath = realpath(__DIR__ . '/Fixtures/'); |
|
| 40 | + require_once self::$fixturesPath . '/FooCommand.php'; |
|
| 41 | + require_once self::$fixturesPath . '/Foo1Command.php'; |
|
| 42 | + require_once self::$fixturesPath . '/Foo2Command.php'; |
|
| 43 | + require_once self::$fixturesPath . '/Foo3Command.php'; |
|
| 44 | + require_once self::$fixturesPath . '/Foo4Command.php'; |
|
| 45 | + require_once self::$fixturesPath . '/Foo5Command.php'; |
|
| 46 | + require_once self::$fixturesPath . '/FoobarCommand.php'; |
|
| 47 | + require_once self::$fixturesPath . '/BarBucCommand.php'; |
|
| 48 | + require_once self::$fixturesPath . '/FooSubnamespaced1Command.php'; |
|
| 49 | + require_once self::$fixturesPath . '/FooSubnamespaced2Command.php'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | protected function normalizeLineBreaks($text) |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function testHelp() |
| 98 | 98 | { |
| 99 | 99 | $application = new Application(); |
| 100 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_gethelp.txt', $this->normalizeLineBreaks($application->getHelp()), '->getHelp() returns a help message'); |
|
| 100 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_gethelp.txt', $this->normalizeLineBreaks($application->getHelp()), '->getHelp() returns a help message'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | public function testAll() |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | $application->setCatchExceptions(true); |
| 480 | 480 | $tester->run(array('command' => 'foo'), array('decorated' => false)); |
| 481 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getDisplay(true), '->setCatchExceptions() sets the catch exception flag'); |
|
| 481 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception1.txt', $tester->getDisplay(true), '->setCatchExceptions() sets the catch exception flag'); |
|
| 482 | 482 | |
| 483 | 483 | $application->setCatchExceptions(false); |
| 484 | 484 | try { |
@@ -500,8 +500,8 @@ discard block |
||
| 500 | 500 | $application = new Application(); |
| 501 | 501 | $application->add(new \FooCommand()); |
| 502 | 502 | $this->ensureStaticCommandHelp($application); |
| 503 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application'); |
|
| 504 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application'); |
|
| 503 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application'); |
|
| 504 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application'); |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | /** |
@@ -514,8 +514,8 @@ discard block |
||
| 514 | 514 | $application = new Application(); |
| 515 | 515 | $application->add(new \FooCommand()); |
| 516 | 516 | $this->ensureStaticCommandHelp($application); |
| 517 | - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); |
|
| 518 | - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); |
|
| 517 | + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); |
|
| 518 | + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | public function testRenderException() |
@@ -528,21 +528,21 @@ discard block |
||
| 528 | 528 | $tester = new ApplicationTester($application); |
| 529 | 529 | |
| 530 | 530 | $tester->run(array('command' => 'foo'), array('decorated' => false)); |
| 531 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getDisplay(true), '->renderException() renders a pretty exception'); |
|
| 531 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception1.txt', $tester->getDisplay(true), '->renderException() renders a pretty exception'); |
|
| 532 | 532 | |
| 533 | 533 | $tester->run(array('command' => 'foo'), array('decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); |
| 534 | 534 | $this->assertContains('Exception trace', $tester->getDisplay(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose'); |
| 535 | 535 | |
| 536 | 536 | $tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false)); |
| 537 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); |
|
| 537 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); |
|
| 538 | 538 | |
| 539 | 539 | $application->add(new \Foo3Command()); |
| 540 | 540 | $tester = new ApplicationTester($application); |
| 541 | 541 | $tester->run(array('command' => 'foo3:bar'), array('decorated' => false)); |
| 542 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 542 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 543 | 543 | |
| 544 | 544 | $tester->run(array('command' => 'foo3:bar'), array('decorated' => true)); |
| 545 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 545 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 546 | 546 | |
| 547 | 547 | $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); |
| 548 | 548 | $application->setAutoExit(false); |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | $tester = new ApplicationTester($application); |
| 553 | 553 | |
| 554 | 554 | $tester->run(array('command' => 'foo'), array('decorated' => false)); |
| 555 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); |
|
| 555 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception4.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | public function testRenderExceptionWithDoubleWidthCharacters() |
@@ -562,28 +562,28 @@ discard block |
||
| 562 | 562 | $application->expects($this->any()) |
| 563 | 563 | ->method('getTerminalWidth') |
| 564 | 564 | ->will($this->returnValue(120)); |
| 565 | - $application->register('foo')->setCode(function () { |
|
| 565 | + $application->register('foo')->setCode(function() { |
|
| 566 | 566 | throw new \Exception('エラーメッセージ'); |
| 567 | 567 | }); |
| 568 | 568 | $tester = new ApplicationTester($application); |
| 569 | 569 | |
| 570 | 570 | $tester->run(array('command' => 'foo'), array('decorated' => false)); |
| 571 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 571 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception_doublewidth1.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 572 | 572 | |
| 573 | 573 | $tester->run(array('command' => 'foo'), array('decorated' => true)); |
| 574 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 574 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception_doublewidth1decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); |
|
| 575 | 575 | |
| 576 | 576 | $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); |
| 577 | 577 | $application->setAutoExit(false); |
| 578 | 578 | $application->expects($this->any()) |
| 579 | 579 | ->method('getTerminalWidth') |
| 580 | 580 | ->will($this->returnValue(32)); |
| 581 | - $application->register('foo')->setCode(function () { |
|
| 581 | + $application->register('foo')->setCode(function() { |
|
| 582 | 582 | throw new \Exception('コマンドの実行中にエラーが発生しました。'); |
| 583 | 583 | }); |
| 584 | 584 | $tester = new ApplicationTester($application); |
| 585 | 585 | $tester->run(array('command' => 'foo'), array('decorated' => false)); |
| 586 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); |
|
| 586 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception_doublewidth2.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | public function testRun() |
@@ -609,19 +609,19 @@ discard block |
||
| 609 | 609 | $tester = new ApplicationTester($application); |
| 610 | 610 | |
| 611 | 611 | $tester->run(array(), array('decorated' => false)); |
| 612 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run1.txt', $tester->getDisplay(true), '->run() runs the list command if no argument is passed'); |
|
| 612 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run1.txt', $tester->getDisplay(true), '->run() runs the list command if no argument is passed'); |
|
| 613 | 613 | |
| 614 | 614 | $tester->run(array('--help' => true), array('decorated' => false)); |
| 615 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if --help is passed'); |
|
| 615 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if --help is passed'); |
|
| 616 | 616 | |
| 617 | 617 | $tester->run(array('-h' => true), array('decorated' => false)); |
| 618 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if -h is passed'); |
|
| 618 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if -h is passed'); |
|
| 619 | 619 | |
| 620 | 620 | $tester->run(array('command' => 'list', '--help' => true), array('decorated' => false)); |
| 621 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if --help is passed'); |
|
| 621 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if --help is passed'); |
|
| 622 | 622 | |
| 623 | 623 | $tester->run(array('command' => 'list', '-h' => true), array('decorated' => false)); |
| 624 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if -h is passed'); |
|
| 624 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if -h is passed'); |
|
| 625 | 625 | |
| 626 | 626 | $tester->run(array('--ansi' => true)); |
| 627 | 627 | $this->assertTrue($tester->getOutput()->isDecorated(), '->run() forces color output if --ansi is passed'); |
@@ -630,10 +630,10 @@ discard block |
||
| 630 | 630 | $this->assertFalse($tester->getOutput()->isDecorated(), '->run() forces color output to be disabled if --no-ansi is passed'); |
| 631 | 631 | |
| 632 | 632 | $tester->run(array('--version' => true), array('decorated' => false)); |
| 633 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if --version is passed'); |
|
| 633 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if --version is passed'); |
|
| 634 | 634 | |
| 635 | 635 | $tester->run(array('-V' => true), array('decorated' => false)); |
| 636 | - $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if -v is passed'); |
|
| 636 | + $this->assertStringEqualsFile(self::$fixturesPath . '/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if -v is passed'); |
|
| 637 | 637 | |
| 638 | 638 | $tester->run(array('command' => 'list', '--quiet' => true)); |
| 639 | 639 | $this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed'); |
@@ -672,10 +672,10 @@ discard block |
||
| 672 | 672 | $tester = new ApplicationTester($application); |
| 673 | 673 | |
| 674 | 674 | $tester->run(array('command' => 'foo:bar', '--no-interaction' => true), array('decorated' => false)); |
| 675 | - $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed'); |
|
| 675 | + $this->assertSame('called' . PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed'); |
|
| 676 | 676 | |
| 677 | 677 | $tester->run(array('command' => 'foo:bar', '-n' => true), array('decorated' => false)); |
| 678 | - $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed'); |
|
| 678 | + $this->assertSame('called' . PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed'); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /** |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | $application |
| 744 | 744 | ->register('foo') |
| 745 | 745 | ->setDefinition(array($def)) |
| 746 | - ->setCode(function (InputInterface $input, OutputInterface $output) {}) |
|
| 746 | + ->setCode(function(InputInterface $input, OutputInterface $output) {}) |
|
| 747 | 747 | ; |
| 748 | 748 | |
| 749 | 749 | $input = new ArrayInput(array('command' => 'foo')); |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | $application->setAutoExit(false); |
| 879 | 879 | $application->setDispatcher($this->getDispatcher()); |
| 880 | 880 | |
| 881 | - $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { |
|
| 881 | + $application->register('foo')->setCode(function(InputInterface $input, OutputInterface $output) { |
|
| 882 | 882 | $output->write('foo.'); |
| 883 | 883 | }); |
| 884 | 884 | |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | $application->setAutoExit(false); |
| 899 | 899 | $application->setCatchExceptions(false); |
| 900 | 900 | |
| 901 | - $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { |
|
| 901 | + $application->register('foo')->setCode(function(InputInterface $input, OutputInterface $output) { |
|
| 902 | 902 | throw new \RuntimeException('foo'); |
| 903 | 903 | }); |
| 904 | 904 | |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | $application->setDispatcher($this->getDispatcher()); |
| 913 | 913 | $application->setAutoExit(false); |
| 914 | 914 | |
| 915 | - $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { |
|
| 915 | + $application->register('foo')->setCode(function(InputInterface $input, OutputInterface $output) { |
|
| 916 | 916 | $output->write('foo.'); |
| 917 | 917 | |
| 918 | 918 | throw new \RuntimeException('foo'); |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | $application->setDispatcher($this->getDispatcher(true)); |
| 930 | 930 | $application->setAutoExit(false); |
| 931 | 931 | |
| 932 | - $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { |
|
| 932 | + $application->register('foo')->setCode(function(InputInterface $input, OutputInterface $output) { |
|
| 933 | 933 | $output->write('foo.'); |
| 934 | 934 | }); |
| 935 | 935 | |
@@ -957,21 +957,21 @@ discard block |
||
| 957 | 957 | protected function getDispatcher($skipCommand = false) |
| 958 | 958 | { |
| 959 | 959 | $dispatcher = new EventDispatcher(); |
| 960 | - $dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use ($skipCommand) { |
|
| 960 | + $dispatcher->addListener('console.command', function(ConsoleCommandEvent $event) use ($skipCommand) { |
|
| 961 | 961 | $event->getOutput()->write('before.'); |
| 962 | 962 | |
| 963 | 963 | if ($skipCommand) { |
| 964 | 964 | $event->disableCommand(); |
| 965 | 965 | } |
| 966 | 966 | }); |
| 967 | - $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($skipCommand) { |
|
| 967 | + $dispatcher->addListener('console.terminate', function(ConsoleTerminateEvent $event) use ($skipCommand) { |
|
| 968 | 968 | $event->getOutput()->write('after.'); |
| 969 | 969 | |
| 970 | 970 | if (!$skipCommand) { |
| 971 | 971 | $event->setExitCode(113); |
| 972 | 972 | } |
| 973 | 973 | }); |
| 974 | - $dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) { |
|
| 974 | + $dispatcher->addListener('console.exception', function(ConsoleExceptionEvent $event) { |
|
| 975 | 975 | $event->getOutput()->writeln('caught.'); |
| 976 | 976 | |
| 977 | 977 | $event->setException(new \LogicException('caught.', $event->getExitCode(), $event->getException())); |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | $tester = new ApplicationTester($application); |
| 993 | 993 | $tester->run(array()); |
| 994 | - $this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); |
|
| 994 | + $this->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); |
|
| 995 | 995 | |
| 996 | 996 | $application = new CustomDefaultCommandApplication(); |
| 997 | 997 | $application->setAutoExit(false); |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | $tester = new ApplicationTester($application); |
| 1000 | 1000 | $tester->run(array()); |
| 1001 | 1001 | |
| 1002 | - $this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); |
|
| 1002 | + $this->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); |
|
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | public function testCanCheckIfTerminalIsInteractive() |