Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/DomainOwnerTest.php
<?php | <?php | ||||
namespace Tests\Feature; | namespace Tests\Feature; | ||||
use App\Package; | |||||
use App\User; | use App\User; | ||||
use Illuminate\Support\Facades\Queue; | use Illuminate\Support\Facades\Queue; | ||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class DomainOwnerTest extends TestCase | class DomainOwnerTest extends TestCase | ||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
Show All 23 Lines | public function testJohnCreateJane(): void | ||||
[ | [ | ||||
'name' => 'Jane Doe', | 'name' => 'Jane Doe', | ||||
'email' => 'jane@kolab.org', | 'email' => 'jane@kolab.org', | ||||
'password' => 'simple123', | 'password' => 'simple123', | ||||
'email_verified_at' => now() | 'email_verified_at' => now() | ||||
] | ] | ||||
); | ); | ||||
$package = Package::where('title', 'kolab')->first(); | $package = \App\Package::withEnvTenantContext()->where('title', 'kolab')->first(); | ||||
$mailbox_sku = \App\Sku::withEnvTenantContext()->where('title', 'mailbox')->first(); | |||||
$john->assignPackage($package, $jane); | $john->assignPackage($package, $jane); | ||||
// assert jane has a mailbox entitlement | // assert jane has a mailbox entitlement | ||||
$this->assertTrue($jane->entitlements->count() == 4); | $this->assertCount(7, $jane->entitlements); | ||||
$this->assertCount(1, $jane->entitlements()->where('sku_id', $mailbox_sku->id)->get()); | |||||
} | } | ||||
} | } |