createStub(Security::class); $security->method('getUser')->willReturn(new InMemoryUser('api', null, ['ROLE_API'])); $security->method('getToken')->willReturn(null); $processor = new UserDataProcessor($security, 'fpm-fcgi'); $record = $processor(new LogRecord( new \DateTimeImmutable(), 'api', Level::Info, 'Application form submission received' )); $this->assertSame( ['id' => null, 'username' => 'api', 'roles' => ['ROLE_API']], $record->extra['user'] ); } }