Updates to 03-2025
This commit is contained in:
parent
6167273a48
commit
9b54eb0512
348 changed files with 34535 additions and 5774 deletions
35
packages/digital-bird/shoppingcart/tests/CartAssertions.php
Normal file
35
packages/digital-bird/shoppingcart/tests/CartAssertions.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Gloudemans\Tests\Shoppingcart;
|
||||
|
||||
use Gloudemans\Shoppingcart\Cart;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
|
||||
trait CartAssertions
|
||||
{
|
||||
/**
|
||||
* Assert that the cart contains the given number of items.
|
||||
*
|
||||
* @param int|float $items
|
||||
* @param \Gloudemans\Shoppingcart\Cart $cart
|
||||
*/
|
||||
public function assertItemsInCart($items, Cart $cart)
|
||||
{
|
||||
$actual = $cart->count();
|
||||
|
||||
PHPUnit::assertEquals($items, $cart->count(), "Expected the cart to contain {$items} items, but got {$actual}.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the cart contains the given number of rows.
|
||||
*
|
||||
* @param int $rows
|
||||
* @param \Gloudemans\Shoppingcart\Cart $cart
|
||||
*/
|
||||
public function assertRowsInCart($rows, Cart $cart)
|
||||
{
|
||||
$actual = $cart->content()->count();
|
||||
|
||||
PHPUnit::assertCount($rows, $cart->content(), "Expected the cart to contain {$rows} rows, but got {$actual}.");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue