DbalLoggerTest.php 1004 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Bridge\Doctrine\Logger;
  11. class DbalLoggerTest extends \PHPUnit_Framework_TestCase
  12. {
  13. public function testLogNonUtf8()
  14. {
  15. $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface');
  16. $dbalLogger = $this
  17. ->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
  18. ->setConstructorArgs(array($logger, null))
  19. ->setMethods(array('log'))
  20. ->getMock()
  21. ;
  22. $dbalLogger
  23. ->expects($this->once())
  24. ->method('log')
  25. ->with('SQL ({"utf8":"foo","nonutf8":null})')
  26. ;
  27. $dbalLogger->startQuery('SQL', array(
  28. 'utf8' => 'foo',
  29. 'nonutf8' => "\x7F\xFF"
  30. ));
  31. }
  32. }