MercurialProcessorTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php declare(strict_types=1);
  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\Processor;
  11. use Monolog\Test\TestCase;
  12. class MercurialProcessorTest extends TestCase
  13. {
  14. /**
  15. * @covers Monolog\Processor\MercurialProcessor::__invoke
  16. */
  17. public function testProcessor()
  18. {
  19. if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
  20. exec("where hg 2>NUL", $output, $result);
  21. } else {
  22. exec("which hg 2>/dev/null >/dev/null", $output, $result);
  23. }
  24. if ($result != 0) {
  25. $this->markTestSkipped('hg is missing');
  26. return;
  27. }
  28. `hg init`;
  29. $processor = new MercurialProcessor();
  30. $record = $processor($this->getRecord());
  31. $this->assertArrayHasKey('hg', $record->extra);
  32. $this->assertTrue(!\is_array($record->extra['hg']['branch']));
  33. $this->assertTrue(!\is_array($record->extra['hg']['revision']));
  34. }
  35. }