X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fhttp-kernel%2FTests%2FDataCollector%2FDumpDataCollectorTest.php;h=d809331cb09980c5b5047bbd7ff5011212cfc013;hb=9e65bae52407293a5182f19dc57b5628b09e92f4;hp=e642e3c33715fa89a419b6699d2a01878c4ec77f;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php index e642e3c33..d809331cb 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\CliDumper; /** * @author Nicolas Grekas @@ -35,7 +36,7 @@ class DumpDataCollectorTest extends TestCase $this->assertSame(1, $collector->getDumpsCount()); $dump = $collector->getDumps('html'); - $this->assertTrue(isset($dump[0]['data'])); + $this->assertArrayHasKey('data', $dump[0]); $dump[0]['data'] = preg_replace('/^.*?
collect(new Request(), new Response());
-        $output = ob_get_clean();
+        $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
 
         $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
         $this->assertSame(1, $collector->getDumpsCount());
@@ -110,6 +111,28 @@ EOTXT;
 
         ob_start();
         $collector->__destruct();
-        $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
+        $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
+        $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output);
+    }
+
+    public function testFlushNothingWhenDataDumperIsProvided()
+    {
+        $data = new Data(array(array(456)));
+        $dumper = new CliDumper('php://output');
+        $collector = new DumpDataCollector(null, null, null, null, $dumper);
+
+        ob_start();
+        $collector->dump($data);
+        $line = __LINE__ - 1;
+        $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
+        if (\PHP_VERSION_ID >= 50400) {
+            $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output);
+        } else {
+            $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", $output);
+        }
+
+        ob_start();
+        $collector->__destruct();
+        $this->assertEmpty(ob_get_clean());
     }
 }