Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Fix render exception test #22270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

[Console] Fix render exception test #22270

wants to merge 2 commits into from

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Apr 4, 2017

Q A
Branch? 3.2 and up
Bug fix? yes (regression from #22188 in master)
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #22217 (comment)
License MIT
Doc PR symfony/symfony-docs#...

As pointed out by @chalasr tests are mysteriously broken.. not sure what i missed but this is apparently needed now..

cc @fabpot

@chalasr
Copy link
Member

chalasr commented Apr 4, 2017

I confirm this fixes the console test which is broken on 3.2 + master, to be merged in 3.2.
However, some FrameworkBundle tests remain broken from 2.8 up to master, not sure if it related to the same change. (console descriptors, see appveyor, familiar to you? I can try to look into otherwise).

Status: reviewed

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 4, 2017

Confirming this affects 3.2 as well (2.7 + 2.8 are good)

Note im only testing ./phpunit src/Symfony/Component/Console/Tests/ApplicationTest.php --filter testRenderExceptionEscapesLine currently.

@ro0NL ro0NL changed the base branch from master to 3.2 April 4, 2017 09:44
@chalasr
Copy link
Member

chalasr commented Apr 4, 2017

@ro0NL In fact this test relies on the deprecated getTerminalWidth(), that's where the merge went wrong, the need for putenv is normal. Here is the patch:

diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 61a9e97..072f0d0 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -588,11 +588,8 @@ class ApplicationTest extends TestCase
 
     public function testRenderExceptionEscapesLines()
     {
-        $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
+        $application = new Application();
         $application->setAutoExit(false);
-        $application->expects($this->any())
-            ->method('getTerminalWidth')
-            ->will($this->returnValue(22));
         putenv('COLUMNS=22');
         $application->register('foo')->setCode(function () {
             throw new \Exception('dont break here <info>!</info>');

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 4, 2017

Thanks. Fixed it.. i guess the $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX; confused me.. :)

👍

@fabpot
Copy link
Member

fabpot commented Apr 4, 2017

Thank you @ro0NL.

fabpot added a commit that referenced this pull request Apr 4, 2017
This PR was squashed before being merged into the 3.2 branch (closes #22270).

Discussion
----------

[Console] Fix render exception test

| Q             | A
| ------------- | ---
| Branch?       | 3.2 and up
| Bug fix?      | yes (regression from #22188 in master)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22217 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

As pointed out by @chalasr tests are mysteriously broken.. not sure what i missed but this is apparently needed now..

cc @fabpot

Commits
-------

6b71722 [Console] Fix render exception test
@fabpot fabpot closed this Apr 4, 2017
@ro0NL ro0NL deleted the console/render-exception branch April 4, 2017 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants