Skip to content

Commit

Permalink
minor #31001 [Console] fix resetting the COLUMN environment variable …
Browse files Browse the repository at this point in the history
…(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
  • Loading branch information
fabpot committed Apr 8, 2019
2 parents d7a8b3d + 8fb2074 commit d3eae71
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
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
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
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
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 d3eae71

Please sign in to comment.