update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -425,7 +425,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
$application->add(new \FooCommand());
|
||||
$application->add(new \Foo1Command());
|
||||
$application->add(new \Foo2Command());
|
||||
$application->add(new \foo3Command());
|
||||
$application->add(new \Foo3Command());
|
||||
|
||||
try {
|
||||
$application->find('Unknown-namespace:Unknown-command');
|
||||
|
@@ -4,10 +4,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
//Ensure that all lines are aligned to the begin of the first one and start with '//' in a very long line comment
|
||||
// ensure long words are properly wrapped in blocks
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->comment(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
|
||||
);
|
||||
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon';
|
||||
$sfStyle = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
|
||||
};
|
||||
|
13
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php
vendored
Normal file
13
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that all lines are aligned to the begin of the first one and start with '//' in a very long line comment
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->comment(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
|
||||
);
|
||||
};
|
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_13.php
vendored
Normal file
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_13.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
// ensure that nested tags have no effect on the color of the '//' prefix
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output->setDecorated(true);
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->comment(
|
||||
'Lorem ipsum dolor sit <comment>amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</comment> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
|
||||
);
|
||||
};
|
17
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_14.php
vendored
Normal file
17
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_14.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that block() behaves properly with a prefix and without type
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->block(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
||||
null,
|
||||
null,
|
||||
'$ ',
|
||||
true
|
||||
);
|
||||
};
|
14
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_15.php
vendored
Normal file
14
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_15.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that block() behaves properly with a type and without prefix
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->block(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
||||
'TEST'
|
||||
);
|
||||
};
|
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php
vendored
Normal file
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that block() output is properly formatted (even padding lines)
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output->setDecorated(true);
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->success(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
||||
'TEST'
|
||||
);
|
||||
};
|
@@ -1,6 +1,4 @@
|
||||
|
||||
// Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
// aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
// Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
|
||||
// sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
||||
§ [CUSTOM] Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophatto
|
||||
§ peristeralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon
|
||||
|
||||
|
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt
vendored
Normal file
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
// Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
// aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
// Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
|
||||
// sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
||||
|
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt
vendored
Normal file
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
[39;49m // [39;49mLorem ipsum dolor sit [33mamet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et [39m
|
||||
[39;49m // [39;49m[33mdolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea [39m
|
||||
[39;49m // [39;49m[33mcommodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla [39m
|
||||
[39;49m // [39;49m[33mpariatur.[39m Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
|
||||
[39;49m // [39;49mid est laborum
|
||||
|
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_14.txt
vendored
Normal file
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_14.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
$ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
$ aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
$ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
||||
$ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
||||
|
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_15.txt
vendored
Normal file
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_15.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
[TEST] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
||||
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
||||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
|
||||
laborum
|
||||
|
8
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt
vendored
Normal file
8
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
[30;42m [39;49m
|
||||
[30;42m [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore [39;49m
|
||||
[30;42m magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo [39;49m
|
||||
[30;42m consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. [39;49m
|
||||
[30;42m Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum [39;49m
|
||||
[30;42m [39;49m
|
||||
|
@@ -29,7 +29,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 1 [->--------------------------]').
|
||||
$this->generateOutput(' 0 [>---------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -44,7 +44,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 1 [->--------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -58,7 +58,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 5 [----->----------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -73,7 +73,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 3 [--->------------------------]').
|
||||
$this->generateOutput(' 5 [----->----------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -89,7 +89,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 9/10 [=========================>--] 90%').
|
||||
' 9/10 [=========================>--] 90%'.
|
||||
$this->generateOutput(' 10/10 [============================] 100%').
|
||||
$this->generateOutput(' 11/11 [============================] 100%'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -99,7 +99,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFormat()
|
||||
{
|
||||
$expected =
|
||||
$this->generateOutput(' 0/10 [>---------------------------] 0%').
|
||||
' 0/10 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 10/10 [============================] 100%').
|
||||
$this->generateOutput(' 10/10 [============================] 100%')
|
||||
;
|
||||
@@ -156,7 +156,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/10 [/ ] 0%').
|
||||
' 0/10 [/ ] 0%'.
|
||||
$this->generateOutput(' 1/10 [_/ ] 10%'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -169,7 +169,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%'),
|
||||
' 0/50 [>---------------------------] 0%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 50/50 [============================] 100%'),
|
||||
' 50/50 [============================] 100%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 1/50 [>---------------------------] 2%').
|
||||
$this->generateOutput(' 2/50 [=>--------------------------] 4%'),
|
||||
@@ -230,7 +230,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 1/50 [>---------------------------] 2%').
|
||||
$this->generateOutput(' 2/50 [=>--------------------------]'),
|
||||
@@ -247,7 +247,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------]').
|
||||
' 0/50 [>---------------------------]'.
|
||||
$this->generateOutput(' 1/50 [>---------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -264,7 +264,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 1/50 [>---------------------------] 2%').
|
||||
$this->generateOutput(' 15/50 [========>-------------------] 30%').
|
||||
@@ -336,7 +336,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 3 [■■■>------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -351,7 +351,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 25/50 [==============>-------------] 50%').
|
||||
$this->generateOutput(''),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -368,7 +368,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/200 [>---------------------------] 0%').
|
||||
' 0/200 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/200 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 199/200 [===========================>] 99%').
|
||||
$this->generateOutput(' 200/200 [============================] 100%'),
|
||||
@@ -468,9 +468,9 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/2 [>---------------------------] 0%')."\n".
|
||||
$this->generateOutput(' 0/3 [#---------------------------] 0%')."\n".
|
||||
rtrim($this->generateOutput(' 0 [>---------------------------]')).
|
||||
' 0/2 [>---------------------------] 0%'."\n".
|
||||
' 0/3 [#---------------------------] 0%'."\n".
|
||||
rtrim(' 0 [>---------------------------]').
|
||||
|
||||
"\033[2A".
|
||||
$this->generateOutput(' 1/2 [==============>-------------] 50%')."\n".
|
||||
@@ -508,7 +508,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
rtrim($this->generateOutput(' 0 [>---------------------------]')).
|
||||
rtrim(' 0 [>---------------------------]').
|
||||
rtrim($this->generateOutput(' 1 [->--------------------------]')).
|
||||
rtrim($this->generateOutput(' 2 [-->-------------------------]')).
|
||||
rtrim($this->generateOutput(' 3 [--->------------------------]')).
|
||||
@@ -531,7 +531,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 3 [>---------------------------]').
|
||||
' 3 [>---------------------------]'.
|
||||
$this->generateOutput(' 2 [=========>------------------]').
|
||||
$this->generateOutput(' 0 [============================]'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -550,7 +550,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(">---------------------------\nfoobar").
|
||||
">---------------------------\nfoobar".
|
||||
$this->generateOutput("=========>------------------\nfoobar").
|
||||
"\x0D\x1B[2K\x1B[1A\x1B[2K".
|
||||
$this->generateOutput("============================\nfoobar"),
|
||||
@@ -582,11 +582,11 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(
|
||||
|
||||
" \033[44;37m Starting the demo... fingers crossed \033[0m\n".
|
||||
' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n".
|
||||
" \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m"
|
||||
).
|
||||
.
|
||||
$this->generateOutput(
|
||||
" \033[44;37m Looks good to me... \033[0m\n".
|
||||
' 4/15 '.str_repeat($done, 7).$progress.str_repeat($empty, 19)." 26%\n".
|
||||
@@ -608,7 +608,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
$bar->start();
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]'),
|
||||
' 0 [>---------------------------]',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
|
||||
@@ -617,7 +617,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
$bar->start();
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/10 [>---------------------------] 0%'),
|
||||
' 0/10 [>---------------------------] 0%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
|
109
vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php
vendored
Normal file
109
vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Console\Tests\Helper;
|
||||
|
||||
use Symfony\Component\Console\Helper\FormatterHelper;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
|
||||
/**
|
||||
* @group tty
|
||||
*/
|
||||
class SymfonyQuestionHelperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAskChoice()
|
||||
{
|
||||
$questionHelper = new SymfonyQuestionHelper();
|
||||
|
||||
$helperSet = new HelperSet(array(new FormatterHelper()));
|
||||
$questionHelper->setHelperSet($helperSet);
|
||||
|
||||
$heroes = array('Superman', 'Batman', 'Spiderman');
|
||||
|
||||
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
|
||||
$question->setMaxAttempts(1);
|
||||
// first answer is an empty answer, we're supposed to receive the default value
|
||||
$this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('What is your favorite superhero? [Spiderman]', $output);
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
|
||||
$question->setMaxAttempts(1);
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
|
||||
$question->setErrorMessage('Input "%s" is not a superhero!');
|
||||
$question->setMaxAttempts(2);
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('Input "Fabien" is not a superhero!', $output);
|
||||
|
||||
try {
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1');
|
||||
$question->setMaxAttempts(1);
|
||||
$questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question);
|
||||
$this->fail();
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertEquals('Value "Fabien" is invalid', $e->getMessage());
|
||||
}
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
|
||||
}
|
||||
|
||||
protected function getInputStream($input)
|
||||
{
|
||||
$stream = fopen('php://memory', 'r+', false);
|
||||
fwrite($stream, $input);
|
||||
rewind($stream);
|
||||
|
||||
return $stream;
|
||||
}
|
||||
|
||||
protected function createOutputInterface()
|
||||
{
|
||||
$output = new StreamOutput(fopen('php://memory', 'r+', false));
|
||||
$output->setDecorated(false);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function createInputInterfaceMock($interactive = true)
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
private function assertOutputContains($expected, StreamOutput $output)
|
||||
{
|
||||
rewind($output->getStream());
|
||||
$stream = stream_get_contents($output->getStream());
|
||||
$this->assertContains($expected, $stream);
|
||||
}
|
||||
}
|
@@ -631,6 +631,25 @@ TABLE;
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\Console\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Style "absent" is not defined.
|
||||
*/
|
||||
public function testIsNotDefinedStyleException()
|
||||
{
|
||||
$table = new Table($this->getOutputStream());
|
||||
$table->setStyle('absent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Style "absent" is not defined.
|
||||
*/
|
||||
public function testGetStyleDefinition()
|
||||
{
|
||||
Table::getStyleDefinition('absent');
|
||||
}
|
||||
|
||||
protected function getOutputStream()
|
||||
{
|
||||
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false);
|
||||
|
@@ -183,7 +183,17 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar'),
|
||||
new InputDefinition(),
|
||||
'Too many arguments.',
|
||||
'No arguments expected, got "foo".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar'),
|
||||
new InputDefinition(array(new InputArgument('number'))),
|
||||
'Too many arguments, expected arguments "number".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar', 'zzz'),
|
||||
new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))),
|
||||
'Too many arguments, expected arguments "number" "county".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '--foo'),
|
||||
|
@@ -19,7 +19,10 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $fixtures;
|
||||
|
||||
protected $foo, $bar, $foo1, $foo2;
|
||||
protected $foo;
|
||||
protected $bar;
|
||||
protected $foo1;
|
||||
protected $foo2;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
|
@@ -54,22 +54,6 @@ class SymfonyStyleTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt'));
|
||||
}
|
||||
|
||||
public function testLongWordsBlockWrapping()
|
||||
{
|
||||
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygovgollhjvhvljfezefeqifzeiqgiqzhrsdgihqzridghqridghqirshdghdghieridgheirhsdgehrsdvhqrsidhqshdgihrsidvqhneriqsdvjzergetsrfhgrstsfhsetsfhesrhdgtesfhbzrtfbrztvetbsdfbrsdfbrn';
|
||||
$wordLength = strlen($word);
|
||||
$maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3;
|
||||
|
||||
$this->command->setCode(function (InputInterface $input, OutputInterface $output) use ($word) {
|
||||
$sfStyle = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
|
||||
});
|
||||
|
||||
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
|
||||
$expectedCount = (int) ceil($wordLength / ($maxLineLength)) + (int) ($wordLength > $maxLineLength - 5);
|
||||
$this->assertSame($expectedCount, substr_count($this->tester->getDisplay(true), ' § '));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user