', function (): void { $registry = new ExtensionPermissionRegistry; $registry->register('votes', 'Manage server votes.', ['view' => 'View votes.', 'reset-all' => 'Reset every vote.']); expect($registry->all())->toBe([ 'ext.votes' => ['description' => 'Manage server votes.', 'keys' => ['view' => 'View votes.', 'reset-all' => 'Reset every vote.']], ]); }); test('rejects permission keys that would not form a valid permission', function (array $keys): void { expect(fn () => (new ExtensionPermissionRegistry)->register('votes', 'Votes.', $keys))->toThrow(InvalidArgumentException::class); })->with([ 'no keys' => [[]], 'dotted key' => [['votes.view' => 'View votes.']], 'uppercase key' => [['View' => 'View votes.']], 'wildcard key' => [['*' => 'Everything.']], 'trailing newline' => [["view\n" => 'View votes.']], ]);