chore: add test bootstrap, update phpunit config, and add Laravel 13 support to README

- Add tests/bootstrap.php to suppress PHP 8.4 vendor deprecation notices (Mockery implicit-nullable)
- Update phpunit.xml.dist to reference bootstrap, use PHPUnit 11.5 schema, and ignore indirect deprecations
- Note Laravel 13 support in README
This commit is contained in:
Joel Male
2026-05-27 19:50:09 +10:00
parent 05729b7865
commit aaa3360d1f
3 changed files with 25 additions and 14 deletions
+8 -7
View File
@@ -9,11 +9,12 @@
A Cart Implementation for Laravel. A Cart Implementation for Laravel.
Supported Laravel Versions: 10, 11, and 12. Supported Laravel Versions: 10, 11, 12, and 13.
For Laravel 9.0 and below, please use version [1.0](https://github.com/wearepixel/laravel-cart/releases/tag/1.0.12) For Laravel 9.0 and below, please use version [1.0](https://github.com/wearepixel/laravel-cart/releases/tag/1.0.12)
## Table of Contents ## Table of Contents
- [Getting Started](#-getting-started) - [Getting Started](#-getting-started)
- [Demo](#-deni) - [Demo](#-deni)
- [Documentation](#-documentation) - [Documentation](#-documentation)
@@ -27,6 +28,7 @@ ## Table of Contents
- [License](#-license) - [License](#-license)
## 🚀 Getting Started ## 🚀 Getting Started
### 🔥 Installing ### 🔥 Installing
Install the package through [Composer](http://getcomposer.org/). Install the package through [Composer](http://getcomposer.org/).
@@ -107,7 +109,6 @@ #### Round Mode
'round_mode' => env('LARAVEL_CART_ROUND_MODE', 'down'), 'round_mode' => env('LARAVEL_CART_ROUND_MODE', 'down'),
``` ```
### Basic Usage ### Basic Usage
The cart has a default sessionKey that holds the cart data and stores it in the session, so you can have multiple carts for multiple users. The cart has a default sessionKey that holds the cart data and stores it in the session, so you can have multiple carts for multiple users.
@@ -168,8 +169,8 @@ #### Adding to the cart: **Cart::add()**
[], // attributes [], // attributes
[ [
[ [
'name' => '10% Off', 'name' => '10% Off',
'type' => 'discount', 'type' => 'discount',
'value' => '-10%' 'value' => '-10%'
] ]
] // conditions ] // conditions
@@ -199,7 +200,7 @@ #### Updating an item on a cart: **Cart::update()**
```php ```php
Cart::update( Cart::update(
456, # product id 456, # product id
[ [
'name' => 'New Item Name', // new item name 'name' => 'New Item Name', // new item name
'price' => 98.67, // new item price as a float or string 'price' => 98.67, // new item price as a float or string
] ]
@@ -215,7 +216,7 @@ #### Updating an item on a cart: **Cart::update()**
// reducing it... // reducing it...
Cart::update( Cart::update(
456, 456,
[ [
'quantity' => -1, // so if from 4 to 3 'quantity' => -1, // so if from 4 to 3
] ]
@@ -841,4 +842,4 @@ ## 🫡 Credits
## 📓 License ## 📓 License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
+3 -7
View File
@@ -1,15 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd">
bootstrap="vendor/autoload.php" <source ignoreIndirectDeprecations="true">
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
>
<source>
<include> <include>
<directory suffix=".php">./src</directory> <directory suffix=".php">./src</directory>
</include> </include>
</source> </source>
<testsuites> <testsuites>
<testsuite name="Laravel Cart Test Suite"> <testsuite name="Laravel Cart Test Suite">
<directory>tests</directory> <directory>tests</directory>
</testsuite> </testsuite>
+14
View File
@@ -0,0 +1,14 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
// Suppress PHP 8.4 deprecation notices that originate from vendor code.
// These are typically from third-party packages (e.g. Mockery) that have not
// yet updated implicit-nullable parameter signatures and are not actionable here.
set_error_handler(static function (int $errno, string $errstr, string $errfile): bool {
if ($errno === E_DEPRECATED && str_contains($errfile, DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR)) {
return true;
}
return false;
}, E_DEPRECATED);