Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Console/Data/Import/LdifTest.php
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | public function testHandle(): void | ||||
$this->assertEntitlements($owner, [ | $this->assertEntitlements($owner, [ | ||||
'groupware', | 'groupware', | ||||
'mailbox', | 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage', 'storage', 'storage', 'storage', | 'storage', 'storage', 'storage', 'storage', 'storage', 'storage', 'storage', 'storage', | ||||
]); | ]); | ||||
// Users | // Users | ||||
$this->assertSame(2, $owner->users(false)->count()); | $this->assertSame(2, $owner->users(false)->count()); | ||||
/** @var \App\User $user */ | |||||
$user = $owner->users(false)->where('email', 'user@kolab3.com')->first(); | $user = $owner->users(false)->where('email', 'user@kolab3.com')->first(); | ||||
// User settings | // User settings | ||||
$this->assertSame('Jane', $user->getSetting('first_name')); | $this->assertSame('Jane', $user->getSetting('first_name')); | ||||
$this->assertSame('Doe', $user->getSetting('last_name')); | $this->assertSame('Doe', $user->getSetting('last_name')); | ||||
$this->assertSame('1234567890', $user->getSetting('phone')); | $this->assertSame('1234567890', $user->getSetting('phone')); | ||||
$this->assertSame('ext@gmail.com', $user->getSetting('external_email')); | $this->assertSame('ext@gmail.com', $user->getSetting('external_email')); | ||||
$this->assertSame('Org AG', $user->getSetting('organization')); | $this->assertSame('Org AG', $user->getSetting('organization')); | ||||
// User aliases | // User aliases | ||||
$aliases = $user->aliases()->orderBy('alias')->pluck('alias')->all(); | $aliases = $user->aliases()->orderBy('alias')->pluck('alias')->all(); | ||||
$this->assertSame(['alias2@kolab3.com'], $aliases); | $this->assertSame(['alias2@kolab3.com'], $aliases); | ||||
$this->assertEntitlements($user, [ | $this->assertEntitlements($user, [ | ||||
'groupware', | 'groupware', | ||||
'mailbox', | 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage', | 'storage', 'storage', 'storage', 'storage', 'storage', | ||||
]); | ]); | ||||
// Domains | // Domains | ||||
/** @var \App\Domain[] $domains */ | |||||
$domains = $owner->domains(false, false)->orderBy('namespace')->get(); | $domains = $owner->domains(false, false)->orderBy('namespace')->get(); | ||||
$this->assertCount(2, $domains); | $this->assertCount(2, $domains); | ||||
$this->assertSame('kolab3-alias.com', $domains[0]->namespace); | $this->assertSame('kolab3-alias.com', $domains[0]->namespace); | ||||
$this->assertSame('kolab3.com', $domains[1]->namespace); | $this->assertSame('kolab3.com', $domains[1]->namespace); | ||||
$this->assertSame(\App\Domain::TYPE_EXTERNAL, $domains[0]->type); | $this->assertSame(\App\Domain::TYPE_EXTERNAL, $domains[0]->type); | ||||
$this->assertSame(\App\Domain::TYPE_EXTERNAL, $domains[1]->type); | $this->assertSame(\App\Domain::TYPE_EXTERNAL, $domains[1]->type); | ||||
$this->assertEntitlements($domains[0], ['domain-hosting']); | $this->assertEntitlements($domains[0], ['domain-hosting']); | ||||
$this->assertEntitlements($domains[1], ['domain-hosting']); | $this->assertEntitlements($domains[1], ['domain-hosting']); | ||||
// Shared folders | // Shared folders | ||||
/** @var \App\SharedFolder[] $folders */ | |||||
$folders = $owner->sharedFolders(false)->orderBy('email')->get(); | $folders = $owner->sharedFolders(false)->orderBy('email')->get(); | ||||
$this->assertCount(2, $folders); | $this->assertCount(2, $folders); | ||||
$this->assertMatchesRegularExpression('/^event-[0-9]+@kolab3\.com$/', $folders[0]->email); | $this->assertMatchesRegularExpression('/^event-[0-9]+@kolab3\.com$/', $folders[0]->email); | ||||
$this->assertMatchesRegularExpression('/^mail-[0-9]+@kolab3\.com$/', $folders[1]->email); | $this->assertMatchesRegularExpression('/^mail-[0-9]+@kolab3\.com$/', $folders[1]->email); | ||||
$this->assertSame('Folder2', $folders[0]->name); | $this->assertSame('Folder2', $folders[0]->name); | ||||
$this->assertSame('Folder1', $folders[1]->name); | $this->assertSame('Folder1', $folders[1]->name); | ||||
$this->assertSame('event', $folders[0]->type); | $this->assertSame('event', $folders[0]->type); | ||||
$this->assertSame('mail', $folders[1]->type); | $this->assertSame('mail', $folders[1]->type); | ||||
$this->assertSame('["anyone, read-only"]', $folders[0]->getSetting('acl')); | $this->assertSame('["anyone, read-only"]', $folders[0]->getSetting('acl')); | ||||
$this->assertSame('shared/Folder2@kolab3.com', $folders[0]->getSetting('folder')); | $this->assertSame('shared/Folder2@kolab3.com', $folders[0]->getSetting('folder')); | ||||
$this->assertSame('["anyone, read-write","owner@kolab3.com, full"]', $folders[1]->getSetting('acl')); | $this->assertSame('["anyone, read-write","owner@kolab3.com, full"]', $folders[1]->getSetting('acl')); | ||||
$this->assertSame('shared/Folder1@kolab3.com', $folders[1]->getSetting('folder')); | $this->assertSame('shared/Folder1@kolab3.com', $folders[1]->getSetting('folder')); | ||||
$this->assertSame([], $folders[0]->aliases()->orderBy('alias')->pluck('alias')->all()); | $this->assertSame([], $folders[0]->aliases()->orderBy('alias')->pluck('alias')->all()); | ||||
$this->assertSame( | $this->assertSame( | ||||
['folder-alias1@kolab3.com', 'folder-alias2@kolab3.com'], | ['folder-alias1@kolab3.com', 'folder-alias2@kolab3.com'], | ||||
$folders[1]->aliases()->orderBy('alias')->pluck('alias')->all() | $folders[1]->aliases()->orderBy('alias')->pluck('alias')->all() | ||||
); | ); | ||||
// Groups | // Groups | ||||
/** @var \App\Group[] $groups */ | |||||
$groups = $owner->groups(false)->orderBy('email')->get(); | $groups = $owner->groups(false)->orderBy('email')->get(); | ||||
$this->assertCount(1, $groups); | $this->assertCount(1, $groups); | ||||
$this->assertSame('Group', $groups[0]->name); | $this->assertSame('Group', $groups[0]->name); | ||||
$this->assertSame('group@kolab3.com', $groups[0]->email); | $this->assertSame('group@kolab3.com', $groups[0]->email); | ||||
$this->assertSame(['owner@kolab3.com', 'user@kolab3.com'], $groups[0]->members); | $this->assertSame(['owner@kolab3.com', 'user@kolab3.com'], $groups[0]->members); | ||||
$this->assertSame('["sender@gmail.com","-"]', $groups[0]->getSetting('sender_policy')); | $this->assertSame('["sender@gmail.com","-"]', $groups[0]->getSetting('sender_policy')); | ||||
// Resources | // Resources | ||||
/** @var \App\Resource[] $resources */ | |||||
$resources = $owner->resources(false)->orderBy('email')->get(); | $resources = $owner->resources(false)->orderBy('email')->get(); | ||||
$this->assertCount(1, $resources); | $this->assertCount(1, $resources); | ||||
$this->assertSame('Resource', $resources[0]->name); | $this->assertSame('Resource', $resources[0]->name); | ||||
$this->assertMatchesRegularExpression('/^resource-[0-9]+@kolab3\.com$/', $resources[0]->email); | $this->assertMatchesRegularExpression('/^resource-[0-9]+@kolab3\.com$/', $resources[0]->email); | ||||
$this->assertSame('shared/Resource@kolab3.com', $resources[0]->getSetting('folder')); | $this->assertSame('shared/Resource@kolab3.com', $resources[0]->getSetting('folder')); | ||||
$this->assertSame('manual:user@kolab3.com', $resources[0]->getSetting('invitation_policy')); | $this->assertSame('manual:user@kolab3.com', $resources[0]->getSetting('invitation_policy')); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 276 Lines • Show Last 20 Lines |