Added tests for numeric ids

This commit is contained in:
Rob Gloudemans
2014-12-06 15:06:38 +01:00
parent 3e82f22330
commit 51be26f5ce

View File

@@ -36,6 +36,14 @@ class CartTest extends PHPUnit_Framework_TestCase {
$this->cart->add('293ad', 'Product 1', 1, 9.99, array('size' => 'large'));
}
public function testCartCanAddWithNumericId()
{
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));
$this->events->shouldReceive('fire')->once()->with('cart.added', m::type('array'));
$this->cart->add(12345, 'Product 1', 1, 9.99, array('size' => 'large'));
}
public function testCartCanAddArray()
{
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));
@@ -136,6 +144,19 @@ class CartTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Product 2', $this->cart->content()->first()->name);
}
public function testCartCanUpdateItemToNumericId()
{
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));
$this->events->shouldReceive('fire')->once()->with('cart.added', m::type('array'));
$this->events->shouldReceive('fire')->once()->with('cart.update', m::type('string'));
$this->events->shouldReceive('fire')->once()->with('cart.updated', m::type('string'));
$this->cart->add('293ad', 'Product 1', 1, 9.99);
$this->cart->update('8cbf215baa3b757e910e5305ab981172', array('id' => 12345));
$this->assertEquals(12345, $this->cart->content()->first()->id);
}
public function testCartCanUpdateOptions()
{
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));