1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-21 20:35:17 +02:00

Upgrade phpstan, phpunit (#1923)

* Upgrade phpstan, phpunit

* Fix phpunit deprecation

* Fix hg tests

* Fix php-console tests

* Fix phpunit on 8.1

* Bump phpconsole
This commit is contained in:
Jordi Boggiano
2024-11-11 15:21:55 +01:00
committed by GitHub
parent 7af6f41cff
commit f43e3d5637
43 changed files with 210 additions and 153 deletions

View File

@@ -15,6 +15,41 @@ use Monolog\Test\TestCase;
class MercurialProcessorTest extends TestCase
{
private string $oldCwd;
private string $testDir;
protected function setUp(): void
{
parent::setUp();
$this->oldCwd = getcwd();
$this->testDir = sys_get_temp_dir().'/monolog-processor-mercurial-test';
mkdir($this->testDir, recursive: true);
chdir($this->testDir);
}
protected function tearDown(): void
{
parent::tearDown();
chdir($this->oldCwd);
if (!file_exists($this->testDir)) {
return;
}
$items = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->testDir, \RecursiveDirectoryIterator::SKIP_DOTS),
\RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($items as $item) {
$item->isDir() ? rmdir((string) $item) : unlink((string) $item);
}
rmdir($this->testDir);
}
/**
* @covers Monolog\Processor\MercurialProcessor::__invoke
*/
@@ -31,12 +66,17 @@ class MercurialProcessorTest extends TestCase
return;
}
`hg init`;
exec('hg init');
exec('hg branch default');
touch('test.txt');
exec('hg add test.txt');
exec('hg commit -u foo -m "initial commit"');
$processor = new MercurialProcessor();
$record = $processor($this->getRecord());
$this->assertArrayHasKey('hg', $record->extra);
$this->assertTrue(!\is_array($record->extra['hg']['branch']));
$this->assertTrue(!\is_array($record->extra['hg']['revision']));
$this->assertSame('default', $record->extra['hg']['branch']);
$this->assertSame('0', $record->extra['hg']['revision']);
}
}