mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 13:51:44 +00:00
init commit :rocket
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Wearepixel\Cart\Cart;
|
||||
use Wearepixel\Cart\Tests\Helpers\SessionMock;
|
||||
|
||||
beforeEach(function () {
|
||||
$events = Mockery::mock('Illuminate\Contracts\Events\Dispatcher');
|
||||
$events->shouldReceive('dispatch');
|
||||
|
||||
$this->cart = new Cart(
|
||||
new SessionMock,
|
||||
$events,
|
||||
'shopping',
|
||||
'SAMPLESESSIONKEY',
|
||||
require (__DIR__ . '/../Helpers/ConfigMockOtherFormat.php')
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
Mockery::close();
|
||||
});
|
||||
|
||||
test('item get sum price using property', function () {
|
||||
$this->cart->add(455, 'Sample Item', 100.99, 2, []);
|
||||
|
||||
$item = $this->cart->get(455);
|
||||
|
||||
expect($item->getPriceSum())->toEqual('201.98', 'Item summed price should be 201.98');
|
||||
});
|
||||
|
||||
test('item get sum price using array style', function () {
|
||||
$this->cart->add(455, 'Sample Item', 100.99, 2, []);
|
||||
|
||||
$item = $this->cart->get(455);
|
||||
|
||||
expect($item->getPriceSum())->toEqual('201.98', 'Item summed price should be 201.98');
|
||||
});
|
||||
Reference in New Issue
Block a user