diff --git a/src/composer.json b/src/composer.json --- a/src/composer.json +++ b/src/composer.json @@ -34,17 +34,13 @@ "tymon/jwt-auth": "^1.0" }, "require-dev": { - "beyondcode/laravel-dump-server": "^1.0", "beyondcode/laravel-er-diagram-generator": "^1.3", "code-lts/doctum": "^5.1", - "filp/whoops": "^2.0", - "fzaninotto/faker": "^1.4", "kirschbaum-development/mail-intercept": "^0.2.4", "laravel/dusk": "~6.15.0", - "mockery/mockery": "^1.0", "nunomaduro/larastan": "^0.7", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^8" + "phpunit/phpunit": "^9" }, "config": { "optimize-autoloader": true, diff --git a/src/database/factories/UserFactory.php b/src/database/factories/UserFactory.php deleted file mode 100644 --- a/src/database/factories/UserFactory.php +++ /dev/null @@ -1,27 +0,0 @@ -define( - User::class, - function (Faker $faker) { - return [ - 'email' => $faker->unique()->safeEmail, - 'password' => Str::random(64) - ]; - } -); 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 @@ -136,8 +136,6 @@ $joe->setAliases(['joe.monster@kolab.org']); - // factory(User::class, 10)->create(); - $jeroen = User::create( [ 'email' => 'jeroen@jeroen.jeroen', diff --git a/src/phpunit.xml b/src/phpunit.xml --- a/src/phpunit.xml +++ b/src/phpunit.xml @@ -25,13 +25,13 @@ tests/Browser - - + + ./app - - + + - + diff --git a/src/tests/Browser.php b/src/tests/Browser.php --- a/src/tests/Browser.php +++ b/src/tests/Browser.php @@ -19,8 +19,9 @@ { $element = $this->resolver->findOrFail($selector); $value = (string) $element->getAttribute($attribute); + $error = "No expected text in [$selector][$attribute]. Found: $value"; - Assert::assertRegExp($regexp, $value, "No expected text in [$selector][$attribute]. Found: $value"); + Assert::assertMatchesRegularExpression($regexp, $value, $error); return $this; } @@ -149,7 +150,7 @@ { $element = $this->resolver->findOrFail($selector); - Assert::assertRegExp($regexp, $element->getText(), "No expected text in [$selector]"); + Assert::assertMatchesRegularExpression($regexp, $element->getText(), "No expected text in [$selector]"); return $this; } 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 @@ -63,7 +63,7 @@ $this->assertSame(1, $json['count']); $this->assertCount(1, $json['list']); - $this->assertRegExp('/^[0-9a-z-]{11}$/', $json['list'][0]['name']); + $this->assertMatchesRegularExpression('/^[0-9a-z-]{11}$/', $json['list'][0]['name']); } /** diff --git a/src/tests/Feature/Controller/PaymentsMollieTest.php b/src/tests/Feature/Controller/PaymentsMollieTest.php --- a/src/tests/Feature/Controller/PaymentsMollieTest.php +++ b/src/tests/Feature/Controller/PaymentsMollieTest.php @@ -137,7 +137,7 @@ $json = $response->json(); $this->assertSame('success', $json['status']); - $this->assertRegExp('|^https://www.mollie.com|', $json['redirectUrl']); + $this->assertMatchesRegularExpression('|^https://www.mollie.com|', $json['redirectUrl']); // Assert the proper payment amount has been used $payment = Payment::where('id', $json['id'])->first(); @@ -366,7 +366,7 @@ $json = $response->json(); $this->assertSame('success', $json['status']); - $this->assertRegExp('|^https://www.mollie.com|', $json['redirectUrl']); + $this->assertMatchesRegularExpression('|^https://www.mollie.com|', $json['redirectUrl']); $wallet = $user->wallets()->first(); $payments = Payment::where('wallet_id', $wallet->id)->get(); 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 @@ -129,7 +129,7 @@ $json = $response->json(); $this->assertSame('success', $json['status']); - $this->assertRegExp('|^cs_test_|', $json['id']); + $this->assertMatchesRegularExpression('|^cs_test_|', $json['id']); // Assert the proper payment amount has been used // Stripe in 'setup' mode does not allow to set the amount @@ -320,7 +320,7 @@ $json = $response->json(); $this->assertSame('success', $json['status']); - $this->assertRegExp('|^cs_test_|', $json['id']); + $this->assertMatchesRegularExpression('|^cs_test_|', $json['id']); $wallet = $user->wallets()->first(); $payments = Payment::where('wallet_id', $wallet->id)->get(); diff --git a/src/tests/Feature/Controller/Reseller/PaymentsMollieTest.php b/src/tests/Feature/Controller/Reseller/PaymentsMollieTest.php --- a/src/tests/Feature/Controller/Reseller/PaymentsMollieTest.php +++ b/src/tests/Feature/Controller/Reseller/PaymentsMollieTest.php @@ -82,7 +82,7 @@ $json = $response->json(); $this->assertSame('success', $json['status']); - $this->assertRegExp('|^https://www.mollie.com|', $json['redirectUrl']); + $this->assertMatchesRegularExpression('|^https://www.mollie.com|', $json['redirectUrl']); // Assert the proper payment amount has been used $payment = Payment::where('id', $json['id'])->first(); @@ -201,7 +201,7 @@ $json = $response->json(); $this->assertSame('success', $json['status']); - $this->assertRegExp('|^https://www.mollie.com|', $json['redirectUrl']); + $this->assertMatchesRegularExpression('|^https://www.mollie.com|', $json['redirectUrl']); } /** diff --git a/src/tests/Feature/Controller/WalletsTest.php b/src/tests/Feature/Controller/WalletsTest.php --- a/src/tests/Feature/Controller/WalletsTest.php +++ b/src/tests/Feature/Controller/WalletsTest.php @@ -71,13 +71,13 @@ $wallet->balance = 990; $notice = $method->invoke($controller, $wallet); - $this->assertRegExp('/\((1 month|4 weeks)\)/', $notice); + $this->assertMatchesRegularExpression('/\((1 month|4 weeks)\)/', $notice); // test "2 months" $wallet->balance = 990 * 2.6; $notice = $method->invoke($controller, $wallet); - $this->assertRegExp('/\(2 months 2 weeks\)/', $notice); + $this->assertMatchesRegularExpression('/\(2 months 2 weeks\)/', $notice); // Change locale to make sure the text is localized by Carbon \app()->setLocale('de'); @@ -86,7 +86,7 @@ $wallet->balance = 990 * 23.5; $notice = $method->invoke($controller, $wallet); - $this->assertRegExp('/\(1 Jahr 11 Monate\)/', $notice); + $this->assertMatchesRegularExpression('/\(1 Jahr 11 Monate\)/', $notice); // Old entitlements, 100% discount $this->backdateEntitlements($wallet->entitlements, Carbon::now()->subDays(40)); 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 @@ -110,7 +110,7 @@ $group = Group::create(['email' => 'GROUP-test@kolabnow.com']); $this->assertSame('group-test@kolabnow.com', $group->email); - $this->assertRegExp('/^[0-9]{1,20}$/', $group->id); + $this->assertMatchesRegularExpression('/^[0-9]{1,20}$/', $group->id); $this->assertSame([], $group->members); $this->assertTrue($group->isNew()); $this->assertTrue($group->isActive()); diff --git a/src/tests/Feature/Jobs/WalletCheckTest.php b/src/tests/Feature/Jobs/WalletCheckTest.php --- a/src/tests/Feature/Jobs/WalletCheckTest.php +++ b/src/tests/Feature/Jobs/WalletCheckTest.php @@ -110,8 +110,8 @@ $wallet->refresh(); $today_regexp = '/' . Carbon::now()->toDateString() . ' [0-9]{2}:[0-9]{2}:[0-9]{2}/'; - $this->assertRegExp($today_regexp, $wallet->getSetting('balance_negative_since')); - $this->assertRegExp($today_regexp, $wallet->getSetting('balance_warning_initial')); + $this->assertMatchesRegularExpression($today_regexp, $wallet->getSetting('balance_negative_since')); + $this->assertMatchesRegularExpression($today_regexp, $wallet->getSetting('balance_warning_initial')); } /** diff --git a/src/tests/Unit/DomainTest.php b/src/tests/Unit/DomainTest.php --- a/src/tests/Unit/DomainTest.php +++ b/src/tests/Unit/DomainTest.php @@ -119,11 +119,11 @@ $hash_code = $domain->hash(); - $this->assertRegExp('/^[a-f0-9]{32}$/', $hash_code); + $this->assertMatchesRegularExpression('/^[a-f0-9]{32}$/', $hash_code); $hash_text = $domain->hash(Domain::HASH_TEXT); - $this->assertRegExp('/^kolab-verify=[a-f0-9]{32}$/', $hash_text); + $this->assertMatchesRegularExpression('/^kolab-verify=[a-f0-9]{32}$/', $hash_text); $this->assertSame($hash_code, str_replace('kolab-verify=', '', $hash_text)); diff --git a/src/tests/Unit/UserTest.php b/src/tests/Unit/UserTest.php --- a/src/tests/Unit/UserTest.php +++ b/src/tests/Unit/UserTest.php @@ -19,7 +19,7 @@ $ssh512 = "{SSHA512}7iaw3Ur350mqGo7jwQrpkj9hiYB3Lkc/iBml1JQODbJ" . "6wYX4oOHV+E+IvIh/1nsUNzLDBMxfqa2Ob1f1ACio/w=="; - $this->assertRegExp('/^\$2y\$12\$[0-9a-zA-Z\/.]{53}$/', $user->password); + $this->assertMatchesRegularExpression('/^\$2y\$12\$[0-9a-zA-Z\/.]{53}$/', $user->password); $this->assertSame($ssh512, $user->password_ldap); } @@ -35,7 +35,7 @@ $ssh512 = "{SSHA512}7iaw3Ur350mqGo7jwQrpkj9hiYB3Lkc/iBml1JQODbJ" . "6wYX4oOHV+E+IvIh/1nsUNzLDBMxfqa2Ob1f1ACio/w=="; - $this->assertRegExp('/^\$2y\$12\$[0-9a-zA-Z\/.]{53}$/', $user->password); + $this->assertMatchesRegularExpression('/^\$2y\$12\$[0-9a-zA-Z\/.]{53}$/', $user->password); $this->assertSame($ssh512, $user->password_ldap); }