@@ -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' |
@@ -148,7 +148,7 @@ |
||
148 | 148 | { |
149 | 149 | $progress = $this->getMock('Symfony\Component\Console\Helper\ProgressHelper', array('display')); |
150 | 150 | $progress->expects($this->exactly(4)) |
151 | - ->method('display'); |
|
151 | + ->method('display'); |
|
152 | 152 | |
153 | 153 | $progress->setRedrawFrequency(2); |
154 | 154 |
@@ -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 | } |
@@ -589,6 +589,9 @@ |
||
589 | 589 | return new StreamOutput(fopen('php://memory', 'r+', false), $verbosity, $decorated); |
590 | 590 | } |
591 | 591 | |
592 | + /** |
|
593 | + * @param string $expected |
|
594 | + */ |
|
592 | 595 | protected function generateOutput($expected) |
593 | 596 | { |
594 | 597 | $count = substr_count($expected, "\n"); |
@@ -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 | ); |
@@ -173,7 +173,7 @@ |
||
173 | 173 | $dialog->setHelperSet($helperSet); |
174 | 174 | |
175 | 175 | $error = 'This is not a color!'; |
176 | - $validator = function ($color) use ($error) { |
|
176 | + $validator = function($color) use ($error) { |
|
177 | 177 | if (!in_array($color, array('white', 'black'))) { |
178 | 178 | throw new \InvalidArgumentException($error); |
179 | 179 | } |
@@ -284,7 +284,7 @@ |
||
284 | 284 | $this->assertEquals('-f foo', (string) $input); |
285 | 285 | |
286 | 286 | $input = new ArgvInput(array('cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C")); |
287 | - $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); |
|
287 | + $this->assertEquals('-f --bar=foo ' . escapeshellarg('a b c d') . ' ' . escapeshellarg("A\nB'C"), (string) $input); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -133,6 +133,6 @@ |
||
133 | 133 | public function testToString() |
134 | 134 | { |
135 | 135 | $input = new ArrayInput(array('-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C")); |
136 | - $this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); |
|
136 | + $this->assertEquals('-f -b=bar --foo=' . escapeshellarg('b a z') . ' --lala Foo ' . escapeshellarg("A\nB'C"), (string) $input); |
|
137 | 137 | } |
138 | 138 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function setUpBeforeClass() |
25 | 25 | { |
26 | - self::$fixtures = __DIR__.'/../Fixtures/'; |
|
26 | + self::$fixtures = __DIR__ . '/../Fixtures/'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function testConstructorArguments() |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | new InputOption('qux', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux option', array('http://foo.com/', 'bar')), |
391 | 391 | new InputOption('qux2', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux2 option', array('foo' => 'bar')), |
392 | 392 | )); |
393 | - $this->assertStringEqualsFile(self::$fixtures.'/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition'); |
|
393 | + $this->assertStringEqualsFile(self::$fixtures . '/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | new InputOption('baz', null, InputOption::VALUE_OPTIONAL, 'The baz option', false), |
409 | 409 | new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL, 'The bar option', 'bar'), |
410 | 410 | )); |
411 | - $this->assertXmlStringEqualsXmlFile(self::$fixtures.'/definition_asxml.txt', $definition->asXml(), '->asXml() returns an XML representation of the InputDefinition'); |
|
411 | + $this->assertXmlStringEqualsXmlFile(self::$fixtures . '/definition_asxml.txt', $definition->asXml(), '->asXml() returns an XML representation of the InputDefinition'); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | protected function initializeArguments() |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'), |
66 | 66 | array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'), |
67 | 67 | array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'), |
68 | - array("'a'\r'b'\n'c'\t'd'", array('a','b','c','d'), '->tokenize() parses whitespace chars between args as spaces'), |
|
68 | + array("'a'\r'b'\n'c'\t'd'", array('a', 'b', 'c', 'd'), '->tokenize() parses whitespace chars between args as spaces'), |
|
69 | 69 | array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'), |
70 | 70 | array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'), |
71 | 71 | array('-a', array('-a'), '->tokenize() parses short options'), |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | $this->assertEquals('-f foo', (string) $input); |
94 | 94 | |
95 | 95 | $input = new StringInput('-f --bar=foo "a b c d"'); |
96 | - $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d'), (string) $input); |
|
96 | + $this->assertEquals('-f --bar=foo ' . escapeshellarg('a b c d'), (string) $input); |
|
97 | 97 | |
98 | - $input = new StringInput('-f --bar=foo \'a b c d\' '."'A\nB\\'C'"); |
|
99 | - $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); |
|
98 | + $input = new StringInput('-f --bar=foo \'a b c d\' ' . "'A\nB\\'C'"); |
|
99 | + $this->assertEquals('-f --bar=foo ' . escapeshellarg('a b c d') . ' ' . escapeshellarg("A\nB'C"), (string) $input); |
|
100 | 100 | } |
101 | 101 | } |
@@ -151,6 +151,6 @@ |
||
151 | 151 | |
152 | 152 | protected function doWrite($message, $newline) |
153 | 153 | { |
154 | - $this->output .= $message.($newline ? "\n" : ''); |
|
154 | + $this->output .= $message . ($newline ? "\n" : ''); |
|
155 | 155 | } |
156 | 156 | } |