10000 minor #27046 [HttpKernel] Remove decoration from actual output in tes… · symfony/symfony@778d47f · GitHub
[go: up one dir, main page]

Skip to content

Commit 778d47f

Browse files
minor #27046 [HttpKernel] Remove decoration from actual output in tests (chalasr)
This PR was merged into the 2.7 branch. Discussion ---------- [HttpKernel] Remove decoration from actual output in tests | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes green again | Fixed tickets | n/a | License | MIT | Doc PR | n/a AppVeyor has color support since #26910, that breaks the build. Fixes it by removing decoration from tested DumpDataCollector CLI outputs, same as what's already done for HTML dumps Commits ------- c4daef9 [VarDumper] Remove decoration from actual output in tests
2 parents 9afb41e + c4daef9 commit 778d47f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testCollectDefault()
6767

6868
ob_start();
6969
$collector->collect(new Request(), new Response());
70-
$output = ob_get_clean();
70+
$output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
7171

7272
if (\PHP_VERSION_ID >= 50400) {
7373
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
@@ -125,10 +125,11 @@ public function testFlush()
125125

126126
ob_start();
127127
$collector->__destruct();
128+
$output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
128129
if (\PHP_VERSION_ID >= 50400) {
129-
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
130+
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output);
130131
} else {
131-
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
132+
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", $output);
132133
}
133134
}
134135

@@ -141,10 +142,11 @@ public function testFlushNothingWhenDataDumperIsProvided()
141142
ob_start();
142143
$collector->dump($data);
143144
$line = __LINE__ - 1;
145+
$output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
144146
if (\PHP_VERSION_ID >= 50400) {
145-
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
147+
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output);
146148
} else {
147-
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
149+
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", $output);
148150
}
149151

150152
ob_start();

0 commit comments

Comments
 (0)
0