From 4794dc495b981781cc44062dc1a232c1eeea19d9 Mon Sep 17 00:00:00 2001 From: Jannik Malken Date: Wed, 11 May 2022 14:43:55 +0000 Subject: [PATCH] Allow laravel v9 --- composer.json | 6 +++--- src/Models/Transaction.php | 3 +++ tests/unit/WalletTest.php | 9 ++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 9abc03d..99c7e22 100755 --- a/composer.json +++ b/composer.json @@ -28,13 +28,13 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.0" + "illuminate/support": "^9.0" }, "require-dev": { "doctrine/dbal": "^3.0", "nunomaduro/larastan": "^1.0", - "orchestra/testbench": "^6.0", - "phpunit/phpunit": "^9.3" + "orchestra/testbench": "^7.5", + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index 77a93b4..b424c43 100755 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -19,6 +19,9 @@ * * @property int $id * @property int $wallet_id + * @property int $origin_id + * @property int|null $reference_id + * @property string|null $reference_type * @property string $type * @property string $hash * @property string $type diff --git a/tests/unit/WalletTest.php b/tests/unit/WalletTest.php index 5defc72..b53b27c 100755 --- a/tests/unit/WalletTest.php +++ b/tests/unit/WalletTest.php @@ -8,6 +8,7 @@ use MannikJ\Laravel\Wallet\Tests\Models\User; use MannikJ\Laravel\Wallet\Models\Transaction; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Queue; use MannikJ\Laravel\Wallet\Jobs\RecalculateWalletBalance; use MannikJ\Laravel\Wallet\Tests\Factories\TransactionFactory; use MannikJ\Laravel\Wallet\Tests\Factories\UserFactory; @@ -191,20 +192,22 @@ function actual_balance() /** @test */ function balance_change_doesnt_trigger_recalculation() { + Queue::fake(); $wallet = WalletFactory::new()->create(); - $this->doesntExpectJobs(RecalculateWalletBalance::class); $wallet->balance = 10; $wallet->save(); + Queue::assertNotPushed(RecalculateWalletBalance::class); } /** @test */ function balance_change_triggers_recalculation_if_activated() { + Queue::fake(); $wallet = WalletFactory::new()->create(); config(['wallet.auto_recalculate_balance' => true]); - $this->expectsJobs(RecalculateWalletBalance::class); $wallet->balance = -10; $wallet->save(); + Queue::assertPushed(RecalculateWalletBalance::class); } /** @test */ @@ -224,4 +227,4 @@ function recalculation_performance() $this->assertTrue(true); \Log::info($result); } -} \ No newline at end of file +}