Large update for version 2.0

This commit is contained in:
Rob Gloudemans
2016-05-12 10:19:38 +02:00
parent f5f15c73a2
commit 0f20bef1af
35 changed files with 1832 additions and 1145 deletions

35
tests/CartAssertions.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
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}.");
}
}