Skip to content

Commit

Permalink
L11 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Mar 13, 2024
1 parent 6f741ce commit 2f5472b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/laravel": "^10.3.2",
"laravel/laravel": "^11.0",
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^10.0",
"laravel/pint": "^1.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function up(): void
$table->morphs('itemable');
$table->nullableMorphs('buyable');
$table->string('name');
$table->unsignedDecimal('price');
$table->unsignedDecimal('tax')->default(0);
$table->unsignedDecimal('quantity');
$table->float('price')->unsigned();
$table->float('tax')->unsigned()->default(0);
$table->float('quantity')->unsigned();
$table->json('properties')->nullable();
$table->timestamps();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function up(): void
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('status');
$table->string('currency');
$table->unsignedDecimal('discount')->default(0);
$table->float('discount')->unsigned()->default(0);
$table->timestamps();
$table->softDeletes();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function up(): void
$table->string('key')->nullable()->unique();
$table->string('driver');
$table->string('type');
$table->unsignedDecimal('amount');
$table->float('amount')->unsigned();
$table->timestamp('completed_at')->nullable();
$table->timestamps();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function up(): void
$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete();
$table->foreignId('order_id')->nullable()->constrained('bazar_orders')->cascadeOnDelete();
$table->string('currency');
$table->unsignedDecimal('discount')->default(0);
$table->float('discount')->unsigned()->default(0);
$table->boolean('locked')->default(false);
$table->timestamps();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function up(): void
$table->id();
$table->morphs('shippable');
$table->string('driver');
$table->unsignedDecimal('cost')->default(0);
$table->unsignedDecimal('tax')->default(0);
$table->float('cost')->unsigned()->default(0);
$table->float('tax')->unsigned()->default(0);
$table->timestamps();
});
}
Expand Down
4 changes: 0 additions & 4 deletions tests/Cart/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ public function test_cart_has_cookie_driver(): void

public function test_cart_has_session_driver(): void
{
$this->session([]);

$this->app['request']->setLaravelSession($this->app['session']);

$this->assertInstanceOf(SessionDriver::class, $this->manager->driver('session'));
$this->assertInstanceOf(Cart::class, $this->manager->driver('session')->getModel());
}
Expand Down
13 changes: 6 additions & 7 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Cone\Bazar\Tests;

use Cone\Bazar\BazarServiceProvider;
use Cone\Root\Interfaces\Models\User as UserContract;
use Cone\Root\RootServiceProvider;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
Expand All @@ -16,12 +14,9 @@ abstract class TestCase extends BaseTestCase

public function createApplication(): Application
{
$app = require __DIR__.'/../vendor/laravel/laravel/bootstrap/app.php';
$app = require __DIR__.'/app.php';

$app->booting(static function () use ($app): void {
$app->register(RootServiceProvider::class);
$app->register(BazarServiceProvider::class);

$app->bind(UserContract::class, User::class);
});

Expand All @@ -34,6 +29,10 @@ public function setUp(): void
{
parent::setUp();

//
$this->startSession();

$this->app['request']->setLaravelSession(
$this->app['session']->driver()
);
}
}
25 changes: 25 additions & 0 deletions tests/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Cone\Bazar\BazarServiceProvider;
use Cone\Root\RootServiceProvider;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: __DIR__.'/../vendor/laravel/laravel')
->withRouting(
web: __DIR__.'/../vendor/laravel/laravel/routes/web.php',
commands: __DIR__.'/../vendor/laravel/laravel/routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withProviders([
RootServiceProvider::class,
BazarServiceProvider::class
])
->withExceptions(function (Exceptions $exceptions) {
//
})
->create();

0 comments on commit 2f5472b

Please sign in to comment.