Merge branch '4.2'
* 4.2: Make tests independent from each other
This commit is contained in:
commit
e02cbe918a
@ -41,6 +41,13 @@ class ApplicationTest extends TestCase
|
|||||||
{
|
{
|
||||||
protected static $fixturesPath;
|
protected static $fixturesPath;
|
||||||
|
|
||||||
|
private $colSize;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->colSize = getenv('COLUMNS');
|
||||||
|
}
|
||||||
|
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
|
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
|
||||||
@ -384,6 +391,7 @@ class ApplicationTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage)
|
public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage)
|
||||||
{
|
{
|
||||||
|
putenv('COLUMNS=120');
|
||||||
if (method_exists($this, 'expectException')) {
|
if (method_exists($this, 'expectException')) {
|
||||||
$this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
|
$this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
|
||||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||||
@ -515,6 +523,7 @@ class ApplicationTest extends TestCase
|
|||||||
|
|
||||||
public function testFindAlternativeExceptionMessageMultiple()
|
public function testFindAlternativeExceptionMessageMultiple()
|
||||||
{
|
{
|
||||||
|
putenv('COLUMNS=120');
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->add(new \FooCommand());
|
$application->add(new \FooCommand());
|
||||||
$application->add(new \Foo1Command());
|
$application->add(new \Foo1Command());
|
||||||
@ -1743,6 +1752,7 @@ class ApplicationTest extends TestCase
|
|||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
|
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
|
||||||
putenv('SHELL_VERBOSITY');
|
putenv('SHELL_VERBOSITY');
|
||||||
unset($_ENV['SHELL_VERBOSITY']);
|
unset($_ENV['SHELL_VERBOSITY']);
|
||||||
unset($_SERVER['SHELL_VERBOSITY']);
|
unset($_SERVER['SHELL_VERBOSITY']);
|
||||||
|
@ -23,6 +23,19 @@ use Symfony\Component\Console\Output\StreamOutput;
|
|||||||
*/
|
*/
|
||||||
class ProgressBarTest extends TestCase
|
class ProgressBarTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $colSize;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->colSize = getenv('COLUMNS');
|
||||||
|
putenv('COLUMNS=120');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
|
||||||
|
}
|
||||||
|
|
||||||
public function testMultipleStart()
|
public function testMultipleStart()
|
||||||
{
|
{
|
||||||
$bar = new ProgressBar($output = $this->getOutputStream());
|
$bar = new ProgressBar($output = $this->getOutputStream());
|
||||||
|
@ -26,9 +26,11 @@ class SymfonyStyleTest extends TestCase
|
|||||||
protected $command;
|
protected $command;
|
||||||
/** @var CommandTester */
|
/** @var CommandTester */
|
||||||
protected $tester;
|
protected $tester;
|
||||||
|
private $colSize;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
$this->colSize = getenv('COLUMNS');
|
||||||
putenv('COLUMNS=121');
|
putenv('COLUMNS=121');
|
||||||
$this->command = new Command('sfstyle');
|
$this->command = new Command('sfstyle');
|
||||||
$this->tester = new CommandTester($this->command);
|
$this->tester = new CommandTester($this->command);
|
||||||
@ -36,7 +38,7 @@ class SymfonyStyleTest extends TestCase
|
|||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
putenv('COLUMNS');
|
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
|
||||||
$this->command = null;
|
$this->command = null;
|
||||||
$this->tester = null;
|
$this->tester = null;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,15 @@ use Symfony\Component\Console\Terminal;
|
|||||||
|
|
||||||
class TerminalTest extends TestCase
|
class TerminalTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $colSize;
|
||||||
|
private $lineSize;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->colSize = getenv('COLUMNS');
|
||||||
|
$this->lineSize = getenv('LINES');
|
||||||
|
}
|
||||||
|
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
putenv('COLUMNS=100');
|
putenv('COLUMNS=100');
|
||||||
@ -31,6 +40,12 @@ class TerminalTest extends TestCase
|
|||||||
$this->assertSame(60, $terminal->getHeight());
|
$this->assertSame(60, $terminal->getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
|
||||||
|
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_zero_values()
|
public function test_zero_values()
|
||||||
{
|
{
|
||||||
putenv('COLUMNS=0');
|
putenv('COLUMNS=0');
|
||||||
|
Reference in New Issue
Block a user