diff --git a/src/app/Backends/PGP.php b/src/app/Backends/PGP.php --- a/src/app/Backends/PGP.php +++ b/src/app/Backends/PGP.php @@ -67,7 +67,7 @@ // ->setExpirationDate(0) ->setKeyParams(\Crypt_GPG_SubKey::ALGORITHM_RSA, \config('pgp.length')) ->setSubKeyParams(\Crypt_GPG_SubKey::ALGORITHM_RSA, \config('pgp.length')) - ->generateKey(null, $email); + ->generateKey('', $email); // Store the keypair in Roundcube Enigma storage self::dbSave(true); diff --git a/src/app/Backends/Roundcube.php b/src/app/Backends/Roundcube.php --- a/src/app/Backends/Roundcube.php +++ b/src/app/Backends/Roundcube.php @@ -123,7 +123,7 @@ // No records found, do initial sync if already have the keyring if (empty($file)) { - self::enigmaSave(true, $homedir); + self::enigmaSave($email, $homedir); } } diff --git a/src/app/CompanionApp.php b/src/app/CompanionApp.php --- a/src/app/CompanionApp.php +++ b/src/app/CompanionApp.php @@ -24,14 +24,14 @@ ]; /** - * Send a notification via firebase. - * - * @param array $deviceIds A list of device id's to send the notification to - * @param array $data The data to include in the notification. - * - * @throws \Exception on notification failure - * @return bool true if a notification has been sent - */ + * Send a notification via firebase. + * + * @param array $deviceIds A list of device id's to send the notification to + * @param array $data The data to include in the notification. + * + * @throws \Exception on notification failure + * @return bool true if a notification has been sent + */ private static function pushFirebaseNotification($deviceIds, $data): bool { \Log::debug("sending notification to " . var_export($deviceIds, true)); @@ -64,11 +64,11 @@ } /** - * Send a notification to a user. - * - * @throws \Exception on notification failure - * @return bool true if a notification has been sent - */ + * Send a notification to a user. + * + * @throws \Exception on notification failure + * @return bool true if a notification has been sent + */ public static function notifyUser($userId, $data): bool { $notificationTokens = CompanionApp::where('user_id', $userId) @@ -107,8 +107,10 @@ /** * Set the PassportClient of this CompanionApp + * + * @param \Laravel\Passport\Client $client The client object */ - public function setPassportClient(\App\Auth\PassportClient $client) + public function setPassportClient(\Laravel\Passport\Client $client) { return $this->oauth_client_id = $client->id; } diff --git a/src/app/Console/Commands/Data/Import/IP4NetsCommand.php b/src/app/Console/Commands/Data/Import/IP4NetsCommand.php --- a/src/app/Console/Commands/Data/Import/IP4NetsCommand.php +++ b/src/app/Console/Commands/Data/Import/IP4NetsCommand.php @@ -98,7 +98,7 @@ $bar->advance(); - $mask = 32 - log($items[4], 2); + $mask = 32 - log((float) $items[4], 2); $broadcast = long2ip((ip2long($items[3]) + 2 ** (32 - $mask)) - 1); $net = \App\IP4Net::where( diff --git a/src/app/Console/Commands/Data/Import/LdifCommand.php b/src/app/Console/Commands/Data/Import/LdifCommand.php --- a/src/app/Console/Commands/Data/Import/LdifCommand.php +++ b/src/app/Console/Commands/Data/Import/LdifCommand.php @@ -511,7 +511,7 @@ $user->assignPackageAndWallet($this->packages['user'], $this->wallet ?: $user->wallets()->first()); if (!empty($data->quota)) { - $quota = ceil($data->quota / 1024 / 1024) - $this->packages['quota']; + $quota = (int) (ceil($data->quota / 1024 / 1024) - $this->packages['quota']); if ($quota > 0) { $user->assignSku($this->packages['storage'], $quota); } diff --git a/src/app/Console/Commands/Domain/SetStatusCommand.php b/src/app/Console/Commands/Domain/SetStatusCommand.php --- a/src/app/Console/Commands/Domain/SetStatusCommand.php +++ b/src/app/Console/Commands/Domain/SetStatusCommand.php @@ -40,6 +40,6 @@ $domain->status = (int) $this->argument('status'); $domain->save(); - $this->info($domain->status); + $this->info((string) $domain->status); } } diff --git a/src/app/Console/Commands/Group/CreateCommand.php b/src/app/Console/Commands/Group/CreateCommand.php --- a/src/app/Console/Commands/Group/CreateCommand.php +++ b/src/app/Console/Commands/Group/CreateCommand.php @@ -84,6 +84,6 @@ DB::commit(); - $this->info($group->id); + $this->info((string) $group->id); } } diff --git a/src/app/Console/Commands/SharedFolder/CreateCommand.php b/src/app/Console/Commands/SharedFolder/CreateCommand.php --- a/src/app/Console/Commands/SharedFolder/CreateCommand.php +++ b/src/app/Console/Commands/SharedFolder/CreateCommand.php @@ -96,6 +96,6 @@ DB::commit(); - $this->info($folder->id); + $this->info((string) $folder->id); } } diff --git a/src/app/Console/Commands/Wallet/GetBalanceCommand.php b/src/app/Console/Commands/Wallet/GetBalanceCommand.php --- a/src/app/Console/Commands/Wallet/GetBalanceCommand.php +++ b/src/app/Console/Commands/Wallet/GetBalanceCommand.php @@ -34,6 +34,6 @@ return 1; } - $this->info($wallet->balance); + $this->info((string) $wallet->balance); } } diff --git a/src/app/Console/Commands/Wallet/GetDiscountCommand.php b/src/app/Console/Commands/Wallet/GetDiscountCommand.php --- a/src/app/Console/Commands/Wallet/GetDiscountCommand.php +++ b/src/app/Console/Commands/Wallet/GetDiscountCommand.php @@ -39,6 +39,6 @@ return 0; } - $this->info($wallet->discount->discount); + $this->info((string) $wallet->discount->discount); } } diff --git a/src/app/Console/Commands/Wallet/MandateCommand.php b/src/app/Console/Commands/Wallet/MandateCommand.php --- a/src/app/Console/Commands/Wallet/MandateCommand.php +++ b/src/app/Console/Commands/Wallet/MandateCommand.php @@ -48,7 +48,7 @@ } if ($this->option('disable') && $disabled == 'No') { - $wallet->setSetting('mandate_disabled', 1); + $wallet->setSetting('mandate_disabled', '1'); $disabled = 'Yes'; } elseif ($this->option('enable') && $disabled == 'Yes') { $wallet->setSetting('mandate_disabled', null); diff --git a/src/app/Console/ObjectListCommand.php b/src/app/Console/ObjectListCommand.php --- a/src/app/Console/ObjectListCommand.php +++ b/src/app/Console/ObjectListCommand.php @@ -94,7 +94,7 @@ // Get objects older/younger than specified time, e.g. --filter=MIN-AGE:1Y if (preg_match('/^(min|max)-age:([0-9]+)([mdy])$/i', $filter, $matches)) { $operator = strtolower($matches[1]) == 'min' ? '<=' : '>='; - $count = $matches[2]; + $count = (int) $matches[2]; $period = strtolower($matches[3]); $date = \Carbon\Carbon::now(); diff --git a/src/app/Documents/Receipt.php b/src/app/Documents/Receipt.php --- a/src/app/Documents/Receipt.php +++ b/src/app/Documents/Receipt.php @@ -52,7 +52,7 @@ $wallet->id = \App\Utils::uuidStr(); $wallet->owner = new User(['id' => 123456789]); - $receipt = new self($wallet, date('Y'), date('n')); + $receipt = new self($wallet, (int) date('Y'), (int) date('n')); self::$fakeMode = true; diff --git a/src/app/Http/Controllers/API/AuthController.php b/src/app/Http/Controllers/API/AuthController.php --- a/src/app/Http/Controllers/API/AuthController.php +++ b/src/app/Http/Controllers/API/AuthController.php @@ -162,8 +162,8 @@ /** * Get the token array structure. * - * @param \Illuminate\Http\JsonResponse $tokenResponse The response containing the token. - * @param ?\App\User $user The user being authenticated + * @param \Symfony\Component\HttpFoundation\Response $tokenResponse The response containing the token. + * @param ?\App\User $user The user being authenticated * * @return \Illuminate\Http\JsonResponse */ diff --git a/src/app/Http/Controllers/API/SignupController.php b/src/app/Http/Controllers/API/SignupController.php --- a/src/app/Http/Controllers/API/SignupController.php +++ b/src/app/Http/Controllers/API/SignupController.php @@ -526,7 +526,7 @@ if ($rate && $rate->rate > 0) { // TODO: app.vat.mode - $vat = round($planCost * $rate->rate / 100); + $vat = (int) round($planCost * $rate->rate / 100); $content = self::trans('app.vat-incl', [ 'rate' => Utils::percent($rate->rate), 'cost' => Utils::money($planCost - $vat, $currency), diff --git a/src/app/Http/Controllers/API/V4/PaymentsController.php b/src/app/Http/Controllers/API/V4/PaymentsController.php --- a/src/app/Http/Controllers/API/V4/PaymentsController.php +++ b/src/app/Http/Controllers/API/V4/PaymentsController.php @@ -400,7 +400,7 @@ // Disable auto-payment and notify the user if ($wallet->balance + $amount < 0) { // Disable (not remove) the mandate - $wallet->setSetting('mandate_disabled', 1); + $wallet->setSetting('mandate_disabled', '1'); \App\Jobs\PaymentMandateDisabledEmail::dispatch($wallet); return false; } diff --git a/src/app/Http/Controllers/API/V4/RoomsController.php b/src/app/Http/Controllers/API/V4/RoomsController.php --- a/src/app/Http/Controllers/API/V4/RoomsController.php +++ b/src/app/Http/Controllers/API/V4/RoomsController.php @@ -68,7 +68,10 @@ $room->assignToWallet($user->wallets()->first()); } - $rooms = $user->rooms(true)->union($shared)->orderBy('name')->get() + $rooms = $user->rooms(true) + ->union($shared) // @phpstan-ignore-line + ->orderBy('name') + ->get() ->map(function ($room) { return $this->objectToClient($room); }); diff --git a/src/app/Providers/Payment/Coinbase.php b/src/app/Providers/Payment/Coinbase.php --- a/src/app/Providers/Payment/Coinbase.php +++ b/src/app/Providers/Payment/Coinbase.php @@ -201,15 +201,17 @@ { $code = $response->getStatusCode(); if ($code != 200 && $code != 201) { - \Log::error(var_export($response)); + \Log::error(var_export($response, true)); + $decoded = json_decode($response->getBody(), true); - $message = ""; + $message = ''; if ( is_array($decoded) && array_key_exists('error', $decoded) && is_array($decoded['error']) && array_key_exists('message', $decoded['error']) ) { $message = $decoded['error']['message']; } + \Log::error("$str [$code]: $message"); } } diff --git a/src/app/Providers/Payment/Mollie.php b/src/app/Providers/Payment/Mollie.php --- a/src/app/Providers/Payment/Mollie.php +++ b/src/app/Providers/Payment/Mollie.php @@ -317,7 +317,7 @@ \Log::info(sprintf('Mollie payment failed (%s)', $response->id)); // Disable the mandate - $wallet->setSetting('mandate_disabled', 1); + $wallet->setSetting('mandate_disabled', '1'); $notify = true; } @@ -415,7 +415,7 @@ // Disable the mandate if ($payment->type == Payment::TYPE_RECURRING) { $notify = true; - $payment->wallet->setSetting('mandate_disabled', 1); + $payment->wallet->setSetting('mandate_disabled', '1'); } } diff --git a/src/app/Providers/Payment/Stripe.php b/src/app/Providers/Payment/Stripe.php --- a/src/app/Providers/Payment/Stripe.php +++ b/src/app/Providers/Payment/Stripe.php @@ -333,7 +333,7 @@ if ($status != Payment::STATUS_CANCELED && $payment->type == Payment::TYPE_RECURRING) { // Disable the mandate if ($status == Payment::STATUS_FAILED) { - $payment->wallet->setSetting('mandate_disabled', 1); + $payment->wallet->setSetting('mandate_disabled', '1'); } // Notify the user diff --git a/src/app/Tenant.php b/src/app/Tenant.php --- a/src/app/Tenant.php +++ b/src/app/Tenant.php @@ -23,7 +23,7 @@ * Utility method to get tenant-specific system setting. * If the setting is not specified for the tenant a system-wide value will be returned. * - * @param int $tenantId Tenant identifier + * @param ?int $tenantId Tenant identifier * @param string $key Setting name * * @return mixed Setting value diff --git a/src/app/Traits/UserConfigTrait.php b/src/app/Traits/UserConfigTrait.php --- a/src/app/Traits/UserConfigTrait.php +++ b/src/app/Traits/UserConfigTrait.php @@ -67,7 +67,7 @@ $this->setSetting($key, !empty($value) ? json_encode($value) : null); } elseif ($key == 'max_password_age') { - $this->setSetting($key, intval($value) > 0 ? (int) $value : null); + $this->setSetting($key, intval($value) > 0 ? ((string) intval($value)) : null); } elseif ($key == 'password_policy') { // Validate the syntax and make sure min and max is included if ( diff --git a/src/app/Utils.php b/src/app/Utils.php --- a/src/app/Utils.php +++ b/src/app/Utils.php @@ -404,15 +404,15 @@ $randStrs = []; for ($x = 0; $x < $qty; $x++) { - $randStrs[$x] = []; + $string = []; for ($y = 0; $y < $length; $y++) { - $randStrs[$x][] = $chars[rand(0, strlen($chars) - 1)]; + $string[] = $chars[rand(0, strlen($chars) - 1)]; } - shuffle($randStrs[$x]); + shuffle($string); - $randStrs[$x] = implode('', $randStrs[$x]); + $randStrs[$x] = implode('', $string); } return implode($join, $randStrs); diff --git a/src/app/Wallet.php b/src/app/Wallet.php --- a/src/app/Wallet.php +++ b/src/app/Wallet.php @@ -102,11 +102,13 @@ // Get all relevant entitlements... $entitlements = $this->entitlements()->withTrashed() // existing entitlements created, or billed last less than a month ago + // @phpstan-ignore-next-line ->where(function (Builder $query) { $query->whereNull('deleted_at') ->where('updated_at', '<=', Carbon::now()->subMonthsWithoutOverflow(1)); }) // deleted entitlements not yet charged + // @phpstan-ignore-next-line ->orWhere(function (Builder $query) { $query->whereNotNull('deleted_at') ->whereColumn('updated_at', '<', 'deleted_at'); diff --git a/src/include/rcube_imap_generic.php b/src/include/rcube_imap_generic.php --- a/src/include/rcube_imap_generic.php +++ b/src/include/rcube_imap_generic.php @@ -4088,8 +4088,8 @@ /** * Set the value of the debugging flag. * - * @param boolean $debug New value for the debugging flag. - * @param callback $handler Logging handler function + * @param bool $debug New value for the debugging flag. + * @param ?callable $handler Logging handler function * * @since 0.5-stable */ diff --git a/src/phpstan.neon b/src/phpstan.neon --- a/src/phpstan.neon +++ b/src/phpstan.neon @@ -7,7 +7,7 @@ - '#Call to an undefined [a-zA-Z0-9<>\\ ]+::withObjectTenantContext\(\)#' - '#Call to an undefined [a-zA-Z0-9<>\\ ]+::withSubjectTenantContext\(\)#' - '#Call to an undefined method Tests\\Browser::#' - level: 4 + level: 5 parallel: processTimeout: 300.0 paths: diff --git a/src/tests/Browser/Components/QuotaInput.php b/src/tests/Browser/Components/QuotaInput.php --- a/src/tests/Browser/Components/QuotaInput.php +++ b/src/tests/Browser/Components/QuotaInput.php @@ -47,7 +47,7 @@ */ public function assertQuotaValue($browser, $value) { - $browser->assertValue('@input', $value) + $browser->assertValue('@input', (string) $value) ->assertSeeIn('@label', "$value GB"); } 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 @@ -235,7 +235,7 @@ // Expect the participant removed from other users windows $browser->waitUntilMissing('@session div.meet-video:not(.self)') - ->assertSeeIn('@counter', 1); + ->assertSeeIn('@counter', '1'); // Join the room as guest again $guest->visit(new RoomPage('john')) diff --git a/src/tests/Browser/PaymentMollieTest.php b/src/tests/Browser/PaymentMollieTest.php --- a/src/tests/Browser/PaymentMollieTest.php +++ b/src/tests/Browser/PaymentMollieTest.php @@ -123,7 +123,7 @@ $browser->assertSeeIn('@title', 'Set up auto-payment') ->waitFor('@body #mandate_amount') ->assertSeeIn('@body label[for="mandate_amount"]', 'Fill up by') - ->assertValue('@body #mandate_amount', Payment::MIN_AMOUNT / 100) + ->assertValue('@body #mandate_amount', strval(Payment::MIN_AMOUNT / 100)) ->assertSeeIn('@body label[for="mandate_balance"]', 'when account balance is below') // phpcs:ignore ->assertValue('@body #mandate_balance', '0') ->assertSeeIn('@button-cancel', 'Cancel') diff --git a/src/tests/Browser/PaymentStripeTest.php b/src/tests/Browser/PaymentStripeTest.php --- a/src/tests/Browser/PaymentStripeTest.php +++ b/src/tests/Browser/PaymentStripeTest.php @@ -130,7 +130,7 @@ $browser->assertSeeIn('@title', 'Set up auto-payment') ->waitFor('@body #mandate_amount') ->assertSeeIn('@body label[for="mandate_amount"]', 'Fill up by') - ->assertValue('@body #mandate_amount', Payment::MIN_AMOUNT / 100) + ->assertValue('@body #mandate_amount', strval(Payment::MIN_AMOUNT / 100)) ->assertSeeIn('@body label[for="mandate_balance"]', 'when account balance is below') // phpcs:ignore ->assertValue('@body #mandate_balance', '0') ->assertSeeIn('@button-cancel', 'Cancel') diff --git a/src/tests/Browser/Reseller/InvitationsTest.php b/src/tests/Browser/Reseller/InvitationsTest.php --- a/src/tests/Browser/Reseller/InvitationsTest.php +++ b/src/tests/Browser/Reseller/InvitationsTest.php @@ -124,7 +124,7 @@ $i1 = SignupInvitation::create(['email' => 'test1@domain.org']); $i2 = SignupInvitation::create(['email' => 'test2@domain.org']); SignupInvitation::where('id', $i1->id)->update(['status' => SignupInvitation::STATUS_FAILED]); - SignupInvitation::where('id', $i2->id)->update(['created_at' => now()->subHours('2')]); + SignupInvitation::where('id', $i2->id)->update(['created_at' => now()->subHours(2)]); $browser->visit(new Invitations()) ->assertElementsCount('@table tbody tr', 2); @@ -164,14 +164,14 @@ $i10 = SignupInvitation::create(['email' => 'email10@other.com']); $i11 = SignupInvitation::create(['email' => 'email11@other.com']); - SignupInvitation::query()->update(['created_at' => now()->subDays('1')]); + SignupInvitation::query()->update(['created_at' => now()->subDays(1)]); SignupInvitation::where('id', $i1->id) - ->update(['created_at' => now()->subHours('2'), 'status' => SignupInvitation::STATUS_FAILED]); + ->update(['created_at' => now()->subHours(2), 'status' => SignupInvitation::STATUS_FAILED]); SignupInvitation::where('id', $i2->id) - ->update(['created_at' => now()->subHours('3'), 'status' => SignupInvitation::STATUS_SENT]); + ->update(['created_at' => now()->subHours(3), 'status' => SignupInvitation::STATUS_SENT]); SignupInvitation::where('id', $i3->id) - ->update(['created_at' => now()->subHours('4'), 'status' => SignupInvitation::STATUS_COMPLETED]); - SignupInvitation::where('id', $i11->id)->update(['created_at' => now()->subDays('3')]); + ->update(['created_at' => now()->subHours(4), 'status' => SignupInvitation::STATUS_COMPLETED]); + SignupInvitation::where('id', $i11->id)->update(['created_at' => now()->subDays(3)]); // Test paging (load more) feature $browser->visit(new Invitations()) diff --git a/src/tests/Feature/Controller/Reseller/InvitationsTest.php b/src/tests/Feature/Controller/Reseller/InvitationsTest.php --- a/src/tests/Feature/Controller/Reseller/InvitationsTest.php +++ b/src/tests/Feature/Controller/Reseller/InvitationsTest.php @@ -122,15 +122,15 @@ $i12 = SignupInvitation::create(['email' => 'email12@test.com']); $i13 = SignupInvitation::create(['email' => 'email13@ext.com']); - SignupInvitation::query()->update(['created_at' => now()->subDays('1')]); + SignupInvitation::query()->update(['created_at' => now()->subDays(1)]); SignupInvitation::where('id', $i1->id) - ->update(['created_at' => now()->subHours('2'), 'status' => SignupInvitation::STATUS_FAILED]); + ->update(['created_at' => now()->subHours(2), 'status' => SignupInvitation::STATUS_FAILED]); SignupInvitation::where('id', $i2->id) - ->update(['created_at' => now()->subHours('3'), 'status' => SignupInvitation::STATUS_SENT]); + ->update(['created_at' => now()->subHours(3), 'status' => SignupInvitation::STATUS_SENT]); - SignupInvitation::where('id', $i11->id)->update(['created_at' => now()->subDays('3')]); + SignupInvitation::where('id', $i11->id)->update(['created_at' => now()->subDays(3)]); SignupInvitation::where('id', $i12->id)->update(['tenant_id' => $reseller2->tenant_id]); SignupInvitation::where('id', $i13->id)->update(['tenant_id' => $reseller2->tenant_id]); 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 @@ -113,7 +113,7 @@ $storage_sku = Sku::withEnvTenantContext()->where('title', 'storage')->first(); // Invalid empty input - SkusController::updateEntitlements($jane, null, $wallet); + SkusController::updateEntitlements($jane, [], $wallet); $this->assertSame(0, $wallet->entitlements()->count()); diff --git a/src/tests/Feature/GroupTest.php b/src/tests/Feature/GroupTest.php --- a/src/tests/Feature/GroupTest.php +++ b/src/tests/Feature/GroupTest.php @@ -77,7 +77,7 @@ $this->assertSame('group-test@kolabnow.com', $group->email); $this->assertSame('group-test', $group->name); - $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', $group->id); + $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', (string) $group->id); $this->assertSame([], $group->members); $this->assertTrue($group->isNew()); $this->assertFalse($group->isActive()); diff --git a/src/tests/Feature/ResourceTest.php b/src/tests/Feature/ResourceTest.php --- a/src/tests/Feature/ResourceTest.php +++ b/src/tests/Feature/ResourceTest.php @@ -109,7 +109,7 @@ $resource->domainName = 'kolabnow.com'; $resource->save(); - $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', $resource->id); + $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', (string) $resource->id); $this->assertMatchesRegularExpression('/^resource-[0-9]{1,20}@kolabnow\.com$/', $resource->email); $this->assertSame('Reśo', $resource->name); $this->assertTrue($resource->isNew()); diff --git a/src/tests/Feature/SharedFolderTest.php b/src/tests/Feature/SharedFolderTest.php --- a/src/tests/Feature/SharedFolderTest.php +++ b/src/tests/Feature/SharedFolderTest.php @@ -173,7 +173,7 @@ $folder->domainName = 'kolabnow.com'; $folder->save(); - $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', $folder->id); + $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', (string) $folder->id); $this->assertMatchesRegularExpression('/^mail-[0-9]{1,20}@kolabnow\.com$/', $folder->email); $this->assertSame('Reśo', $folder->name); $this->assertTrue($folder->isNew()); 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 @@ -376,7 +376,7 @@ $domain = \config('app.domain'); - \App\Tenant::find(\config('app.tenant_id'))->setSetting('pgp.enable', 0); + \App\Tenant::find(\config('app.tenant_id'))->setSetting('pgp.enable', '0'); $user = User::create([ 'email' => 'USER-test@' . \strtoupper($domain), 'password' => 'test', @@ -406,7 +406,7 @@ // Test invoking KeyCreateJob $this->deleteTestUser("user-test@$domain"); - \App\Tenant::find(\config('app.tenant_id'))->setSetting('pgp.enable', 1); + \App\Tenant::find(\config('app.tenant_id'))->setSetting('pgp.enable', '1'); $user = User::create(['email' => "user-test@$domain", 'password' => 'test']); diff --git a/src/tests/TestCaseTrait.php b/src/tests/TestCaseTrait.php --- a/src/tests/TestCaseTrait.php +++ b/src/tests/TestCaseTrait.php @@ -734,7 +734,7 @@ usort( $this->domainUsers, function ($a, $b) { - return $a->email > $b->email; + return $a->email <=> $b->email; } );