Updated Cart::update() method so you can also update the 'options', also added unit test for it

This commit is contained in:
Rob Gloudemans
2013-05-31 07:28:13 +02:00
parent e0fc3f0145
commit 951c4a8b0f
2 changed files with 21 additions and 1 deletions

View File

@@ -57,6 +57,18 @@ class CartTest extends TestCase {
$this->assertInstanceOf('Gloudemans\Shoppingcart\CartCollection', Cart::content());
}
public function testCartCanUpdateOptionsAttribute()
{
Cart::add(1, 'test', 1, 10.00, ['size' => 'L']);
$rowId = Cart::content()->first()->rowid;
Cart::update($rowId, ['options' => ['color' => 'yellow']]);
$this->assertEquals(Cart::get($rowId)->options, new Gloudemans\Shoppingcart\CartRowOptionsCollection(['size' => 'L', 'color' => 'yellow']));
$this->assertInstanceOf('Gloudemans\Shoppingcart\CartRowOptionsCollection', Cart::get($rowId)->options);
}
public function testCartCanRemove()
{
Cart::add(1, 'test', 1, 10.00, ['size' => 'L']);