mirror of
https://github.com/nextcloud/server.git
synced 2026-12-03 23:16:11 +01:00
Audit entries now carry the parameters they are built from as a nested "params" object in their data (e.g. data.params.shareWith), so log consumers no longer need to parse the human-readable message. Numbers and booleans keep their type. Parameters are left out when the call asks for obfuscation. The audit logger requests a custom logger with structured context, so only audit.log is affected. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
36 lines
951 B
PHP
36 lines
951 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\AdminAudit\Tests\Actions;
|
|
|
|
use OCA\AdminAudit\Actions\Versions;
|
|
use OCA\AdminAudit\IAuditLogger;
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
|
use Test\TestCase;
|
|
|
|
class VersionsTest extends TestCase {
|
|
private IAuditLogger&MockObject $logger;
|
|
private Versions $versions;
|
|
|
|
protected function setUp(): void {
|
|
parent::setUp();
|
|
|
|
$this->logger = $this->createMock(IAuditLogger::class);
|
|
$this->versions = new Versions($this->logger);
|
|
}
|
|
|
|
public function testDelete(): void {
|
|
$this->logger->expects($this->once())
|
|
->method('info')
|
|
->with('Version "/a.txt.v1700000000" was deleted.', ['app' => 'admin_audit', 'operation' => 'versions.version.deleted', 'params' => ['path' => '/a.txt.v1700000000']]);
|
|
|
|
$this->versions->delete(['path' => '/a.txt.v1700000000']);
|
|
}
|
|
}
|