Skip to content

Commit 5378bc9

Browse files
committed
minor symfony#21424 [FrameworkBundle] Revert AbstractDescriptorTest output trimming (ogizanagi)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] Revert AbstractDescriptorTest output trimming | Q | A | ------------- | --- | Branch? | master | Bug fix? | no, but fixes an annoying/unhelping test output and fixes false positives | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | https://github.com/symfony/symfony/pull/21129/files#diff-0e52187cbf1067a310538287da74ddb5R178 | License | MIT | Doc PR | N/A #### Before output when having a failing test, for instance, in a `TextDescriptor` fixture: ```diff There was 1 failure: 1) Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\TextDescriptorTest::testDescribeContainerDefinitionWhichIsAnAlias with data set #1 (Symfony\Component\DependencyInjection\Alias Object (...), ' // This serv...------', Symfony\Component\DependencyInjection\ContainerBuilder Object (...), array('alias_2')) Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -' // This service is an alias for the service service_2 Information for Service "service_2" =================================== ------------------ --------------------------------- Option Value ------------------ --------------------------------- Class Full\Qualified\Class2 Tags tag1 (attr1: val1, attr2: val2) tag1 (attr3: val3) tag2 Calls setMailer Public no Synthetic yes Lazy no Shared yes Abstract no Autowired no Autowiring Types - Required File /path/to/file Factory Service factory.service Factory Method get ------------------ ---------------------------------' +' // This service is an alias for the service service_2 Information for Service "service_2" =================================== ------------------ --------------------------------- Option Value ------------------ --------------------------------- Service ID service_2 Class Full\Qualified\Class2 Tags tag1 (attr1: val1, attr2: val2) tag1 (attr3: val3) tag2 Calls setMailer Public no Synthetic yes Lazy no Shared yes Abstract no Autowired no Autowiring Types - Required File /path/to/file Factory Service factory.service Factory Method get ------------------ ---------------------------------' ``` #### After: ```diff There was 1 failure: 1) Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\TextDescriptorTest::testDescribeContainerDefinitionWhichIsAnAlias with data set #1 (Symfony\Component\DependencyInjection\Alias Object (...), ' // This serv...------', Symfony\Component\DependencyInjection\ContainerBuilder Object (...), array('alias_2')) Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ ------------------ --------------------------------- + Service ID service_2 Class Full\Qualified\Class2 Tags tag1 (attr1: val1, attr2: val2) tag1 (attr3: val3) tag2 Calls setMailer Public no Synthetic yes Lazy no Shared yes Abstract no Autowired no Autowiring Types - Required File /path/to/file Factory Service factory.service Factory Method get ------------------ ---------------------------------' ``` Commits ------- efd00ba [FrameworkBundle] Revert AbstractDescriptorTest output trimming
2 parents bbf91d2 + efd00ba commit 5378bc9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private function assertDescription($expectedDescription, $describedObject, array
193193
if ('json' === $this->getFormat()) {
194194
$this->assertEquals(json_decode($expectedDescription), json_decode($output->fetch()));
195195
} else {
196-
$this->assertEquals(trim(preg_replace('/[\s\t\r]+/', ' ', $expectedDescription)), trim(preg_replace('/[\s\t\r]+/', ' ', str_replace(PHP_EOL, "\n", $output->fetch()))));
196+
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch())));
197197
}
198198
}
199199

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php

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

1616
class TextDescriptorTest extends AbstractDescriptorTest
1717
{
18+
protected function setUp()
19+
{
20+
putenv('COLUMNS=121');
21+
}
22+
23+
protected function tearDown()
24+
{
25+
putenv('COLUMNS');
26+
}
27+
1828
protected function getDescriptor()
1929
{
2030
return new TextDescriptor();

0 commit comments

Comments
 (0)