* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\HttpKernel\EventListener\DumpListener; use Symfony\Component\VarDumper\Cloner\ClonerInterface; use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Dumper\DataDumperInterface; use Symfony\Component\VarDumper\VarDumper; /** * DumpListenerTest. * * @author Nicolas Grekas */ class DumpListenerTest extends TestCase { public function testSubscribedEvents() { $this->assertSame( array(ConsoleEvents::COMMAND => array('configure', 1024)), DumpListener::getSubscribedEvents() ); } public function testConfigure() { $prevDumper = VarDumper::setHandler('var_dump'); VarDumper::setHandler($prevDumper); $cloner = new MockCloner(); $dumper = new MockDumper(); ob_start(); $exception = null; $listener = new DumpListener($cloner, $dumper); try { $listener->configure(); VarDumper::dump('foo'); VarDumper::dump('bar'); $this->assertSame('+foo-+bar-', ob_get_clean()); } catch (\Exception $exception) { } VarDumper::setHandler($prevDumper); if (null !== $exception) { throw $exception; } } } class MockCloner implements ClonerInterface { public function cloneVar($var) { return new Data(array(array($var.'-'))); } } class MockDumper implements DataDumperInterface { public function dump(Data $data) { echo '+'.$data->getValue(); } } __halt_compiler();----SIGNATURE:----psvGSGw11kwVepJtLVlbu1ZiOXh0AfX4QZRm2MQBq/cJek3l3k4nTAPZHSJexGgTRpYJNeYd16KhRiX6kt5yRhowKmGynFbubt3058sXdd3E1rcKGqhG2geTGzDlLQWK/YmCUD+uHDM9tyz0dmJ/HeN58PkIm5MHxLW3n3fMAypWFJf0mJM2ZMRgfftib8TACUfogntaP+nD0vyEpmr8yHP40RJPG1zRVdg7snaggIDBrTL1IxDnmY2+5w7icfvufRGEvFOcJOrqqa0q45+b6GBLP1O6DPgfZriXeMOBuw7aV3LwNDrLQMTuDlj7CfXY0oWSn2ysJTHtLCfiWixf134TTDCDh/sGq5Bp8fcf56MO8n/SmnlaB8IYd3wzHYnIb1OlowigVg3e7AFODf/t1LyNsiuBi1ZEvTiGKuCwoC7VwbUseZrVAqNXJ4Wc1hSQQwCPkjVzyb56BW23VJerSOjJHYL26DrcTIHpxU54MNxDsQZZmBxpa78MPucQZgZSCt35BtRqTN+HNYqZtpZ5W+FEiRWp3Cg/SV7iaEyyxe1Lq0tU8y1JNyzHkf22IQ1o4c7DC7RoIR853xw3gSFdq5s3DKHeji0G9tLHf+JsZaRRowZoMBeiBp/jtFKjHX8+jcNQZNWAcuZPokvONq1LEUwCy7GiPZ9QfE091pvs7nw=----ATTACHMENT:----MzgyMDY2OTk3MDMyNTU5MyA1NjEzMDQyNzI4OTA5MTQzIDM2ODg4ODU0NDg3ODQ5OTM=