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:
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user