Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/SkusTest.php
Show All 12 Lines | class SkusTest extends TestCase | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
$this->clearBetaEntitlements(); | $this->clearBetaEntitlements(); | ||||
$this->clearMeetEntitlements(); | |||||
Sku::where('title', 'test')->delete(); | Sku::where('title', 'test')->delete(); | ||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$this->clearBetaEntitlements(); | $this->clearBetaEntitlements(); | ||||
$this->clearMeetEntitlements(); | |||||
Sku::where('title', 'test')->delete(); | Sku::where('title', 'test')->delete(); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test fetching SKUs list for a domain (GET /domains/<id>/skus) | * Test fetching SKUs list for a domain (GET /domains/<id>/skus) | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | public function testUserSkus(): 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 testUserSkus(): 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(11, $json); | $this->assertCount(10, $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, | ||||
]); | ]); | ||||
$this->assertSkuElement('beta-distlists', $json[7], [ | $this->assertSkuElement('beta-distlists', $json[6], [ | ||||
'prio' => 10, | 'prio' => 10, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Beta\Distlists', | 'handler' => 'Beta\Distlists', | ||||
'enabled' => false, | 'enabled' => false, | ||||
'readonly' => false, | 'readonly' => false, | ||||
'required' => ['Beta'], | 'required' => ['Beta'], | ||||
]); | ]); | ||||
$this->assertSkuElement('beta-resources', $json[8], [ | $this->assertSkuElement('beta-resources', $json[7], [ | ||||
'prio' => 10, | 'prio' => 10, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Beta\Resources', | 'handler' => 'Beta\Resources', | ||||
'enabled' => false, | 'enabled' => false, | ||||
'readonly' => false, | 'readonly' => false, | ||||
'required' => ['Beta'], | 'required' => ['Beta'], | ||||
]); | ]); | ||||
$this->assertSkuElement('beta-shared-folders', $json[9], [ | $this->assertSkuElement('beta-shared-folders', $json[8], [ | ||||
'prio' => 10, | 'prio' => 10, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Beta\SharedFolders', | 'handler' => 'Beta\SharedFolders', | ||||
'enabled' => false, | 'enabled' => false, | ||||
'readonly' => false, | 'readonly' => false, | ||||
'required' => ['Beta'], | 'required' => ['Beta'], | ||||
]); | ]); | ||||
$this->assertSkuElement('files', $json[10], [ | $this->assertSkuElement('files', $json[9], [ | ||||
'prio' => 10, | 'prio' => 10, | ||||
'type' => 'user', | 'type' => 'user', | ||||
'handler' => 'Files', | 'handler' => 'Files', | ||||
'enabled' => false, | 'enabled' => false, | ||||
'readonly' => false, | 'readonly' => false, | ||||
'required' => ['Beta'], | 'required' => ['Beta'], | ||||
]); | ]); | ||||
} | } | ||||
Show All 28 Lines |