Skip to content

Commit d3eae71

Browse files
committed
minor symfony#31001 [Console] fix resetting the COLUMN environment variable (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [Console] fix resetting the COLUMN environment variable | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 8fb2074 fix resetting the COLUMN environment variable
2 parents d7a8b3d + 8fb2074 commit d3eae71

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ protected function setUp()
4848
$this->colSize = getenv('COLUMNS');
4949
}
5050

51+
protected function tearDown()
52+
{
53+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
54+
putenv('SHELL_VERBOSITY');
55+
unset($_ENV['SHELL_VERBOSITY']);
56+
unset($_SERVER['SHELL_VERBOSITY']);
57+
}
58+
5159
public static function setUpBeforeClass()
5260
{
5361
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
@@ -1698,14 +1706,6 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn
16981706
$this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found');
16991707
}
17001708
}
1701-
1702-
protected function tearDown()
1703-
{
1704-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
1705-
putenv('SHELL_VERBOSITY');
1706-
unset($_ENV['SHELL_VERBOSITY']);
1707-
unset($_SERVER['SHELL_VERBOSITY']);
1708-
}
17091709
}
17101710

17111711
class CustomApplication extends Application

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function setUp()
3131

3232
protected function tearDown()
3333
{
34-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
34+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
3535
}
3636

3737
public function testMultipleStart()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function setUp()
3838

3939
protected function tearDown()
4040
{
41-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
41+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
4242
$this->command = null;
4343
$this->tester = null;
4444
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ protected function setUp()
2525
$this->lineSize = getenv('LINES');
2626
}
2727

28+
protected function tearDown()
29+
{
30+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
31+
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
32+
}
33+
2834
public function test()
2935
{
3036
putenv('COLUMNS=100');
@@ -40,12 +46,6 @@ public function test()
4046
$this->assertSame(60, $terminal->getHeight());
4147
}
4248

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

0 commit comments

Comments
 (0)