4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\VarDumper\Test;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\VarDumper\Cloner\VarCloner;
16 use Symfony\Component\VarDumper\Dumper\CliDumper;
19 * @author Nicolas Grekas <p@tchwork.com>
21 * @deprecated since version 2.8, to be removed in 3.0. Use the VarDumperTestTrait instead.
23 abstract class VarDumperTestCase extends TestCase
25 public function assertDumpEquals($dump, $data, $message = '')
27 $this->assertSame(rtrim($dump), $this->getDump($data), $message);
30 public function assertDumpMatchesFormat($dump, $data, $message = '')
32 $this->assertStringMatchesFormat(rtrim($dump), $this->getDump($data), $message);
35 protected function getDump($data)
37 $h = fopen('php://memory', 'r+b');
38 $cloner = new VarCloner();
39 $dumper = new CliDumper($h);
40 $dumper->setColors(false);
41 $dumper->dump($cloner->cloneVar($data)->withRefHandles(false));
42 $data = stream_get_contents($h, -1, 0);