Skip to content

Commit

Permalink
fix resetting the COLUMN environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Apr 8, 2019
1 parent d7a8b3d commit 8fb2074
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/Symfony/Component/Console/Tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ protected function setUp()
$this->colSize = getenv('COLUMNS');
}

protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
putenv('SHELL_VERBOSITY');
unset($_ENV['SHELL_VERBOSITY']);
unset($_SERVER['SHELL_VERBOSITY']);
}

public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
Expand Down Expand Up @@ -1698,14 +1706,6 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn
$this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found');
}
}

protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
putenv('SHELL_VERBOSITY');
unset($_ENV['SHELL_VERBOSITY']);
unset($_SERVER['SHELL_VERBOSITY']);
}
}

class CustomApplication extends Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function setUp()

protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
}

public function testMultipleStart()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function setUp()

protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
$this->command = null;
$this->tester = null;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Symfony/Component/Console/Tests/TerminalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ protected function setUp()
$this->lineSize = getenv('LINES');
}

protected function tearDown()
{
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
}

public function test()
{
putenv('COLUMNS=100');
Expand All @@ -40,12 +46,6 @@ public function test()
$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()
{
putenv('COLUMNS=0');
Expand Down

0 comments on commit 8fb2074

Please sign in to comment.