feat: door access codes display and admin crud
This commit is contained in:
1 parent
91419294b8
commit
afa3f17d77
20 files changed
+1428
No files matched your search
@@ -4,11 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use App\Entity\AccessCode;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\BookingSeries;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceGroup;
|
||||
use App\Entity\User;
|
||||
use App\Enum\CodeVisibility;
|
||||
use App\Enum\RecurrenceRule;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Model\SeriesResult;
|
||||
@@ -152,6 +154,32 @@ class AuditLoggerTest extends TestCase
|
||||
self::assertSame('[email protected]', $records[1]->context['account']);
|
||||
}
|
||||
|
||||
/**
|
||||
* The one thing the trail must never carry. It is asserted rather than left to review,
|
||||
* because a helpful "log what changed" added later would leak every door code in the
|
||||
* building into a file that outlives the codes themselves.
|
||||
*/
|
||||
public function testAnAccessCodeIsRecordedWithoutItsValue(): void
|
||||
{
|
||||
$code = new AccessCode('Aufzug', '4711', new \DateTimeImmutable('2026-10-01'));
|
||||
|
||||
$this->audit->accessCodeCreated($code);
|
||||
$this->audit->accessCodeUpdated($code, true, CodeVisibility::ADMIN);
|
||||
$this->audit->accessCodeDeleted(7, 'Aufzug', CodeVisibility::EVERYONE);
|
||||
|
||||
foreach ($this->handler->getRecords() as $record) {
|
||||
self::assertStringNotContainsString('4711', json_encode($record->context, \JSON_THROW_ON_ERROR));
|
||||
}
|
||||
|
||||
$records = $this->handler->getRecords();
|
||||
self::assertSame('Aufzug', $records[0]->context['access_code']);
|
||||
self::assertSame('2026-10-01', $records[0]->context['valid_from']);
|
||||
self::assertSame('everyone', $records[0]->context['visibility']);
|
||||
self::assertTrue($records[1]->context['code_changed']);
|
||||
self::assertSame('admin', $records[1]->context['previous_visibility']);
|
||||
self::assertSame(7, $records[2]->context['access_code_id']);
|
||||
}
|
||||
|
||||
private function record(): LogRecord
|
||||
{
|
||||
return $this->handler->getRecords()[0];
|
||||
|
||||
Reference in new issue
Block a user