mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 15:41:24 +00:00
pull in changes
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/vendor
|
/vendor
|
||||||
composer.phar
|
composer.phar
|
||||||
composer.lock
|
composer.lock
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.idea
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
"illuminate/support": "~4"
|
"illuminate/support": "~4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "0.9.*"
|
"mockery/mockery": "~0.9",
|
||||||
|
"phpunit/phpunit": "~4.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$session= new SessionMock;
|
$session= new SessionMock;
|
||||||
$this->events = m::mock('Illuminate\Events\Dispatcher');
|
$this->events = m::mock('Illuminate\Contracts\Events\Dispatcher');
|
||||||
|
|
||||||
$this->cart = new Cart($session, $this->events);
|
$this->cart = new Cart($session, $this->events);
|
||||||
}
|
}
|
||||||
@@ -36,6 +36,14 @@ class CartTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->cart->add('293ad', 'Product 1', 1, 9.99, array('size' => 'large'));
|
$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()
|
public function testCartCanAddArray()
|
||||||
{
|
{
|
||||||
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));
|
$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);
|
$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()
|
public function testCartCanUpdateOptions()
|
||||||
{
|
{
|
||||||
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));
|
$this->events->shouldReceive('fire')->once()->with('cart.add', m::type('array'));
|
||||||
@@ -388,4 +409,3 @@ class CartTest extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user