CouchDBHandlerTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the Monolog package.
  4. *
  5. * (c) Jordi Boggiano <j.boggiano@seld.be>
  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 Monolog\Handler;
  11. use Monolog\TestCase;
  12. use Monolog\Logger;
  13. class CouchDBHandlerTest extends TestCase
  14. {
  15. public function testHandle()
  16. {
  17. $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
  18. $expected = array(
  19. 'message' => 'test',
  20. 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
  21. 'level' => Logger::WARNING,
  22. 'level_name' => 'WARNING',
  23. 'channel' => 'test',
  24. 'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
  25. 'extra' => array(),
  26. );
  27. $handler = new CouchDBHandler();
  28. try {
  29. $handler->handle($record);
  30. } catch (\RuntimeException $e) {
  31. $this->markTestSkipped('Could not connect to couchdb server on http://localhost:5984');
  32. }
  33. }
  34. }