Page MenuHomePhorge

D2032.1775202952.diff
No OneTemporary

Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None

D2032.1775202952.diff

diff --git a/src/app/User.php b/src/app/User.php
--- a/src/app/User.php
+++ b/src/app/User.php
@@ -342,13 +342,6 @@
->where('entitleable_type', User::class);
}
- public function addEntitlement($entitlement)
- {
- if (!$this->entitlements->contains($entitlement)) {
- return $this->entitlements()->save($entitlement);
- }
- }
-
/**
* Find whether an email address exists as a user (including deleted users).
*
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
@@ -33,7 +33,7 @@
{
// TODO: This test does not work in headless mode
$this->markTestIncomplete();
-
+/*
// Make sure there's no session yet
$room = Room::where('name', 'john')->first();
if ($room->session_id) {
@@ -79,6 +79,7 @@
->assertVisible('nav')
->assertVisible('@toolbar');
});
+*/
}
/**
diff --git a/src/tests/Feature/Controller/PaymentsStripeTest.php b/src/tests/Feature/Controller/PaymentsStripeTest.php
--- a/src/tests/Feature/Controller/PaymentsStripeTest.php
+++ b/src/tests/Feature/Controller/PaymentsStripeTest.php
@@ -489,8 +489,6 @@
*/
public function testTopUpAndWebhook(): void
{
- $this->markTestIncomplete();
-
Bus::fake();
$user = $this->getTestUser('john@kolab.org');
@@ -541,6 +539,8 @@
$client->addResponse($paymentMethod);
$client->addResponse($setupIntent);
$client->addResponse($paymentIntent);
+ $client->addResponse($setupIntent);
+ $client->addResponse($paymentMethod);
// Expect a recurring payment as we have a valid mandate at this point
$result = PaymentsController::topUpWallet($wallet);
diff --git a/src/tests/Feature/EntitlementTest.php b/src/tests/Feature/EntitlementTest.php
--- a/src/tests/Feature/EntitlementTest.php
+++ b/src/tests/Feature/EntitlementTest.php
@@ -36,6 +36,9 @@
parent::tearDown();
}
+ /**
+ * Test for Entitlement::costsPerDay()
+ */
public function testCostsPerDay(): void
{
// 444
@@ -56,9 +59,10 @@
}
/**
- * Tests for User::AddEntitlement()
+ * Tests for entitlements
+ * @todo This really should be in User or Wallet tests file
*/
- public function testUserAddEntitlement(): void
+ public function testEntitlements(): void
{
$packageDomain = Package::where('title', 'domain-hosting')->first();
$packageKolab = Package::where('title', 'kolab')->first();
@@ -99,11 +103,9 @@
$this->assertTrue($wallet->fresh()->balance < 0);
}
- public function testAddExistingEntitlement(): void
- {
- $this->markTestIncomplete();
- }
-
+ /**
+ * @todo This really should be in User tests file
+ */
public function testEntitlementFunctions(): void
{
$user = $this->getTestUser('entitlement-test@kolabnow.com');
@@ -116,24 +118,20 @@
$this->assertNotNull($wallet);
$sku = \App\Sku::where('title', 'mailbox')->first();
- $this->assertNotNull($sku);
$entitlement = Entitlement::where('wallet_id', $wallet->id)
->where('sku_id', $sku->id)->first();
$this->assertNotNull($entitlement);
-
- $eSKU = $entitlement->sku;
- $this->assertSame($sku->id, $eSKU->id);
-
- $eWallet = $entitlement->wallet;
- $this->assertSame($wallet->id, $eWallet->id);
-
- $eEntitleable = $entitlement->entitleable;
- $this->assertEquals($user->id, $eEntitleable->id);
- $this->assertTrue($eEntitleable instanceof \App\User);
+ $this->assertSame($sku->id, $entitlement->sku->id);
+ $this->assertSame($wallet->id, $entitlement->wallet->id);
+ $this->assertEquals($user->id, $entitlement->entitleable->id);
+ $this->assertTrue($entitlement->entitleable instanceof \App\User);
}
+ /**
+ * @todo This really should be in User or Wallet tests file
+ */
public function testBillDeletedEntitlement(): void
{
$user = $this->getTestUser('entitlement-test@kolabnow.com');
diff --git a/src/tests/Feature/UserTest.php b/src/tests/Feature/UserTest.php
--- a/src/tests/Feature/UserTest.php
+++ b/src/tests/Feature/UserTest.php
@@ -410,40 +410,6 @@
Queue::assertPushed(\App\Jobs\User\UpdateJob::class, 4);
$this->assertCount(0, $user->aliases()->get());
-
- // The test below fail since we removed validation code from the UserAliasObserver
- $this->markTestIncomplete();
-
- // Test sanity checks in UserAliasObserver
- Queue::fake();
-
- // Existing user
- $user->setAliases(['john@kolab.org']);
- $this->assertCount(0, $user->aliases()->get());
-
- // Existing alias (in another account)
- $user->setAliases(['john.doe@kolab.org']);
- $this->assertCount(0, $user->aliases()->get());
-
- Queue::assertNothingPushed();
-
- // Existing user (in the same group account)
- $ned = $this->getTestUser('ned@kolab.org');
- $ned->setAliases(['john@kolab.org']);
- $this->assertCount(0, $ned->aliases()->get());
-
- // Existing alias (in the same group account)
- $ned = $this->getTestUser('ned@kolab.org');
- $ned->setAliases(['john.doe@kolab.org']);
- $this->assertSame('john.doe@kolab.org', $ned->aliases()->first()->alias);
-
- // Existing alias (in another account, public domain)
- $user->setAliases(['alias@kolabnow.com']);
- $ned->setAliases(['alias@kolabnow.com']);
- $this->assertCount(0, $ned->aliases()->get());
-
- // cleanup
- $ned->setAliases([]);
}
/**
diff --git a/src/tests/StripeMockClient.php b/src/tests/StripeMockClient.php
--- a/src/tests/StripeMockClient.php
+++ b/src/tests/StripeMockClient.php
@@ -10,6 +10,10 @@
public function request($method, $absUrl, $headers, $params, $hasFile)
{
+ if (empty($this->responses)) {
+ throw new \Exception("StripeMockClient: Missing response for $absUrl.");
+ }
+
$response = array_shift($this->responses);
return $response;

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 7:55 AM (4 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18820053
Default Alt Text
D2032.1775202952.diff (6 KB)

Event Timeline