Skip to content

Commit

Permalink
Merge pull request #879 from bavix/l11
Browse files Browse the repository at this point in the history
[11.x] raise the minimum version of laravel to 11
  • Loading branch information
rez1dent3 authored Feb 2, 2024
2 parents 1bef3b8 + fae7613 commit 2375b2a
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 34 deletions.
19 changes: 10 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"wallet",
"payments"
],
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable" : true,
"homepage": "https://bavix.github.io/laravel-wallet/",
"license": "MIT",
"authors": [
Expand All @@ -26,26 +27,26 @@
"ext-json": "*",
"ext-pdo": "*",
"brick/math": "~0.10",
"doctrine/dbal": "^3.5",
"illuminate/contracts": "^10.0",
"illuminate/database": "^10.0",
"illuminate/contracts": "^11.0",
"illuminate/database": "^11.0",
"ramsey/uuid": "^4.0"
},
"require-dev": {
"brianium/paratest": "^7.3",
"brianium/paratest": "^7.4",
"ergebnis/phpstan-rules": "^2.1",
"infection/infection": "~0.27",
"laravel/cashier": "^15.0",
"nunomaduro/collision": "^7.10",
"nunomaduro/larastan": "^2.7",
"orchestra/testbench": "^8.19",
"nunomaduro/collision": "^8.0",
"larastan/larastan": "^2.8",
"orchestra/testbench": "^9.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.5",
"rector/rector": "^0.19",
"symplify/easy-coding-standard": "^12.0"
"symplify/easy-coding-standard": "^12.1"
},
"suggest": {
"bavix/laravel-wallet-swap": "Addition to the laravel-wallet library for quick setting of exchange rates",
"bavix/laravel-wallet-uuid": "Addition to the laravel-wallet library uuid support in laravel-wallet",
"bavix/laravel-wallet-warmup": "Addition to the laravel-wallet library for refresh balance wallets"
},
"autoload": {
Expand Down
8 changes: 8 additions & 0 deletions database/2023_12_30_113122_extra_columns_removed.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
return new class() extends Migration {
public function up(): void
{
Schema::table($this->table(), function (Blueprint $table) {
$table->dropIndex(['from_type', 'from_id']);
$table->dropIndex(['to_type', 'to_id']);

$table->index('from_id');
$table->index('to_id');
});

Schema::dropColumns($this->table(), ['from_type', 'to_type']);
}

Expand Down
2 changes: 1 addition & 1 deletion phpstan.common.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
includes:
- vendor/nunomaduro/larastan/extension.neon
- vendor/larastan/larastan/extension.neon
- vendor/ergebnis/phpstan-rules/rules.neon

parameters:
Expand Down
12 changes: 1 addition & 11 deletions phpstan.src.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ parameters:
path: src/Models/Transfer.php

-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphOne\\:\\:withTrashed\\(\\)\\.$#"
message: "#^Cannot call method getDynamicDefaultSlug\\(\\) on class\\-string\\|object\\.$#"
count: 2
path: src/Models/Wallet.php

Expand All @@ -85,16 +85,6 @@ parameters:
count: 1
path: src/Models/Wallet.php

-
message: "#^Parameter \\#1 \\$related of method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:hasMany\\(\\) expects string, mixed given\\.$#"
count: 4
path: src/Models/Wallet.php

-
message: "#^Parameter \\#1 \\$related of method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:morphMany\\(\\) expects string, mixed given\\.$#"
count: 2
path: src/Models/Wallet.php

-
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 2
Expand Down
10 changes: 0 additions & 10 deletions phpstan.tests.baseline.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Method Bavix\\\\Wallet\\\\Test\\\\Infra\\\\Models\\\\Item\\:\\:boughtGoods\\(\\) should return Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\<Bavix\\\\Wallet\\\\Models\\\\Transfer\\> but returns Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\.$#"
count: 1
path: tests/Infra/Models/Item.php

-
message: "#^Class Bavix\\\\Wallet\\\\Test\\\\Infra\\\\TestCase is not final\\.$#"
count: 1
Expand All @@ -14,8 +9,3 @@ parameters:
message: "#^Method Bavix\\\\Wallet\\\\Test\\\\Infra\\\\TestCase\\:\\:setUp\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
count: 1
path: tests/Infra/TestCase.php

-
message: "#^Call to an undefined method Bavix\\\\Wallet\\\\Interfaces\\\\ProductInterface\\:\\:getWallet\\(\\)\\.$#"
count: 1
path: tests/Units/Domain/CartReceivingTest.php
7 changes: 6 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
executionOrder="random" resolveDependencies="true"
bootstrap="vendor/autoload.php" backupGlobals="false"
colors="true" processIsolation="false" stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<report>
<clover outputFile="./build/logs/clover.xml"/>
Expand Down
4 changes: 4 additions & 0 deletions tests/Infra/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ final protected function getPackageProviders($app): array
$app['config']->set('wallet.transfer.model', Transfer::class);
$app['config']->set('wallet.wallet.model', Wallet::class);

//infra
$app['config']->set('database.mysql.collation', 'utf8mb4_unicode_ci');

return [WalletServiceProvider::class, TestServiceProvider::class];
}

Expand All @@ -67,6 +70,7 @@ final protected function getEnvironmentSetUp($app): void
/** @var array<string, mixed> $mysql */
$mysql = $config->get('database.connections.mysql');
$config->set('database.connections.mariadb', array_merge($mysql, [
'collation' => 'utf8mb4_unicode_ci',
'port' => 3307,
]));

Expand Down
6 changes: 5 additions & 1 deletion tests/Units/Domain/TransactionsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function testPagination(): void

$query = Transaction::with('wallet')
->where('payable_id', $buyer->getKey())
->where('wallet_id', '=', $buyer->wallet->getKey())
->orderBy('created_at', 'desc')
;

Expand Down Expand Up @@ -154,7 +155,10 @@ public function testPagination2(): void

$query = Transaction::query()
->where(function ($query) use ($buyer, $walletTableName, $transactionTableName) {
$query->where('payable_id', '=', $buyer->getKey())
$query
->where('payable_type', '=', $buyer->getMorphClass())
->where('payable_id', '=', $buyer->getKey())
->where('wallet_id', '=', $buyer->wallet->getKey())
->join($walletTableName, $transactionTableName . '.wallet_id', '=', $walletTableName . '.id')
->select($transactionTableName . '.*', $walletTableName . '.name')
->get()
Expand Down
2 changes: 1 addition & 1 deletion tests/Units/Domain/WalletTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function testDefaultWalletCustomize(): void
self::assertSame(1, $wallet->meta['internal'] ?? 0);
}

public function testgetDynamicDefaultSlug(): void
public function testGetDynamicDefaultSlug(): void
{
/** @var UserDynamic $user */
$user = UserDynamicFactory::new()->create();
Expand Down

0 comments on commit 2375b2a

Please sign in to comment.