Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/UsersTest.php
Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | public function testSkus(): void | ||||
$nsku->tenant_id = $tenant->id; | $nsku->tenant_id = $tenant->id; | ||||
$nsku->save(); | $nsku->save(); | ||||
$response = $this->actingAs($user)->get("api/v4/users/{$user->id}/skus"); | $response = $this->actingAs($user)->get("api/v4/users/{$user->id}/skus"); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertCount(6, $json); | $this->assertCount(5, $json); | ||||
$this->assertSkuElement('mailbox', $json[0], [ | $this->assertSkuElement('mailbox', $json[0], [ | ||||
'prio' => 100, | 'prio' => 100, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Mailbox', | 'handler' => 'Mailbox', | ||||
'enabled' => true, | 'enabled' => true, | ||||
'readonly' => true, | 'readonly' => true, | ||||
]); | ]); | ||||
Show All 32 Lines | public function testSkus(): void | ||||
'prio' => 60, | 'prio' => 60, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Auth2F', | 'handler' => 'Auth2F', | ||||
'enabled' => false, | 'enabled' => false, | ||||
'readonly' => false, | 'readonly' => false, | ||||
'forbidden' => ['Activesync'], | 'forbidden' => ['Activesync'], | ||||
]); | ]); | ||||
$this->assertSkuElement('meet', $json[5], [ | |||||
'prio' => 50, | |||||
'type' => 'user', | |||||
'handler' => 'Meet', | |||||
'enabled' => false, | |||||
'readonly' => false, | |||||
'required' => ['Groupware'], | |||||
]); | |||||
// Test inclusion of beta SKUs | // Test inclusion of beta SKUs | ||||
$sku = Sku::withEnvTenantContext()->where('title', 'beta')->first(); | $sku = Sku::withEnvTenantContext()->where('title', 'beta')->first(); | ||||
$user->assignSku($sku); | $user->assignSku($sku); | ||||
$response = $this->actingAs($user)->get("api/v4/users/{$user->id}/skus"); | $response = $this->actingAs($user)->get("api/v4/users/{$user->id}/skus"); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertCount(7, $json); | $this->assertCount(6, $json); | ||||
$this->assertSkuElement('beta', $json[6], [ | $this->assertSkuElement('beta', $json[5], [ | ||||
'prio' => 10, | 'prio' => 10, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Beta', | 'handler' => 'Beta', | ||||
'enabled' => false, | 'enabled' => false, | ||||
'readonly' => false, | 'readonly' => false, | ||||
]); | ]); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | public function testStatusInfo(): void | ||||
// Test 'skus' property | // Test 'skus' property | ||||
$user->assignSku(Sku::withEnvTenantContext()->where('title', 'beta')->first()); | $user->assignSku(Sku::withEnvTenantContext()->where('title', 'beta')->first()); | ||||
$result = UsersController::statusInfo($user); | $result = UsersController::statusInfo($user); | ||||
$this->assertSame(['beta'], $result['skus']); | $this->assertSame(['beta'], $result['skus']); | ||||
$user->assignSku(Sku::withEnvTenantContext()->where('title', 'meet')->first()); | $user->assignSku(Sku::withEnvTenantContext()->where('title', 'groupware')->first()); | ||||
$result = UsersController::statusInfo($user); | |||||
$this->assertSame(['beta', 'meet'], $result['skus']); | |||||
$user->assignSku(Sku::withEnvTenantContext()->where('title', 'meet')->first()); | |||||
$result = UsersController::statusInfo($user); | $result = UsersController::statusInfo($user); | ||||
$this->assertSame(['beta', 'meet'], $result['skus']); | $this->assertSame(['beta', 'groupware'], $result['skus']); | ||||
} | } | ||||
/** | /** | ||||
* Test user config update (POST /api/v4/users/<user>/config) | * Test user config update (POST /api/v4/users/<user>/config) | ||||
*/ | */ | ||||
public function testSetConfig(): void | public function testSetConfig(): void | ||||
{ | { | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
▲ Show 20 Lines • Show All 986 Lines • Show Last 20 Lines |