Skip to content

Commit

Permalink
Allow laravel v9
Browse files Browse the repository at this point in the history
  • Loading branch information
MannikJ committed May 11, 2022
1 parent d2b30f2 commit 4794dc4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/WalletTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand All @@ -224,4 +227,4 @@ function recalculation_performance()
$this->assertTrue(true);
\Log::info($result);
}
}
}

0 comments on commit 4794dc4

Please sign in to comment.