From fbb3fa92f03d620706aab03f0c6a4c029196e93b Mon Sep 17 00:00:00 2001 From: Daniele Rosario Date: Mon, 3 Jun 2024 14:41:24 +0200 Subject: [PATCH 1/6] wip --- .phpunit.cache/test-results | 2 +- UPGRADE.md | 8 +++ composer.json | 11 ++-- phpunit.xml.dist | 17 +++---- rector.php | 19 +++++++ tests/Cart/CartTest.php | 86 +++++++++++--------------------- tests/Cart/MultipleCartsTest.php | 4 +- tests/Customer/CustomerTest.php | 12 ++--- tests/Order/OrderTest.php | 12 ++--- tests/Tax/TaxTest.php | 10 ++-- 10 files changed, 83 insertions(+), 98 deletions(-) create mode 100644 UPGRADE.md create mode 100644 rector.php diff --git a/.phpunit.cache/test-results b/.phpunit.cache/test-results index bb43fd8..d127276 100644 --- a/.phpunit.cache/test-results +++ b/.phpunit.cache/test-results @@ -1 +1 @@ -{"version":1,"defects":[],"times":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_manager_from_config":0.1,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_load_facade":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":0.164,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":0.022,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":0.209,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":0.143,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":0.164,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":0.019,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":0.148,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":0.047,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":0.015,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":0.069,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":0.122,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":0.022,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":0.05,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":0.016,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":0.015,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":0.041,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":0.015,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":0.012,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":0.067,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":0.022,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":0.064,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":0.155,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":0.019,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":0.042,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_resolver":0.013,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_manager":0.01,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product":0.032,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_private_customer":0.01,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":0.01}} \ No newline at end of file +{"version":1,"defects":[],"times":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_manager_from_config":0.032,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_load_facade":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":0.027,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":0.021,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":0.025,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":0.042,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":0.009,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":0.011,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":0.01,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":0.012,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":0.015,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":0.013,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":0.012,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_resolver":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_manager":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product":0.01,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_private_customer":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":0.007}} \ No newline at end of file diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..2dccde0 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,8 @@ +# UPGRADE + +## 3.x to 4.x + +- Dropped support for laravel < 10 +- Upgraded to latest version of dependencies (ie: Laravel Money, etc) +- Dropped Spatie Data Transfer in favor of +- Dropped PHPunit < 10 diff --git a/composer.json b/composer.json index 5e9abb8..a71d328 100644 --- a/composer.json +++ b/composer.json @@ -23,12 +23,12 @@ "require": { "php": "^8.1", "ext-json": "*", - "cknow/laravel-money": "^6.2 || ^7.1", - "commerceguys/addressing": "^1.0", + "cknow/laravel-money": "^6.2 || ^7.1 || ^v8.1", + "commerceguys/addressing": "^1.4", "commerceguys/tax": "^0.8", "florianv/laravel-swap": "^2.3", "iben12/laravel-statable": "^1.4", - "illuminate/database": "^9.0 || ^10.0", + "illuminate/database": "^10.0 || ^11.0", "mpociot/vat-calculator": "^3.0", "nyholm/psr7": "^1.3", "php-http/curl-client": "^2.1", @@ -37,8 +37,9 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.7", - "orchestra/testbench": "^7.1 || ^8.0", - "phpunit/phpunit": "^9.1 || ^10.0" + "orchestra/testbench": "^8.0 || ^9.1", + "phpunit/phpunit": "^10.0 || ^11.1", + "rector/rector": "^1.1" }, "autoload": { "files": [ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 64e9724..fd65970 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,5 @@ - - - - src/ - - - - - - - + tests @@ -18,4 +8,9 @@ + + + src/ + + diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..9e6f949 --- /dev/null +++ b/rector.php @@ -0,0 +1,19 @@ +withPaths([ + __DIR__ . '/config', + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + // uncomment to reach your current PHP version + // ->withPhpSets() + ->withSets([ + PHPUnitSetList::PHPUNIT_100 + ]); diff --git a/tests/Cart/CartTest.php b/tests/Cart/CartTest.php index d0f9f9c..7f83627 100644 --- a/tests/Cart/CartTest.php +++ b/tests/Cart/CartTest.php @@ -24,22 +24,20 @@ class CartTest extends TestCase { - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_get_cart_manager_from_config() { $this->assertInstanceOf(CartManager::class, app('ecommerce.cart')); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_load_facade() { $this->assertInstanceOf(CartManager::class, \Weble\LaravelEcommerce\Facades\Cart::getFacadeRoot()); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_get_cart_instances($driver, $expectedStorage) { $this->setCartStorageDriver($driver); @@ -61,9 +59,7 @@ public function can_get_cart_instances($driver, $expectedStorage) $this->assertEquals('wishlist', $wishlist->instanceName()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function can_generate_cart_items_ids_consistently() { $product = ProductFactory::new(['price' => money(100)])->create(); @@ -78,10 +74,8 @@ public function can_generate_cart_items_ids_consistently() $this->assertEquals($cartItem->toArray(), $restoredCartitem->toArray()); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_add_to_cart($driver) { $this->setCartStorageDriver($driver); @@ -99,10 +93,8 @@ public function can_add_to_cart($driver) $this->assertEquals($cartItem, $retrievedCartItem); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_check_if_item_is_in_cart($driver) { $this->setCartStorageDriver($driver); @@ -116,10 +108,8 @@ public function can_check_if_item_is_in_cart($driver) $this->assertTrue($cart->has($cartItem->getId())); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_remove_from_cart($driver) { $this->setCartStorageDriver($driver); @@ -136,10 +126,8 @@ public function can_remove_from_cart($driver) $this->assertEquals(1, $cart->items()->total()); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_total($driver) { $this->setCartStorageDriver($driver); @@ -155,10 +143,8 @@ public function can_calculate_total($driver) $this->assertTrue($cart->subTotal()->equals(money(400)), $cart->subTotal()); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_tax($driver) { $this->setCartStorageDriver($driver); @@ -176,10 +162,8 @@ public function can_calculate_tax($driver) $this->assertTrue($cart->total()->equals(money(488))); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_item_discounts($driver) { $this->setCartStorageDriver($driver); @@ -199,10 +183,8 @@ public function can_calculate_item_discounts($driver) $this->assertTrue($cart->subTotal()->equals(money(180)), $cart->subTotal()); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_subtotal_discounts($driver) { $this->setCartStorageDriver($driver); @@ -223,10 +205,8 @@ public function can_calculate_subtotal_discounts($driver) $this->assertTrue($cart->subTotal()->equals(money(190))); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_items_discounts($driver) { $this->setCartStorageDriver($driver); @@ -247,10 +227,8 @@ public function can_calculate_items_discounts($driver) $this->assertTrue($cart->subTotal()->equals(money(140))); } - /** - * @test - * @dataProvider driversProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('driversProvider')] + #[\PHPUnit\Framework\Attributes\Test] public function can_attach_customer_to_cart($driver) { $this->setCartStorageDriver($driver); @@ -284,9 +262,7 @@ protected function setCartStorageDriver($driver): void config()->set('ecommerce.cart.instances.cart.storage', $driver); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function can_add_to_cart_storing_in_db() { $this->setCartStorageDriver('eloquent'); @@ -309,9 +285,7 @@ public function can_add_to_cart_storing_in_db() $this->assertEquals(0, CartItemModel::query()->count()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function user_add_to_cart_storing_in_db() { $this->setCartStorageDriver('eloquent'); @@ -338,9 +312,7 @@ public function user_add_to_cart_storing_in_db() $this->assertEquals(0, CartItemModel::query()->count()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function cart_stored_storing_in_db_for_different_users() { $this->setCartStorageDriver('eloquent'); @@ -387,9 +359,7 @@ public function cart_stored_storing_in_db_for_different_users() $this->assertEquals(0, CartItemModel::query()->where('user_id', '=', $otherUser->id)->count()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function can_add_discount_to_cart_storing_in_db() { $this->setCartStorageDriver('eloquent'); @@ -418,7 +388,7 @@ public function can_add_discount_to_cart_storing_in_db() $this->assertEquals(0, $options->diff($storedDiscount->discount_attributes)->count()); } - public function driversProvider() + public static function driversProvider() { return [ 'session' => [ diff --git a/tests/Cart/MultipleCartsTest.php b/tests/Cart/MultipleCartsTest.php index b8c7770..84f6920 100644 --- a/tests/Cart/MultipleCartsTest.php +++ b/tests/Cart/MultipleCartsTest.php @@ -12,9 +12,7 @@ class MultipleCartsTest extends TestCase { - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function stores_different_carts_in_db() { config()->set('ecommerce.cart.instances.cart.storage', 'eloquent'); diff --git a/tests/Customer/CustomerTest.php b/tests/Customer/CustomerTest.php index 2bb8fac..90a168e 100644 --- a/tests/Customer/CustomerTest.php +++ b/tests/Customer/CustomerTest.php @@ -16,9 +16,7 @@ class CustomerTest extends TestCase { use WithFaker; - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function can_add_to_cart_storing_in_db() { config()->set('ecommerce.cart.instances.cart.storage', 'eloquent'); @@ -46,9 +44,7 @@ public function can_add_to_cart_storing_in_db() $this->assertEquals($surname, $storedCustomer->billing_address->surname); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function can_add_to_cart_for_user_storing_in_db() { config()->set('ecommerce.cart.instances.cart.storage', 'eloquent'); @@ -68,9 +64,7 @@ public function can_add_to_cart_for_user_storing_in_db() $this->assertEquals($user->getKey(), $storedCustomer->user_id); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function can_add_to_cart_for_user_storing_in_db_multiple_times() { config()->set('ecommerce.cart.instances.cart.storage', 'eloquent'); diff --git a/tests/Order/OrderTest.php b/tests/Order/OrderTest.php index d3da346..e575a3e 100644 --- a/tests/Order/OrderTest.php +++ b/tests/Order/OrderTest.php @@ -16,7 +16,7 @@ class OrderTest extends TestCase { - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_create_order_from_cart() { $product = ProductFactory::new(['price' => money(100)])->create(); @@ -36,7 +36,7 @@ public function can_create_order_from_cart() $this->assertEquals($product->getKey(), $order->items->first()->product->getKey()); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function order_has_unique_hash() { $product = ProductFactory::new()->create(['price' => money(100)]); @@ -53,7 +53,7 @@ public function order_has_unique_hash() $this->assertEquals(1, Order::whereHash($order->hash)->count()); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function order_items_are_stored_correctly() { $product = ProductFactory::new()->create(['price' => money(100)]); @@ -82,7 +82,7 @@ public function order_items_are_stored_correctly() $this->assertDatabaseCount('order_items', 2); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function uses_state_machine_to_manage_order() { $product = ProductFactory::new()->create(['price' => money(100)]); @@ -102,7 +102,7 @@ public function uses_state_machine_to_manage_order() $this->assertEquals(OrderState::Payed->value(), $order->stateIs()); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function order_history_is_stored_correctly() { $product = ProductFactory::new()->create(['price' => money(100)]); @@ -129,7 +129,7 @@ public function order_history_is_stored_correctly() $this->assertDatabaseCount('ecommerce_state_history', 2); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function order_creates_payment() { $product = ProductFactory::new()->create(['price' => money(100)]); diff --git a/tests/Tax/TaxTest.php b/tests/Tax/TaxTest.php index 5bd426d..d4d3de6 100644 --- a/tests/Tax/TaxTest.php +++ b/tests/Tax/TaxTest.php @@ -15,19 +15,19 @@ class TaxTest extends TestCase { - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_get_tax_resolver() { $this->assertInstanceOf(TaxResolverInterface::class, app('ecommerce.tax.resolver')); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_get_tax_manager() { $this->assertInstanceOf(TaxManager::class, app('ecommerce.tax')); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_tax_for_physical_product() { // This has IT stadard rate type (22%) and it's a physical product @@ -51,7 +51,7 @@ public function can_calculate_tax_for_physical_product() $this->assertTrue(money(22, $tax->getCurrency())->equals($tax),); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_tax_for_physical_product_with_different_country_eu_private_customer() { // Disable vat vies check in test @@ -71,7 +71,7 @@ public function can_calculate_tax_for_physical_product_with_different_country_eu $this->assertTrue((new Money(98, new Currency($product->cartPrice()->getCurrency())))->equals($tax)); } - /** @test */ + #[\PHPUnit\Framework\Attributes\Test] public function can_calculate_tax_for_physical_product_with_different_country_eu_company() { // Disable vat vies check in test From 25dd9329da3ffca45e59ca239dc8723986a1391b Mon Sep 17 00:00:00 2001 From: Daniele Rosario Date: Mon, 3 Jun 2024 15:13:16 +0200 Subject: [PATCH 2/6] wip --- .phpunit.cache/test-results | 2 +- src/Address/Address.php | 40 ++++++--------- src/Cart/CartItem.php | 39 +++++++-------- src/Cart/CartItemModel.php | 18 +++---- src/Cart/Concern/InteractsWithStorage.php | 20 ++++---- src/Customer/Customer.php | 46 ++++++----------- src/Customer/CustomerModel.php | 41 ++++++++-------- src/Discount/Discount.php | 50 ++++++++----------- src/Discount/DiscountModel.php | 17 +++---- src/Order/Order.php | 3 +- src/Payment/Payment.php | 3 +- src/Storage/StoresEcommerceData.php | 4 +- src/Support/DTOCast.php | 30 ------------ tests/Cart/CartTest.php | 60 +++++++++++------------ tests/Customer/CustomerTest.php | 40 +++++++-------- tests/Tax/TaxTest.php | 10 ++-- tests/TestCase.php | 5 ++ 17 files changed, 182 insertions(+), 246 deletions(-) delete mode 100644 src/Support/DTOCast.php diff --git a/.phpunit.cache/test-results b/.phpunit.cache/test-results index d127276..7dac1d9 100644 --- a/.phpunit.cache/test-results +++ b/.phpunit.cache/test-results @@ -1 +1 @@ -{"version":1,"defects":[],"times":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_manager_from_config":0.032,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_load_facade":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":0.027,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":0.021,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":0.025,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":0.042,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":0.009,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":0.011,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":0.01,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":0.012,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":0.015,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":0.013,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":0.012,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_resolver":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_manager":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product":0.01,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_private_customer":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":0.007}} \ No newline at end of file +{"version":1,"defects":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":8,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":8},"times":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_manager_from_config":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_load_facade":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":0.02,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":0.009,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":0.014,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":0.011,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":0.013,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":0.018,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":0.015,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":0.014,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_resolver":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_manager":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product":0.009,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_private_customer":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":0.007}} \ No newline at end of file diff --git a/src/Address/Address.php b/src/Address/Address.php index c41726e..2db2474 100644 --- a/src/Address/Address.php +++ b/src/Address/Address.php @@ -6,35 +6,25 @@ use CommerceGuys\Addressing\Country\Country; use CommerceGuys\Addressing\Country\CountryRepositoryInterface; use Illuminate\Http\Request; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; -class Address extends DataTransferObject implements AddressInterface +class Address extends Data implements AddressInterface { - public string $name = ''; - public string $surname = ''; - public string $company = ''; - public string $vatId = ''; - public string $personalId = ''; - public string $country; - public string $street = ''; - public string $zip = ''; - public string $state = ''; - public string $city = ''; - public AddressType $type; - - public function __construct(array $parameters = []) + public function __construct( + public string $name = '', + public string $surname = '', + public string $company = '', + public string $vatId = '', + public string $personalId = '', + public string $country = 'IT', + public string $street = '', + public string $zip = '', + public string $state = '', + public string $city = '', + public AddressType $type = AddressType::Shipping, + ) { - $parameters['country'] ??= config('ecommerce.store.address.country', 'IT'); - - $type = $parameters['type'] ?? AddressType::Shipping; - - if (! $type instanceof AddressType) { - $type = AddressType::from($type); - } - - $parameters['type'] = $type; - parent::__construct($parameters); } public function country(): Country diff --git a/src/Cart/CartItem.php b/src/Cart/CartItem.php index 84afcce..168649d 100644 --- a/src/Cart/CartItem.php +++ b/src/Cart/CartItem.php @@ -4,24 +4,27 @@ use Cknow\Money\Money; use CommerceGuys\Addressing\AddressInterface; -use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Contracts\Support\Jsonable; + use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Support\Collection; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; use Weble\LaravelEcommerce\Discount\Discount; use Weble\LaravelEcommerce\Discount\DiscountCollection; use Weble\LaravelEcommerce\Discount\DiscountTarget; use Weble\LaravelEcommerce\Discount\InvalidDiscountException; use Weble\LaravelEcommerce\Purchasable; -class CartItem extends DataTransferObject implements Arrayable, Jsonable +class CartItem extends Data { - public Purchasable $product; - public float $quantity = 1; - public Money $price; - public Collection $attributes; - public DiscountCollection $discounts; + public function __construct( + public Purchasable $product, + public Money $price, + public Collection $attributes, + public DiscountCollection $discounts, + public float $quantity = 1, + ) + { + } public function withDiscount(Discount $discount): self { @@ -41,10 +44,6 @@ public function clearDiscounts(): self return $this; } - public function toJson($options = 0): string - { - return json_encode($this->toArray(), $options); - } public static function fromPurchasable(Purchasable $purchasable, float $quantity = 1, ?Collection $attributes = null, ?Money $price = null): self { @@ -54,13 +53,13 @@ public static function fromPurchasable(Purchasable $purchasable, float $quantity $price ??= $purchasable->cartPrice($attributes); - return new static([ - 'product' => $purchasable, - 'attributes' => $attributes, - 'quantity' => $quantity, - 'price' => $price, - 'discounts' => DiscountCollection::make([]), - ]); + return new static( + product: $purchasable, + price: $price, + attributes: $attributes, + discounts: DiscountCollection::make([]), + quantity: $quantity, + ); } public function getId(): string diff --git a/src/Cart/CartItemModel.php b/src/Cart/CartItemModel.php index 7bd817c..1135ba1 100644 --- a/src/Cart/CartItemModel.php +++ b/src/Cart/CartItemModel.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Support\Collection; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; use Weble\LaravelEcommerce\Discount\Discount; use Weble\LaravelEcommerce\Discount\DiscountCollection; use Weble\LaravelEcommerce\Purchasable; @@ -71,15 +71,15 @@ public function getDiscountsAttribute($discounts): DiscountCollection })); } - public function toCartValue(): DataTransferObject + public function toCartValue(): Data { - return new CartItem([ - 'price' => $this->price, - 'attributes' => $this->product_attributes, - 'discounts' => DiscountCollection::make($this->discounts), - 'product' => $this->product, - 'quantity' => $this->quantity, - ]); + return new CartItem( + product: $this->product, + price: $this->price, + attributes: $this->product_attributes, + discounts: DiscountCollection::make($this->discounts), + quantity: $this->quantity, + ); } /** diff --git a/src/Cart/Concern/InteractsWithStorage.php b/src/Cart/Concern/InteractsWithStorage.php index 0bdaafe..de47e79 100644 --- a/src/Cart/Concern/InteractsWithStorage.php +++ b/src/Cart/Concern/InteractsWithStorage.php @@ -39,7 +39,7 @@ protected function loadItemsFromStorage(): void { $this->items = CartItemCollection::make( $this->storage()->get(StorageType::Items->value, []) - )->keyBy(fn (CartItem $item) => $item->getId()); + )->keyBy(fn(CartItem $item) => $item->getId()); } protected function loadDiscountsFromStorage(): void @@ -56,15 +56,15 @@ protected function loadCustomerFromStorage(): void { $this->customer = $this->storage()->get( StorageType::Customer->value, - new Customer([ - 'id' => (string) Str::orderedUuid(), - 'shippingAddress' => new Address([ - 'type' => AddressType::Shipping, - ]), - 'billingAddress' => new Address([ - 'type' => AddressType::Billing, - ]), - ]) + new Customer( + id: (string)Str::orderedUuid(), + billingAddress: new Address( + type: AddressType::Billing, + ), + shippingAddress: new Address( + type: AddressType::Shipping, + ), + ) ); } } diff --git a/src/Customer/Customer.php b/src/Customer/Customer.php index a03c2c0..97b153a 100644 --- a/src/Customer/Customer.php +++ b/src/Customer/Customer.php @@ -3,41 +3,32 @@ namespace Weble\LaravelEcommerce\Customer; use CommerceGuys\Addressing\AddressInterface; -use Illuminate\Contracts\Support\Jsonable; use Illuminate\Support\Str; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; use Weble\LaravelEcommerce\Address\Address; use Weble\LaravelEcommerce\Address\AddressType; use Weble\LaravelEcommerce\Address\StoreAddress; -class Customer extends DataTransferObject implements Jsonable +class Customer extends Data { - public string $id; - public $user = null; - public ?string $email; - public ?Address $billingAddress; - public ?Address $shippingAddress; - - public function __construct(array $parameters = []) + public function __construct( + public ?string $id = null, + public $user = null, + public ?string $email = null, + public ?Address $billingAddress = null, + public ?Address $shippingAddress = null, + ) { - if (isset($parameters['billingAddress']) && is_array($parameters['billingAddress'])) { - $parameters['billingAddress'] = new Address($parameters['billingAddress']); - } - - if (isset($parameters['shippingAddress']) && is_array($parameters['shippingAddress'])) { - $parameters['shippingAddress'] = new Address($parameters['shippingAddress']); - } - $parameters['billingAddress'] ??= new Address([ - 'type' => AddressType::Billing, - ]); - $parameters['shippingAddress'] ??= new Address([ - 'type' => AddressType::Shipping, - ]); + $this->billingAddress ??= new Address( + type: AddressType::Billing, + ); - $parameters['id'] ??= sha1((string)Str::orderedUuid()); + $this->shippingAddress ??= new Address( + type: AddressType::Shipping, + ); - parent::__construct($parameters); + $this->id ??= sha1((string)Str::orderedUuid()); } public function getId(): string @@ -59,9 +50,4 @@ public function taxAddress(): AddressInterface return new StoreAddress(); } - - public function toJson($options = 0): string - { - return json_encode($this->toArray(), $options); - } } diff --git a/src/Customer/CustomerModel.php b/src/Customer/CustomerModel.php index 210518e..fa6db5b 100644 --- a/src/Customer/CustomerModel.php +++ b/src/Customer/CustomerModel.php @@ -6,10 +6,9 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; use Weble\LaravelEcommerce\Address\Address; use Weble\LaravelEcommerce\Storage\StoresEcommerceData; -use Weble\LaravelEcommerce\Support\DTOCast; /** * @property string $id @@ -21,12 +20,12 @@ class CustomerModel extends Model implements StoresEcommerceData { protected $guarded = []; - protected $keyType = 'string'; + protected $keyType = 'string'; public $incrementing = false; protected $casts = [ - 'billing_address' => DTOCast::class . ':' . Address::class, - 'shipping_address' => DTOCast::class . ':' . Address::class, + 'billing_address' => Address::class, + 'shipping_address' => Address::class, ]; public function __construct(array $attributes = []) @@ -41,16 +40,16 @@ public function user(): BelongsTo $this->belongsTo(config('ecommerce.classes.user', '\\App\\Models\\User')); } - public function toCartValue(): DataTransferObject + public function toCartValue(): Data { $userModel = config('ecommerce.classes.user', '\\App\\Models\\User'); - return new Customer([ - 'id' => $this->getKey(), - 'user' => $this->user_id ? $userModel::find($this->user_id) : null, - 'shippingAddress' => $this->shipping_address, - 'billingAddress' => $this->billing_address, - ]); + return new Customer( + id: $this->getKey(), + user: $this->user_id ? $userModel::find($this->user_id) : null, + billingAddress: $this->billing_address, + shippingAddress: $this->shipping_address, + ); } /** @@ -84,18 +83,18 @@ private function loadOrCreateFromCustomerId(Customer $customer): self ->where($this->getKeyName(), '=', $customer->getId()) ->firstOrFail() ->fill([ - 'session_id' => session()->getId(), - 'user_id' => $customer->user ? $customer->user->getKey() : null, - 'shipping_address' => $customer->shippingAddress, - 'billing_address' => $customer->billingAddress, + 'session_id' => session()->getId(), + 'user_id' => $customer->user ? $customer->user->getKey() : null, + 'shipping_address' => $customer->shippingAddress, + 'billing_address' => $customer->billingAddress, ]); } catch (ModelNotFoundException $e) { return (new self([ - 'id' => $customer->getId(), - 'session_id' => session()->getId(), - 'user_id' => $customer->user ? $customer->user->getKey() : null, - 'shipping_address' => $customer->shippingAddress, - 'billing_address' => $customer->billingAddress, + 'id' => $customer->getId(), + 'session_id' => session()->getId(), + 'user_id' => $customer->user ? $customer->user->getKey() : null, + 'shipping_address' => $customer->shippingAddress, + 'billing_address' => $customer->billingAddress, ])); } } diff --git a/src/Discount/Discount.php b/src/Discount/Discount.php index d224a38..7f5c3d3 100644 --- a/src/Discount/Discount.php +++ b/src/Discount/Discount.php @@ -3,33 +3,28 @@ namespace Weble\LaravelEcommerce\Discount; use Cknow\Money\Money; -use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Contracts\Support\Jsonable; use Illuminate\Support\Collection; use Illuminate\Support\Str; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; -class Discount extends DataTransferObject implements Arrayable, Jsonable +class Discount extends Data { - public string $id; - /** @var \Cknow\Money\Money|\Money\Money|float|int */ - public $value; - public DiscountTarget $target; - public DiscountType $type; - public Collection $attributes; - - public function __construct(array $parameters = []) + public function __construct( + public Money|int $value, + public ?string $id = null, + public DiscountTarget $target = DiscountTarget::Items, + public DiscountType $type = DiscountType::Percentage, + public ?Collection $attributes = null, + ) { - $parameters['id'] ??= sha1((string)Str::orderedUuid()); - $parameters['attributes'] ??= Collection::make([]); - - parent::__construct($parameters); + $this->id ??= sha1((string)Str::orderedUuid()); + $this->attributes ??= Collection::make([]); } public function calculateValue(Money $price): Money { if ($this->type === DiscountType::Percentage) { - return $price->multiply((string) ($this->value / 100)); + return $price->multiply((string)($this->value / 100)); } return $this->value; @@ -40,22 +35,17 @@ public function target(): DiscountTarget return $this->target; } - public function toJson($options = 0): string - { - return json_encode($this->toArray(), $options); - } - public static function fromArray(array $discount): self { $type = DiscountType::tryFrom($discount['type']); - return new Discount([ - 'type' => $type, - 'target' => DiscountTarget::tryFrom($discount['target']), - 'value' => $type === DiscountType::Value - ? new Money($discount['value']['amount'] ?? 0, $discount['value']['currency'] ?? 'USD') - : (float)$discount['value'], - 'attributes' => collect($discount['attributes'] ?? []), - ]); + return new Discount( + value: $type === DiscountType::Value + ? new Money($discount['value']['amount'] ?? 0, $discount['value']['currency'] ?? 'USD') + : (float)$discount['value'], + target: DiscountTarget::tryFrom($discount['target']), + type: $type, + attributes: collect($discount['attributes'] ?? []), + ); } } diff --git a/src/Discount/DiscountModel.php b/src/Discount/DiscountModel.php index 9092ff7..7e683d0 100644 --- a/src/Discount/DiscountModel.php +++ b/src/Discount/DiscountModel.php @@ -8,11 +8,10 @@ use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Support\Collection; use Money\Currency; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; use Weble\LaravelEcommerce\Storage\StoresDifferentInstances; use Weble\LaravelEcommerce\Storage\StoresEcommerceData; use Weble\LaravelEcommerce\Support\CurrencyCast; -use Weble\LaravelEcommerce\Support\DTOCast; /** * @property DiscountType $type @@ -49,14 +48,14 @@ public function getValueAttribute($value) return $value; } - public function toCartValue(): DataTransferObject + public function toCartValue(): Data { - return new Discount([ - 'type' => $this->type, - 'target' => $this->target, - 'value' => $this->value, - 'attributes' => $this->discount_attributes, - ]); + return new Discount( + type: $this->type, + target: $this->target, + value: $this->value, + attributes: $this->discount_attributes, + ); } /** diff --git a/src/Order/Order.php b/src/Order/Order.php index cfc3c4f..b3ca295 100644 --- a/src/Order/Order.php +++ b/src/Order/Order.php @@ -11,7 +11,6 @@ use Weble\LaravelEcommerce\Customer\Customer; use Weble\LaravelEcommerce\Order\Concern\Payable; use Weble\LaravelEcommerce\Support\CurrencyCast; -use Weble\LaravelEcommerce\Support\DTOCast; use Weble\LaravelEcommerce\Support\InteractsWithStateMachine; class Order extends Model @@ -21,7 +20,7 @@ class Order extends Model protected $guarded = []; protected $casts = [ - 'customer' => DTOCast::class . ':' . Customer::class, + 'customer' => Customer::class, 'currency' => CurrencyCast::class, 'discounts' => 'collection', 'discounts_subtotal' => MoneyIntegerCast::class . ':currency', diff --git a/src/Payment/Payment.php b/src/Payment/Payment.php index 7e7c853..f24efd0 100644 --- a/src/Payment/Payment.php +++ b/src/Payment/Payment.php @@ -8,7 +8,6 @@ use Weble\LaravelEcommerce\Customer\Customer; use Weble\LaravelEcommerce\Order\Order; use Weble\LaravelEcommerce\Support\CurrencyCast; -use Weble\LaravelEcommerce\Support\DTOCast; use Weble\LaravelEcommerce\Support\InteractsWithStateMachine; class Payment extends Model @@ -18,7 +17,7 @@ class Payment extends Model protected $guarded = []; protected $casts = [ - 'customer' => DTOCast::class . ':' . Customer::class, + 'customer' => Customer::class, 'currency' => CurrencyCast::class, 'discounts' => 'collection', 'discounts_subtotal' => MoneyIntegerCast::class . ':currency', diff --git a/src/Storage/StoresEcommerceData.php b/src/Storage/StoresEcommerceData.php index 62806a9..d70ca5c 100644 --- a/src/Storage/StoresEcommerceData.php +++ b/src/Storage/StoresEcommerceData.php @@ -3,7 +3,7 @@ namespace Weble\LaravelEcommerce\Storage; use Illuminate\Database\Eloquent\Builder; -use Spatie\DataTransferObject\DataTransferObject; +use Spatie\LaravelData\Data; /** * @method Builder forCurrentUser() @@ -15,5 +15,5 @@ public function scopeForCurrentUser(Builder $query): Builder; public function fromCartValue($value, string $key, string $instanceName): self; - public function toCartValue(): DataTransferObject; + public function toCartValue(): Data; } diff --git a/src/Support/DTOCast.php b/src/Support/DTOCast.php deleted file mode 100644 index 1af0923..0000000 --- a/src/Support/DTOCast.php +++ /dev/null @@ -1,30 +0,0 @@ -class = $class; - } - - public function get($model, string $key, $value, array $attributes) - { - return (new $this->class(json_decode($value, true))); - } - - public function set($model, string $key, $value, array $attributes) - { - if ($value instanceof Jsonable) { - return $value->toJson(); - } - - return json_encode($value); - } -} diff --git a/tests/Cart/CartTest.php b/tests/Cart/CartTest.php index 7f83627..857b1d8 100644 --- a/tests/Cart/CartTest.php +++ b/tests/Cart/CartTest.php @@ -173,11 +173,11 @@ public function can_calculate_item_discounts($driver) /** @var Cart $cart */ $cart = app('ecommerce.cart'); - $cartItem = $cart->add($product, 2)->withDiscount(new Discount([ - 'value' => money(10), - 'type' => DiscountType::Value, - 'target' => DiscountTarget::Item, - ])); + $cartItem = $cart->add($product, 2)->withDiscount(new Discount( + value: money(10), + target: DiscountTarget::Item, + type: DiscountType::Value, + )); $cart->update($cartItem); $this->assertTrue($cart->subTotal()->equals(money(180)), $cart->subTotal()); @@ -196,11 +196,11 @@ public function can_calculate_subtotal_discounts($driver) $cart = app('ecommerce.cart'); $cart->add($product, 2); - $cart->withDiscount(new Discount([ - 'value' => money(10), - 'type' => DiscountType::Value, - 'target' => DiscountTarget::Subtotal, - ])); + $cart->withDiscount(new Discount( + value: money(10), + target: DiscountTarget::Subtotal, + type: DiscountType::Value, + )); $this->assertTrue($cart->subTotal()->equals(money(190))); } @@ -218,11 +218,11 @@ public function can_calculate_items_discounts($driver) $cart = app('ecommerce.cart'); $cart->add($product, 2); - $cart->withDiscount(new Discount([ - 'type' => DiscountType::Value, - 'value' => money(60), - 'target' => DiscountTarget::Items, - ])); + $cart->withDiscount(new Discount( + value: money(60), + target: DiscountTarget::Items, + type: DiscountType::Value, + )); $this->assertTrue($cart->subTotal()->equals(money(140))); } @@ -242,15 +242,15 @@ public function can_attach_customer_to_cart($driver) $this->assertTrue(! $cart->tax()->isZero()); - $customer = new Customer([]); - $customer->billingAddress = new Address([ - 'country' => 'IT', - 'state' => 'VI', - ]); - $customer->shippingAddress = new Address([ - 'country' => 'US', - 'state' => 'NY', - ]); + $customer = new Customer(); + $customer->billingAddress = new Address( + country: 'IT', + state : 'VI', + ); + $customer->shippingAddress = new Address( + country: 'US', + state : 'NY', + ); $cart->forCustomer($customer); @@ -371,12 +371,12 @@ public function can_add_discount_to_cart_storing_in_db() /** @var Cart $cart */ $cart = app('ecommerce.cart'); $cartItem = $cart->add($product, 2); - $cart->withDiscount(new Discount([ - 'value' => $value, - 'target' => DiscountTarget::Items, - 'type' => DiscountType::Value, - 'attributes' => $options, - ])); + $cart->withDiscount(new Discount( + value: $value, + target: DiscountTarget::Items, + type: DiscountType::Value, + attributes: $options, + )); $this->assertEquals(1, DiscountModel::query()->count()); diff --git a/tests/Customer/CustomerTest.php b/tests/Customer/CustomerTest.php index 90a168e..8e458eb 100644 --- a/tests/Customer/CustomerTest.php +++ b/tests/Customer/CustomerTest.php @@ -25,13 +25,13 @@ public function can_add_to_cart_storing_in_db() $surname = $this->faker->lastName; - $customer = new Customer([ - 'billingAddress' => new Address([ - 'type' => AddressType::Billing, - 'name' => $name, - 'surname' => $surname, - ]), - ]); + $customer = new Customer( + billingAddress: new Address( + name: $name, + surname: $surname, + type: AddressType::Billing, + ), + ); /** @var Cart $cart */ $cart = app('ecommerce.cart'); @@ -49,10 +49,10 @@ public function can_add_to_cart_for_user_storing_in_db() { config()->set('ecommerce.cart.instances.cart.storage', 'eloquent'); - $user = UserFactory::new()->create(); - $customer = new Customer([ - 'user' => $user, - ]); + $user = UserFactory::new()->create(); + $customer = new Customer( + user: $user, + ); /** @var Cart $cart */ $cart = app('ecommerce.cart'); @@ -69,10 +69,10 @@ public function can_add_to_cart_for_user_storing_in_db_multiple_times() { config()->set('ecommerce.cart.instances.cart.storage', 'eloquent'); - $user = UserFactory::new()->create(); - $customer = new Customer([ - 'user' => $user, - ]); + $user = UserFactory::new()->create(); + $customer = new Customer( + user: $user, + ); /** @var Cart $cart */ $cart = app('ecommerce.cart'); @@ -87,11 +87,11 @@ public function can_add_to_cart_for_user_storing_in_db_multiple_times() $surname = $this->faker->lastName; /** @var Cart $cart */ - $customer->billingAddress = new Address([ - 'type' => AddressType::Billing, - 'name' => $name, - 'surname' => $surname, - ]); + $customer->billingAddress = new Address( + type: AddressType::Billing, + name: $name, + surname: $surname, + ); $cart->forCustomer($customer); // Should be the same as before diff --git a/tests/Tax/TaxTest.php b/tests/Tax/TaxTest.php index d4d3de6..357ec06 100644 --- a/tests/Tax/TaxTest.php +++ b/tests/Tax/TaxTest.php @@ -82,11 +82,11 @@ public function can_calculate_tax_for_physical_product_with_different_country_eu 'price' => money(100), ]); - $customerAddress = (new \Weble\LaravelEcommerce\Address\Address([ - 'company' => 'YOOtheme Gmbh', - 'country' => 'DE', - 'vatId' => 'DEVFCLQFW054', - ])); + $customerAddress = new \Weble\LaravelEcommerce\Address\Address( + company: 'YOOtheme Gmbh', + vatId: 'DEVFCLQFW054', + country: 'DE', + ); $tax = \taxManager()->taxFor($product, $product->cartPrice(), $customerAddress); diff --git a/tests/TestCase.php b/tests/TestCase.php index 861c17d..cec0846 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,6 +5,8 @@ use Cknow\Money\MoneyServiceProvider; use Illuminate\Database\Schema\Blueprint; use Illuminate\Foundation\Testing\RefreshDatabase; +use Spatie\LaravelData\LaravelDataServiceProvider; +use Spatie\LaravelData\Support\Creation\ValidationStrategy; use Swap\Laravel\SwapServiceProvider; use Weble\LaravelEcommerce\LaravelEcommerceServiceProvider; use Weble\LaravelEcommerce\Tests\mocks\User; @@ -28,6 +30,7 @@ protected function getPackageProviders($app) MoneyServiceProvider::class, \Sebdesign\SM\ServiceProvider::class, \Iben\Statable\ServiceProvider::class, + LaravelDataServiceProvider::class, LaravelEcommerceServiceProvider::class, ]; } @@ -53,6 +56,8 @@ protected function getEnvironmentSetUp($app) ]); $app['config']->set('ecommerce.classes.user', User::class); + + } protected function setupDatabase() From cf7f0936a1aa26185247749561623b8de03eab64 Mon Sep 17 00:00:00 2001 From: Daniele Rosario Date: Mon, 3 Jun 2024 15:14:49 +0200 Subject: [PATCH 3/6] uopgrades! --- .phpunit.cache/test-results | 2 +- UPGRADE.md | 2 +- composer.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.phpunit.cache/test-results b/.phpunit.cache/test-results index 7dac1d9..34a0df2 100644 --- a/.phpunit.cache/test-results +++ b/.phpunit.cache/test-results @@ -1 +1 @@ -{"version":1,"defects":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":8,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":8},"times":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_manager_from_config":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_load_facade":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":0.02,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":0.009,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":0.014,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":0.011,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":0.013,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":0.018,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":0.015,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":0.014,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_resolver":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_manager":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product":0.009,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_private_customer":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":0.007}} \ No newline at end of file +{"version":1,"defects":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":8,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":8,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":8,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":8},"times":{"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_manager_from_config":0.014,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_load_facade":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#session":0.021,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_get_cart_instances#eloquent":0.016,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_generate_cart_items_ids_consistently":0.038,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart#eloquent":0.013,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#cache":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_check_if_item_is_in_cart#eloquent":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#session":0.007,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_remove_from_cart#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#session":0.016,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_total#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#session":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_tax#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#session":0.011,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_item_discounts#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_subtotal_discounts#eloquent":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#session":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#cache":0.008,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_calculate_items_discounts#eloquent":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#session":0.017,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#cache":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_attach_customer_to_cart#eloquent":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::user_add_to_cart_storing_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::cart_stored_storing_in_db_for_different_users":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CartTest::can_add_discount_to_cart_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\MultipleCartsTest::stores_different_carts_in_db":0.01,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_storing_in_db":0.012,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db":0.009,"Weble\\LaravelEcommerce\\Tests\\Cart\\CustomerTest::can_add_to_cart_for_user_storing_in_db_multiple_times":0.01,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::can_create_order_from_cart":0.016,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_has_unique_hash":0.011,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_items_are_stored_correctly":0.014,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::uses_state_machine_to_manage_order":0.023,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_history_is_stored_correctly":0.016,"Weble\\LaravelEcommerce\\Tests\\Order\\OrderTest::order_creates_payment":0.013,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_resolver":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_get_tax_manager":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product":0.009,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_private_customer":0.007,"Weble\\LaravelEcommerce\\Tests\\Tax\\TaxTest::can_calculate_tax_for_physical_product_with_different_country_eu_company":0.007}} \ No newline at end of file diff --git a/UPGRADE.md b/UPGRADE.md index 2dccde0..4b3236d 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -4,5 +4,5 @@ - Dropped support for laravel < 10 - Upgraded to latest version of dependencies (ie: Laravel Money, etc) -- Dropped Spatie Data Transfer in favor of +- Dropped Spatie Data Transfer in favor of Laravel Data - Dropped PHPunit < 10 diff --git a/composer.json b/composer.json index a71d328..1b42fd1 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "php": "^8.1", "ext-json": "*", - "cknow/laravel-money": "^6.2 || ^7.1 || ^v8.1", + "cknow/laravel-money": "^7.1 || ^v8.1", "commerceguys/addressing": "^1.4", "commerceguys/tax": "^0.8", "florianv/laravel-swap": "^2.3", @@ -33,7 +33,7 @@ "nyholm/psr7": "^1.3", "php-http/curl-client": "^2.1", "php-http/message": "^1.9", - "spatie/data-transfer-object": "^3.7" + "spatie/laravel-data": "^4.6" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.7", From 4725585fde21e04c59668c0523a3c2458a35fc60 Mon Sep 17 00:00:00 2001 From: Daniele Rosario Date: Mon, 3 Jun 2024 15:16:41 +0200 Subject: [PATCH 4/6] fix tests --- .github/workflows/run-tests.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3477345..5f701ca 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -16,12 +16,14 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.1] - laravel: [9.*] + php: [8.1, 8.2, 8.3] + laravel: [10.*, 11.*] dependency-version: [prefer-stable] include: - - laravel: 9.* - testbench: 7.* + - laravel: 10.* + testbench: 8.* + - laravel: 11.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} From 66e8ecf15d2e86ad6b0c65efc72dd04f3bbc0101 Mon Sep 17 00:00:00 2001 From: Daniele Rosario Date: Mon, 3 Jun 2024 15:17:50 +0200 Subject: [PATCH 5/6] fix tests --- .github/workflows/run-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5f701ca..0eaa83a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -19,6 +19,9 @@ jobs: php: [8.1, 8.2, 8.3] laravel: [10.*, 11.*] dependency-version: [prefer-stable] + exclude: + - laravel: 11.* + - php: 8.1 include: - laravel: 10.* testbench: 8.* From f962e4c958ef9ce4a7601185e578011e6dd14d23 Mon Sep 17 00:00:00 2001 From: Daniele Rosario Date: Mon, 3 Jun 2024 15:18:33 +0200 Subject: [PATCH 6/6] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0eaa83a..265ba3a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,7 +21,7 @@ jobs: dependency-version: [prefer-stable] exclude: - laravel: 11.* - - php: 8.1 + php: 8.1 include: - laravel: 10.* testbench: 8.*