Skip to content

Commit

Permalink
Merge pull request #23 from offline-agency/fix-add-options-to-cart-pl…
Browse files Browse the repository at this point in the history
…ug-in

Fix update cart trait
  • Loading branch information
ManuelRomanato authored Apr 7, 2022
2 parents af93d9e + f37b4d5 commit 5783a40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Cart
const DEFAULT_INSTANCE = 'default';

/**
* @var
* @var array
*/
private $options;

Expand Down Expand Up @@ -840,17 +840,17 @@ private function applyGlobalCoupon(
}

/**
* @return mixed
* @return array
*/
public function getOptions()
public function getOptions(): array
{
return $this->options;
}

/**
* @param mixed $options
* @param array $options
*/
public function setOptions($options): void
public function setOptions(array $options): void
{
$this->options = $options;
}
Expand Down
8 changes: 8 additions & 0 deletions tests/CartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,14 @@ public function it_can_return_a_coupon_by_its_code()
$this->assertEquals(50, $coupon->couponValue);
}

/** @test */
public function it_can_set_and_get_options_on_cart()
{
$cart = $this->getCart();
$cart->setOptions(['test' => 'test']);
$this->assertEquals(['test' => 'test'], $cart->getOptions());
}

/**
* Get an instance of the cart.
*
Expand Down

0 comments on commit 5783a40

Please sign in to comment.