8000 [VarDumper] Remove decoration from actual output in tests · symfony/symfony@c4daef9 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4daef9

Browse files
author
Robin Chalas
committed
[VarDumper] Remove decoration from actual output in tests
1 parent e775871 commit c4daef9

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