8000 Merge branch '3.4' into 4.2 · symfony/symfony@bbad6e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit bbad6e8

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: Make tests independent from each other
2 parents 5b8a68d + 48bb7c9 commit bbad6e8

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ class ApplicationTest extends TestCase
4141
{
4242
protected static $fixturesPath;
4343

44+
private $colSize;
45+
46+
protected function setUp()
47+
{
48+
$this->colSize = getenv('COLUMNS');
49+
}
50+
4451
public static function setUpBeforeClass()
4552
{
4653
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
@@ -384,6 +391,7 @@ public function testFindWithCommandLoader()
384391
*/
385392
public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage)
386393
{
394+
putenv('COLUMNS=120');
387395
if (method_exists($this, 'expectException')) {
388396
$this->expectException('Symfony\Component\Console\Exception\CommandNotFoundException');
389397
$this->expectExceptionMessage($expectedExceptionMessage);
@@ -515,6 +523,7 @@ public function provideInvalidCommandNamesSingle()
515523

516524
public function testFindAlternativeExceptionMessageMultiple()
517525
{
526+
putenv('COLUMNS=120');
518527
$application = new Application();
519528
$application->add(new \FooCommand());
520529
$application->add(new \Foo1Command());
@@ -1743,6 +1752,7 @@ public function testThrowingErrorListener()
17431752

17441753
protected function tearDown()
17451754
{
1755+
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
17461756
putenv('SHELL_VERBOSITY');
17471757
unset($_ENV['SHELL_VERBOSITY']);
17481758
unset($_SERVER['SHELL_VERBOSITY']);

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323
*/
2424
class ProgressBarTest extends TestCase
2525
{
26+
private $colSize;
27+
28+
protected function setUp()
29+
{
30+
$this->colSize = getenv('COLUMNS');
31+
putenv('COLUMNS=120');
32+
}
33+
34+
protected function tearDown()
35+
{
36+
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
37+
}
38+
2639
public function testMultipleStart()
2740
{
2841
$bar = new ProgressBar($output = $this->getOutputStream());

src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ class SymfonyStyleTest extends TestCase
2626
protected $command;
2727
/** @var CommandTester */
2828
protected $tester;
29+
private $colSize;
2930

3031
protected function setUp()
3132
{
33+
$this->colSize = getenv('COLUMNS');
3234
putenv('COLUMNS=121');
3335
$this->command = new Command('sfstyle');
3436
$this->tester = new CommandTester($this->command);
3537
}
3638

3739
protected function tearDown()
3840
{
39-
putenv('COLUMNS');
41+
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
4042
$this->command = null;
4143
$this->tester = null;
4244
}

src/Symfony/Component/Console/Tests/TerminalTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616

1717
class TerminalTest extends TestCase
1818
{
19+
private $colSize;
20+
private $lineSize;
21+
22+
protected function setUp()
23+
{
24+
$this->colSize = getenv('COLUMNS');
25+
$this->lineSize = getenv('LINES');
26+
}
27+
1928
public function test()
2029
{
2130
putenv('COLUMNS=100');
@@ -31,6 +40,12 @@ public function test()
3140
$this->assertSame(60, $terminal->getHeight());
3241
}
3342

43+
protected function tearDown()
44+
{
45+
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
46+
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
47+
}
48+
3449
public function test_zero_values()
3550
{
3651
putenv('COLUMNS=0');

0 commit comments

Comments
 (0)
0