diff --git a/src/app/Handlers/Beta/Meet.php b/src/app/Handlers/Beta/Meet.php
deleted file mode 100644
--- a/src/app/Handlers/Beta/Meet.php
+++ /dev/null
@@ -1,18 +0,0 @@
-where('entitleable_type', Domain::class)
->count() > 0;
- // Get user's beta entitlements
- $betaSKUs = $user->entitlements()->select('skus.title')
+ // Get user's entitlements titles
+ $skus = $user->entitlements()->select('skus.title')
->join('skus', 'skus.id', '=', 'entitlements.sku_id')
- ->where('handler_class', 'like', 'App\\\\Handlers\\\\Beta\\\\%')
->get()
->pluck('title')
+ ->sort()
->unique()
+ ->values()
->all();
return [
- 'betaSKUs' => $betaSKUs,
+ 'skus' => $skus,
// TODO: This will change when we enable all users to create domains
'enableDomains' => $isController && $hasCustomDomain,
'enableUsers' => $isController,
diff --git a/src/database/migrations/2021_01_26_150000_change_sku_descriptions.php b/src/database/migrations/2021_01_26_150000_change_sku_descriptions.php
new file mode 100644
--- /dev/null
+++ b/src/database/migrations/2021_01_26_150000_change_sku_descriptions.php
@@ -0,0 +1,36 @@
+first();
+ $beta_sku->name = 'Private Beta (invitation only)';
+ $beta_sku->description = 'Access to the private beta program subscriptions';
+ $beta_sku->save();
+
+ $meet_sku = \App\Sku::where('title', 'meet')->first();
+ $meet_sku->name = 'Voice & Video Conferencing (public beta)';
+ $meet_sku->handler_class = 'App\Handlers\Meet';
+ $meet_sku->save();
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ }
+}
diff --git a/src/database/seeds/local/SkuSeeder.php b/src/database/seeds/local/SkuSeeder.php
--- a/src/database/seeds/local/SkuSeeder.php
+++ b/src/database/seeds/local/SkuSeeder.php
@@ -157,8 +157,8 @@
Sku::create(
[
'title' => 'beta',
- 'name' => 'Beta program',
- 'description' => 'Access to beta program subscriptions',
+ 'name' => 'Private Beta (invitation only)',
+ 'description' => 'Access to the private beta program subscriptions',
'cost' => 0,
'units_free' => 0,
'period' => 'monthly',
@@ -173,12 +173,12 @@
Sku::create(
[
'title' => 'meet',
- 'name' => 'Video chat',
+ 'name' => 'Voice & Video Conferencing (public beta)',
'description' => 'Video conferencing tool',
'cost' => 0,
'units_free' => 0,
'period' => 'monthly',
- 'handler_class' => 'App\Handlers\Beta\Meet',
+ 'handler_class' => 'App\Handlers\Meet',
'active' => true,
]
);
diff --git a/src/database/seeds/local/UserSeeder.php b/src/database/seeds/local/UserSeeder.php
--- a/src/database/seeds/local/UserSeeder.php
+++ b/src/database/seeds/local/UserSeeder.php
@@ -129,8 +129,8 @@
$john->assignPackage($package_lite, $joe);
- $john->assignSku(Sku::firstOrCreate(['title' => 'beta']));
- $john->assignSku(Sku::firstOrCreate(['title' => 'meet']));
+ //$john->assignSku(Sku::firstOrCreate(['title' => 'beta']));
+ //$john->assignSku(Sku::firstOrCreate(['title' => 'meet']));
$joe->setAliases(['joe.monster@kolab.org']);
diff --git a/src/database/seeds/production/SkuSeeder.php b/src/database/seeds/production/SkuSeeder.php
--- a/src/database/seeds/production/SkuSeeder.php
+++ b/src/database/seeds/production/SkuSeeder.php
@@ -157,8 +157,8 @@
Sku::create(
[
'title' => 'beta',
- 'name' => 'Beta program',
- 'description' => 'Access to beta program subscriptions',
+ 'name' => 'Private Beta (invitation only)',
+ 'description' => 'Access to the private beta program subscriptions',
'cost' => 0,
'units_free' => 0,
'period' => 'monthly',
@@ -173,12 +173,12 @@
Sku::create(
[
'title' => 'meet',
- 'name' => 'Video chat',
+ 'name' => 'Voice & Video Conferencing (public beta)',
'description' => 'Video conferencing tool',
'cost' => 0,
'units_free' => 0,
'period' => 'monthly',
- 'handler_class' => 'App\Handlers\Beta\Meet',
+ 'handler_class' => 'App\Handlers\Meet',
'active' => true,
]
);
diff --git a/src/resources/js/app.js b/src/resources/js/app.js
--- a/src/resources/js/app.js
+++ b/src/resources/js/app.js
@@ -90,9 +90,9 @@
hasRoute(name) {
return this.$router.resolve({ name: name }).resolved.matched.length > 0
},
- hasBeta(name) {
+ hasSKU(name) {
const authInfo = store.state.authInfo
- return authInfo.statusInfo.betaSKUs && authInfo.statusInfo.betaSKUs.indexOf(name) != -1
+ return authInfo.statusInfo.skus && authInfo.statusInfo.skus.indexOf(name) != -1
},
isController(wallet_id) {
if (wallet_id && store.state.authInfo) {
diff --git a/src/resources/vue/Dashboard.vue b/src/resources/vue/Dashboard.vue
--- a/src/resources/vue/Dashboard.vue
+++ b/src/resources/vue/Dashboard.vue
@@ -16,7 +16,7 @@
Wallet
{{ $root.price(balance) }}
-
+
Video chat
beta
diff --git a/src/resources/vue/Rooms.vue b/src/resources/vue/Rooms.vue
--- a/src/resources/vue/Rooms.vue
+++ b/src/resources/vue/Rooms.vue
@@ -65,7 +65,7 @@
}
},
mounted() {
- if (!this.$root.hasBeta('meet')) {
+ if (!this.$root.hasSKU('meet')) {
this.$root.errorPage(403)
return
}
diff --git a/src/tests/Browser/Admin/UserTest.php b/src/tests/Browser/Admin/UserTest.php
--- a/src/tests/Browser/Admin/UserTest.php
+++ b/src/tests/Browser/Admin/UserTest.php
@@ -36,6 +36,8 @@
$wallet = $john->wallets()->first();
$wallet->discount()->dissociate();
$wallet->save();
+
+ $this->clearMeetEntitlements();
}
/**
@@ -55,6 +57,8 @@
$wallet->discount()->dissociate();
$wallet->save();
+ $this->clearMeetEntitlements();
+
parent::tearDown();
}
diff --git a/src/tests/Browser/Meet/RoomControlsTest.php b/src/tests/Browser/Meet/RoomControlsTest.php
--- a/src/tests/Browser/Meet/RoomControlsTest.php
+++ b/src/tests/Browser/Meet/RoomControlsTest.php
@@ -15,12 +15,12 @@
public function setUp(): void
{
parent::setUp();
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
}
public function tearDown(): void
{
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
parent::tearDown();
}
@@ -41,7 +41,7 @@
$room->save();
}
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org');
$this->browse(function (Browser $browser) {
// Join the room as an owner (authenticate)
@@ -96,7 +96,7 @@
$room->save();
}
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org');
$this->browse(function (Browser $owner, Browser $guest) {
// Join the room as an owner (authenticate)
@@ -241,7 +241,7 @@
$room->save();
}
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org');
$this->browse(function (Browser $owner, Browser $guest) {
// Join the room as an owner
@@ -344,7 +344,7 @@
$room->save();
}
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org');
$this->browse(function (Browser $owner, Browser $guest) {
// Join the room as an owner
diff --git a/src/tests/Browser/Meet/RoomSecurityTest.php b/src/tests/Browser/Meet/RoomSecurityTest.php
--- a/src/tests/Browser/Meet/RoomSecurityTest.php
+++ b/src/tests/Browser/Meet/RoomSecurityTest.php
@@ -18,8 +18,8 @@
{
parent::setUp();
- $this->clearBetaEntitlements();
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->clearMeetEntitlements();
+ $this->assignMeetEntitlement('john@kolab.org');
$room = Room::where('name', 'john')->first();
$room->setSettings(['password' => null, 'locked' => null]);
@@ -27,7 +27,7 @@
public function tearDown(): void
{
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
$room = Room::where('name', 'john')->first();
$room->setSettings(['password' => null, 'locked' => null]);
diff --git a/src/tests/Browser/Meet/RoomSetupTest.php b/src/tests/Browser/Meet/RoomSetupTest.php
--- a/src/tests/Browser/Meet/RoomSetupTest.php
+++ b/src/tests/Browser/Meet/RoomSetupTest.php
@@ -17,12 +17,12 @@
public function setUp(): void
{
parent::setUp();
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
}
public function tearDown(): void
{
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
parent::tearDown();
}
@@ -74,7 +74,7 @@
$room->save();
}
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org', 'meet');
$this->browse(function (Browser $browser) {
$browser->visit(new RoomPage('john'))
@@ -130,7 +130,7 @@
*/
public function testTwoUsersInARoom(): void
{
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org', 'meet');
$this->browse(function (Browser $browser, Browser $guest) {
// In one browser window act as a guest
@@ -292,7 +292,7 @@
*/
public function testSubscribers(): void
{
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org', 'meet');
$this->browse(function (Browser $browser, Browser $guest) {
// Join the room as the owner
diff --git a/src/tests/Browser/Meet/RoomsTest.php b/src/tests/Browser/Meet/RoomsTest.php
--- a/src/tests/Browser/Meet/RoomsTest.php
+++ b/src/tests/Browser/Meet/RoomsTest.php
@@ -19,7 +19,7 @@
public function setUp(): void
{
parent::setUp();
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
}
/**
@@ -27,7 +27,7 @@
*/
public function tearDown(): void
{
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
parent::tearDown();
}
diff --git a/src/tests/Browser/UsersTest.php b/src/tests/Browser/UsersTest.php
--- a/src/tests/Browser/UsersTest.php
+++ b/src/tests/Browser/UsersTest.php
@@ -47,8 +47,8 @@
$wallet->discount()->dissociate();
$wallet->save();
- $betas = Sku::where('handler_class', 'like', '%\\Beta%')->pluck('id')->all();
- Entitlement::whereIn('sku_id', $betas)->delete();
+ $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
}
/**
@@ -69,8 +69,8 @@
$wallet->discount()->dissociate();
$wallet->save();
- $betas = Sku::where('handler_class', 'like', '%\\Beta%')->pluck('id')->all();
- Entitlement::whereIn('sku_id', $betas)->delete();
+ $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
parent::tearDown();
}
@@ -221,7 +221,7 @@
$browser->assertSeeIn('div.row:nth-child(9) label', 'Subscriptions')
->assertVisible('@skus.row:nth-child(9)')
->with('@skus', function ($browser) {
- $browser->assertElementsCount('tbody tr', 5)
+ $browser->assertElementsCount('tbody tr', 6)
// Mailbox SKU
->assertSeeIn('tbody tr:nth-child(1) td.name', 'User Mailbox')
->assertSeeIn('tbody tr:nth-child(1) td.price', '4,44 CHF/month')
@@ -271,6 +271,15 @@
'tbody tr:nth-child(5) td.buttons button',
'Two factor authentication for webmail and administration panel'
)
+ // Meet SKU
+ ->assertSeeIn('tbody tr:nth-child(6) td.name', 'Voice & Video Conferencing (public beta)')
+ ->assertSeeIn('tbody tr:nth-child(6) td.price', '0,00 CHF/month')
+ ->assertNotChecked('tbody tr:nth-child(6) td.selection input')
+ ->assertEnabled('tbody tr:nth-child(6) td.selection input')
+ ->assertTip(
+ 'tbody tr:nth-child(6) td.buttons button',
+ 'Video conferencing tool'
+ )
->click('tbody tr:nth-child(4) td.selection input');
})
->assertMissing('@skus table + .hint')
@@ -298,6 +307,11 @@
->assertDialogOpened('Activesync requires Groupware Features.')
->acceptDialog()
->assertNotChecked('#sku-input-activesync')
+ // Check 'meet', expect an alert
+ ->click('#sku-input-meet')
+ ->assertDialogOpened('Voice & Video Conferencing (public beta) requires Groupware Features.')
+ ->acceptDialog()
+ ->assertNotChecked('#sku-input-meet')
// Check '2FA', expect 'activesync' unchecked and readonly
->click('#sku-input-2fa')
->assertChecked('#sku-input-2fa')
@@ -554,7 +568,7 @@
$browser->whenAvailable('@skus', function (Browser $browser) {
$quota_input = new QuotaInput('tbody tr:nth-child(2) .range-input');
$browser->waitFor('tbody tr')
- ->assertElementsCount('tbody tr', 5)
+ ->assertElementsCount('tbody tr', 6)
// Mailbox SKU
->assertSeeIn('tbody tr:nth-child(1) td.price', '3,99 CHF/month¹')
// Storage SKU
@@ -606,24 +620,25 @@
->on(new UserInfo())
->with('@skus', function ($browser) {
$browser->assertElementsCount('tbody tr', 7)
- // Beta SKU
- ->assertSeeIn('tbody tr:nth-child(6) td.name', 'Beta program')
- ->assertSeeIn('tbody tr:nth-child(6) td.price', '0,00 CHF/month')
- ->assertChecked('tbody tr:nth-child(6) td.selection input')
+ // Beta/Meet SKU
+ ->assertSeeIn('tbody tr:nth-child(6) td.name', 'Voice & Video Conferencing (public beta)')
+ ->assertSeeIn('tr:nth-child(6) td.price', '0,00 CHF/month')
+ ->assertNotChecked('tbody tr:nth-child(6) td.selection input')
->assertEnabled('tbody tr:nth-child(6) td.selection input')
->assertTip(
'tbody tr:nth-child(6) td.buttons button',
- 'Access to beta program subscriptions'
+ 'Video conferencing tool'
)
- // Beta/Meet SKU
- ->assertSeeIn('tbody tr:nth-child(7) td.name', 'Video chat')
- ->assertSeeIn('tr:nth-child(7) td.price', '0,00 CHF/month')
- ->assertNotChecked('tbody tr:nth-child(7) td.selection input')
+ // Beta SKU
+ ->assertSeeIn('tbody tr:nth-child(7) td.name', 'Private Beta (invitation only)')
+ ->assertSeeIn('tbody tr:nth-child(7) td.price', '0,00 CHF/month')
+ ->assertChecked('tbody tr:nth-child(7) td.selection input')
->assertEnabled('tbody tr:nth-child(7) td.selection input')
->assertTip(
'tbody tr:nth-child(7) td.buttons button',
- 'Video conferencing tool'
+ 'Access to the private beta program subscriptions'
)
+/*
// Check Meet, Uncheck Beta, expect Meet unchecked
->click('#sku-input-meet')
->click('#sku-input-beta')
@@ -633,8 +648,8 @@
->click('#sku-input-meet')
->assertDialogOpened('Video chat requires Beta program.')
->acceptDialog()
- // Enable Meet and Beta and submit
- ->click('#sku-input-beta')
+*/
+ // Enable Meet and submit
->click('#sku-input-meet');
})
->click('button[type=submit]')
@@ -646,6 +661,7 @@
$browser->visit('/user/' . $john->id)
->on(new UserInfo())
->click('#sku-input-beta')
+ ->click('#sku-input-meet')
->click('button[type=submit]')
->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.');
diff --git a/src/tests/Feature/Controller/OpenViduTest.php b/src/tests/Feature/Controller/OpenViduTest.php
--- a/src/tests/Feature/Controller/OpenViduTest.php
+++ b/src/tests/Feature/Controller/OpenViduTest.php
@@ -15,14 +15,14 @@
{
parent::setUp();
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
$room = Room::where('name', 'john')->first();
$room->setSettings(['password' => null, 'locked' => null]);
}
public function tearDown(): void
{
- $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
$room = Room::where('name', 'john')->first();
$room->setSettings(['password' => null, 'locked' => null]);
@@ -78,7 +78,7 @@
$room->session_id = null;
$room->save();
- $this->assignBetaEntitlement($john, 'meet');
+ $this->assignMeetEntitlement($john);
// Unauth access, no session yet
$response = $this->post("api/v4/openvidu/rooms/{$room->name}");
@@ -211,7 +211,7 @@
$room->save();
$room->setSettings(['password' => null, 'locked' => 'true']);
- $this->assignBetaEntitlement($john, 'meet');
+ $this->assignMeetEntitlement($john);
// Create the session (also makes sure the owner can access a locked room)
$response = $this->actingAs($john)->post("api/v4/openvidu/rooms/{$room->name}", ['init' => 1]);
@@ -341,7 +341,7 @@
*/
public function testJoinRoomGuest(): void
{
- $this->assignBetaEntitlement('john@kolab.org', 'meet');
+ $this->assignMeetEntitlement('john@kolab.org');
// There's no asy way to logout the user in the same test after
// using actingAs(). That's why this is moved to a separate test
@@ -427,7 +427,7 @@
$room->session_id = null;
$room->save();
- $this->assignBetaEntitlement($john, 'meet');
+ $this->assignMeetEntitlement($john);
// First we create the session
$response = $this->actingAs($john)->post("api/v4/openvidu/rooms/{$room->name}", ['init' => 1]);
diff --git a/src/tests/Feature/Controller/SkusTest.php b/src/tests/Feature/Controller/SkusTest.php
--- a/src/tests/Feature/Controller/SkusTest.php
+++ b/src/tests/Feature/Controller/SkusTest.php
@@ -16,8 +16,8 @@
{
parent::setUp();
- $betas = Sku::where('handler_class', 'like', '%\\Beta%')->pluck('id')->all();
- Entitlement::whereIn('sku_id', $betas)->delete();
+ $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
}
/**
@@ -25,8 +25,8 @@
*/
public function tearDown(): void
{
- $betas = Sku::where('handler_class', 'like', '%\\Beta%')->pluck('id')->all();
- Entitlement::whereIn('sku_id', $betas)->delete();
+ $this->clearBetaEntitlements();
+ $this->clearMeetEntitlements();
parent::tearDown();
}
@@ -80,7 +80,7 @@
$json = $response->json();
- $this->assertCount(7, $json);
+ $this->assertCount(8, $json);
$this->assertSkuElement('mailbox', $json[0], [
'prio' => 100,
@@ -129,7 +129,16 @@
'forbidden' => ['activesync'],
]);
- $this->assertSkuElement('domain-hosting', $json[5], [
+ $this->assertSkuElement('meet', $json[5], [
+ 'prio' => 50,
+ 'type' => 'user',
+ 'handler' => 'meet',
+ 'enabled' => false,
+ 'readonly' => false,
+ 'required' => ['groupware'],
+ ]);
+
+ $this->assertSkuElement('domain-hosting', $json[6], [
'prio' => 0,
'type' => 'domain',
'handler' => 'domainhosting',
@@ -137,7 +146,7 @@
'readonly' => false,
]);
- $this->assertSkuElement('group', $json[6], [
+ $this->assertSkuElement('group', $json[7], [
'prio' => 0,
'type' => 'group',
'handler' => 'group',
@@ -164,21 +173,21 @@
$this->assertCount(7, $json);
- $this->assertSkuElement('beta', $json[5], [
- 'prio' => 10,
+ $this->assertSkuElement('meet', $json[5], [
+ 'prio' => 50,
'type' => 'user',
- 'handler' => 'beta',
+ 'handler' => 'meet',
'enabled' => false,
'readonly' => false,
+ 'required' => ['groupware'],
]);
- $this->assertSkuElement('meet', $json[6], [
- 'prio' => 0,
+ $this->assertSkuElement('beta', $json[6], [
+ 'prio' => 10,
'type' => 'user',
- 'handler' => 'meet',
+ 'handler' => 'beta',
'enabled' => false,
'readonly' => false,
- 'required' => ['beta'],
]);
}
diff --git a/src/tests/Feature/Controller/UsersTest.php b/src/tests/Feature/Controller/UsersTest.php
--- a/src/tests/Feature/Controller/UsersTest.php
+++ b/src/tests/Feature/Controller/UsersTest.php
@@ -385,7 +385,7 @@
$result = UsersController::statusInfo($user);
$this->assertFalse($result['isReady']);
- $this->assertSame([], $result['betaSKUs']);
+ $this->assertSame([], $result['skus']);
$this->assertCount(3, $result['process']);
$this->assertSame('user-new', $result['process'][0]['label']);
$this->assertSame(true, $result['process'][0]['state']);
@@ -424,7 +424,7 @@
$result = UsersController::statusInfo($user);
$this->assertFalse($result['isReady']);
- $this->assertSame([], $result['betaSKUs']);
+ $this->assertSame([], $result['skus']);
$this->assertCount(7, $result['process']);
$this->assertSame('user-new', $result['process'][0]['label']);
$this->assertSame(true, $result['process'][0]['state']);
@@ -441,24 +441,24 @@
$this->assertSame('domain-confirmed', $result['process'][6]['label']);
$this->assertSame(false, $result['process'][6]['state']);
- // Test betaSKUs property
+ // Test 'skus' property
$user->assignSku(Sku::where('title', 'beta')->first());
$result = UsersController::statusInfo($user);
- $this->assertSame([], $result['betaSKUs']);
+ $this->assertSame(['beta'], $result['skus']);
$user->assignSku(Sku::where('title', 'meet')->first());
$result = UsersController::statusInfo($user);
- $this->assertSame(['meet'], $result['betaSKUs']);
+ $this->assertSame(['beta', 'meet'], $result['skus']);
$user->assignSku(Sku::where('title', 'meet')->first());
$result = UsersController::statusInfo($user);
- $this->assertSame(['meet'], $result['betaSKUs']);
+ $this->assertSame(['beta', 'meet'], $result['skus']);
}
/**
@@ -989,7 +989,6 @@
$this->assertTrue($result['statusInfo']['enableDomains']);
$this->assertTrue($result['statusInfo']['enableWallets']);
$this->assertTrue($result['statusInfo']['enableUsers']);
- $this->assertSame([], $result['statusInfo']['betaSKUs']);
// Ned is John's wallet controller
$ned = $this->getTestUser('ned@kolab.org');
@@ -1011,7 +1010,6 @@
$this->assertTrue($result['statusInfo']['enableDomains']);
$this->assertTrue($result['statusInfo']['enableWallets']);
$this->assertTrue($result['statusInfo']['enableUsers']);
- $this->assertSame([], $result['statusInfo']['betaSKUs']);
// Test discount in a response
$discount = Discount::where('code', 'TEST')->first();
@@ -1040,7 +1038,6 @@
$this->assertFalse($result['statusInfo']['enableDomains']);
$this->assertFalse($result['statusInfo']['enableWallets']);
$this->assertFalse($result['statusInfo']['enableUsers']);
- $this->assertSame([], $result['statusInfo']['betaSKUs']);
}
/**
diff --git a/src/tests/TestCaseTrait.php b/src/tests/TestCaseTrait.php
--- a/src/tests/TestCaseTrait.php
+++ b/src/tests/TestCaseTrait.php
@@ -14,20 +14,17 @@
trait TestCaseTrait
{
/**
- * Assign beta entitlement to a user.
- * It will add both requested entitlement as well as the 'beta' entitlement
+ * Assign 'meet' entitlement to a user.
*
* @param string|\App\User $user The user
- * @param string $sku The beta SKU title
*/
- protected function assignBetaEntitlement($user, $sku): void
+ protected function assignMeetEntitlement($user): void
{
if (is_string($user)) {
$user = $this->getTestUser($user);
}
- $user->assignSku(\App\Sku::where('title', 'beta')->first());
- $user->assignSku(\App\Sku::where('title', $sku)->first());
+ $user->assignSku(\App\Sku::where('title', 'meet')->first());
}
protected function assertUserEntitlements($user, $expected)
@@ -49,10 +46,22 @@
*/
protected function clearBetaEntitlements(): void
{
- $betas = \App\Sku::where('handler_class', 'like', '%\\Beta%')->pluck('id')->all();
+ $betas = \App\Sku::where('handler_class', 'like', 'App\\Handlers\\Beta\\%')
+ ->orWhere('handler_class', 'App\Handlers\Beta')
+ ->pluck('id')->all();
+
\App\Entitlement::whereIn('sku_id', $betas)->delete();
}
+ /**
+ * Removes all 'meet' entitlements from the database
+ */
+ protected function clearMeetEntitlements(): void
+ {
+ $meet_sku = \App\Sku::where('title', 'meet')->first();
+ \App\Entitlement::where('sku_id', $meet_sku->id)->delete();
+ }
+
/**
* Creates the application.
*