From eae907c4eda325180fac1bb4995f1c0f5ddffca6 Mon Sep 17 00:00:00 2001 From: Vladyslav Petrovych Date: Sat, 21 Sep 2013 14:40:33 +0300 Subject: [PATCH] fixes issue with logging array of non-utf8 data --- .../Doctrine/Tests/Logger/DbalLoggerTest.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php index 872779c2f841..eacbd4f3c9e2 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php @@ -73,6 +73,37 @@ public function testLogNonUtf8() )); } + public function testLogNonUtf8Array() + { + $logger = $this->getMock('Psr\\Log\\LoggerInterface'); + + $dbalLogger = $this + ->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger') + ->setConstructorArgs(array($logger, null)) + ->setMethods(array('log')) + ->getMock() + ; + + $dbalLogger + ->expects($this->once()) + ->method('log') + ->with('SQL', array( + 'utf8' => 'foo', + array( + 'nonutf8' => DbalLogger::BINARY_DATA_VALUE, + ) + ) + ) + ; + + $dbalLogger->startQuery('SQL', array( + 'utf8' => 'foo', + array( + 'nonutf8' => "\x7F\xFF", + ) + )); + } + public function testLogLongString() { $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface');