@@ -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() |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | |
30 | 30 | public static function setUpBeforeClass() |
31 | 31 | { |
32 | - self::$fixturesPath = __DIR__.'/../Fixtures/'; |
|
33 | - require_once self::$fixturesPath.'/TestCommand.php'; |
|
32 | + self::$fixturesPath = __DIR__ . '/../Fixtures/'; |
|
33 | + require_once self::$fixturesPath . '/TestCommand.php'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function testConstructor() |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $tester->execute(array(), array('interactive' => true)); |
229 | 229 | |
230 | - $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); |
|
230 | + $this->assertEquals('interact called' . PHP_EOL . 'execute called' . PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | public function testRunNonInteractive() |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $tester->execute(array(), array('interactive' => false)); |
238 | 238 | |
239 | - $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); |
|
239 | + $this->assertEquals('execute called' . PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | public function testSetCode() |
285 | 285 | { |
286 | 286 | $command = new \TestCommand(); |
287 | - $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) { |
|
287 | + $ret = $command->setCode(function(InputInterface $input, OutputInterface $output) { |
|
288 | 288 | $output->writeln('from the code...'); |
289 | 289 | }); |
290 | 290 | $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); |
291 | 291 | $tester = new CommandTester($command); |
292 | 292 | $tester->execute(array()); |
293 | - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); |
|
293 | + $this->assertEquals('interact called' . PHP_EOL . 'from the code...' . PHP_EOL, $tester->getDisplay()); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | public function testSetCodeWithNonClosureCallable() |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); |
301 | 301 | $tester = new CommandTester($command); |
302 | 302 | $tester->execute(array()); |
303 | - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); |
|
303 | + $this->assertEquals('interact called' . PHP_EOL . 'from the code...' . PHP_EOL, $tester->getDisplay()); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $command->setApplication(new Application()); |
330 | 330 | $tester = new CommandTester($command); |
331 | 331 | $tester->execute(array('command' => $command->getName())); |
332 | - $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); |
|
332 | + $this->assertStringEqualsFile(self::$fixturesPath . '/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -343,6 +343,6 @@ discard block |
||
343 | 343 | $command->setApplication(new Application()); |
344 | 344 | $tester = new CommandTester($command); |
345 | 345 | $tester->execute(array('command' => $command->getName())); |
346 | - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); |
|
346 | + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); |
|
347 | 347 | } |
348 | 348 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | public function testExecuteListsCommandsWithNamespaceArgument() |
51 | 51 | { |
52 | - require_once realpath(__DIR__.'/../Fixtures/FooCommand.php'); |
|
52 | + require_once realpath(__DIR__ . '/../Fixtures/FooCommand.php'); |
|
53 | 53 | $application = new Application(); |
54 | 54 | $application->add(new \FooCommand()); |
55 | 55 | $commandTester = new CommandTester($command = $application->get('list')); |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | |
100 | 100 | $this->assertEquals( |
101 | 101 | "(\033[32mz>=2.0,<a2.3\033[39m)", |
102 | - $formatter->format('(<info>'.$formatter->escape('z>=2.0,<a2.3').'</info>)') |
|
102 | + $formatter->format('(<info>' . $formatter->escape('z>=2.0,<a2.3') . '</info>)') |
|
103 | 103 | ); |
104 | 104 | |
105 | 105 | $this->assertEquals( |
106 | 106 | "\033[32m<error>some error</error>\033[39m", |
107 | - $formatter->format('<info>'.$formatter->escape('<error>some error</error>').'</info>') |
|
107 | + $formatter->format('<info>' . $formatter->escape('<error>some error</error>') . '</info>') |
|
108 | 108 | ); |
109 | 109 | } |
110 | 110 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $formatter = new OutputFormatter(true); |
165 | 165 | $long = str_repeat("\\", 14000); |
166 | - $this->assertEquals("\033[37;41msome error\033[39;49m".$long, $formatter->format('<error>some error</error>'.$long)); |
|
166 | + $this->assertEquals("\033[37;41msome error\033[39;49m" . $long, $formatter->format('<error>some error</error>' . $long)); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function testNotDecoratedFormatter() |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | ); |
38 | 38 | |
39 | 39 | $this->assertEquals( |
40 | - '<error> Some text to display </error>'."\n". |
|
40 | + '<error> Some text to display </error>' . "\n" . |
|
41 | 41 | '<error> foo bar </error>', |
42 | 42 | $formatter->formatBlock(array('Some text to display', 'foo bar'), 'error'), |
43 | 43 | '::formatBlock() formats a message in a block' |
44 | 44 | ); |
45 | 45 | |
46 | 46 | $this->assertEquals( |
47 | - '<error> </error>'."\n". |
|
48 | - '<error> Some text to display </error>'."\n". |
|
47 | + '<error> </error>' . "\n" . |
|
48 | + '<error> Some text to display </error>' . "\n" . |
|
49 | 49 | '<error> </error>', |
50 | 50 | $formatter->formatBlock('Some text to display', 'error', true), |
51 | 51 | '::formatBlock() formats a message in a block' |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $formatter = new FormatterHelper(); |
62 | 62 | |
63 | 63 | $this->assertEquals( |
64 | - '<error> </error>'."\n". |
|
65 | - '<error> Du texte à afficher </error>'."\n". |
|
64 | + '<error> </error>' . "\n" . |
|
65 | + '<error> Du texte à afficher </error>' . "\n" . |
|
66 | 66 | '<error> </error>', |
67 | 67 | $formatter->formatBlock('Du texte à afficher', 'error', true), |
68 | 68 | '::formatBlock() formats a message in a block' |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | } |
77 | 77 | $formatter = new FormatterHelper(); |
78 | 78 | $this->assertEquals( |
79 | - '<error> </error>'."\n". |
|
80 | - '<error> 表示するテキスト </error>'."\n". |
|
79 | + '<error> </error>' . "\n" . |
|
80 | + '<error> 表示するテキスト </error>' . "\n" . |
|
81 | 81 | '<error> </error>', |
82 | 82 | $formatter->formatBlock('表示するテキスト', 'error', true), |
83 | 83 | '::formatBlock() formats a message in a block' |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $formatter = new FormatterHelper(); |
90 | 90 | |
91 | 91 | $this->assertEquals( |
92 | - '<error> </error>'."\n". |
|
93 | - '<error> \<info>some info\</info> </error>'."\n". |
|
92 | + '<error> </error>' . "\n" . |
|
93 | + '<error> \<info>some info\</info> </error>' . "\n" . |
|
94 | 94 | '<error> </error>', |
95 | 95 | $formatter->formatBlock('<info>some info</info>', 'error', true), |
96 | 96 | '::formatBlock() escapes \'<\' chars' |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $progress->advance(2); |
53 | 53 | |
54 | 54 | rewind($output->getStream()); |
55 | - $this->assertEquals($this->generateOutput(' 3 [--->------------------------]').$this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); |
|
55 | + $this->assertEquals($this->generateOutput(' 3 [--->------------------------]') . $this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function testCustomizations() |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $progress->advance(); |
80 | 80 | |
81 | 81 | rewind($output->getStream()); |
82 | - $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%').$this->generateOutput(' 1/50 [>---------------------------] 2%').$this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream())); |
|
82 | + $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%') . $this->generateOutput(' 1/50 [>---------------------------] 2%') . $this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream())); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function testOverwriteWithShorterLine() |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | |
97 | 97 | rewind($output->getStream()); |
98 | 98 | $this->assertEquals( |
99 | - $this->generateOutput(' 0/50 [>---------------------------] 0%'). |
|
100 | - $this->generateOutput(' 1/50 [>---------------------------] 2%'). |
|
99 | + $this->generateOutput(' 0/50 [>---------------------------] 0%') . |
|
100 | + $this->generateOutput(' 1/50 [>---------------------------] 2%') . |
|
101 | 101 | $this->generateOutput(' 2/50 [=>--------------------------] '), |
102 | 102 | stream_get_contents($output->getStream()) |
103 | 103 | ); |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | |
115 | 115 | rewind($output->getStream()); |
116 | 116 | $this->assertEquals( |
117 | - $this->generateOutput(' 0/50 [>---------------------------] 0%'). |
|
118 | - $this->generateOutput(' 1/50 [>---------------------------] 2%'). |
|
119 | - $this->generateOutput(' 15/50 [========>-------------------] 30%'). |
|
117 | + $this->generateOutput(' 0/50 [>---------------------------] 0%') . |
|
118 | + $this->generateOutput(' 1/50 [>---------------------------] 2%') . |
|
119 | + $this->generateOutput(' 15/50 [========>-------------------] 30%') . |
|
120 | 120 | $this->generateOutput(' 25/50 [==============>-------------] 50%'), |
121 | 121 | stream_get_contents($output->getStream()) |
122 | 122 | ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | rewind($output->getStream()); |
185 | 185 | $this->assertEquals( |
186 | - $this->generateOutput(' 25/50 [==============>-------------] 50%').$this->generateOutput(''), |
|
186 | + $this->generateOutput(' 25/50 [==============>-------------] 50%') . $this->generateOutput(''), |
|
187 | 187 | stream_get_contents($output->getStream()) |
188 | 188 | ); |
189 | 189 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $progress->advance(); |
198 | 198 | |
199 | 199 | rewind($output->getStream()); |
200 | - $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%').$this->generateOutput(' 199/200 [===========================>] 99%').$this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream())); |
|
200 | + $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%') . $this->generateOutput(' 199/200 [===========================>] 99%') . $this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream())); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | public function testNonDecoratedOutput() |
@@ -227,6 +227,6 @@ discard block |
||
227 | 227 | |
228 | 228 | $this->lastMessagesLength = strlen($expectedout); |
229 | 229 | |
230 | - return "\x0D".$expectedout; |
|
230 | + return "\x0D" . $expectedout; |
|
231 | 231 | } |
232 | 232 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $output = $this->getOutputStream(StreamOutput::VERBOSITY_NORMAL); |
40 | 40 | |
41 | 41 | $executed = false; |
42 | - $callback = function () use (&$executed) { $executed = true; }; |
|
42 | + $callback = function() use (&$executed) { $executed = true; }; |
|
43 | 43 | |
44 | 44 | $helper->run($output, 'php -r "echo 42;"', null, $callback); |
45 | 45 | $this->assertTrue($executed); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | array('', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null), |
97 | 97 | array($syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), |
98 | 98 | array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null), |
99 | - array($errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), |
|
100 | - array($syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), |
|
101 | - array($syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), |
|
99 | + array($errorMessage . PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), |
|
100 | + array($syntaxErrorOutputVerbose . $errorMessage . PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), |
|
101 | + array($syntaxErrorOutputDebug . $errorMessage . PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), |
|
102 | 102 | array($successOutputProcessDebug, array('php', '-r', 'echo 42;'), StreamOutput::VERBOSITY_DEBUG, null), |
103 | 103 | array($successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null), |
104 | 104 | ); |