Commit 79251f3e authored by Thorsten Buss's avatar Thorsten Buss

Upgrade to Laravel6, PHpUnit6 and PHP7

parent 781ec068
......@@ -2,3 +2,4 @@
composer.phar
composer.lock
.DS_Store
/.phpunit.result.cache
......@@ -14,21 +14,21 @@
}
],
"require": {
"php": ">=5.6.0",
"php": ">=7.1.3",
"illuminate/support": "5.*",
"illuminate/validation": "5.*",
"illuminate/translation": "5.*",
"illuminate/session": "5.*",
"bnet/money-datatype": "~0.1.13"
"bnet/money-datatype": "~0.1"
},
"require-dev": {
"mockery/mockery": "~0.9",
"phpunit/phpunit": "~4.0",
"symfony/var-dumper": "2.7.*@dev"
"mockery/mockery": "~1",
"phpunit/phpunit": "~8.0"
},
"autoload": {
"psr-4": {
"Bnet\\": "src/"
"Bnet\\": "src/",
"Test\\": "tests/"
}
},
"minimum-stability": "stable"
......
......@@ -8,11 +8,10 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
......@@ -79,7 +79,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
$this->sessionKeyCartAttributes = $session_key . '_cart_attributes';
$this->sessionKeyCartItems = $session_key . '_cart_items';
$this->sessionKeyCartConditions = $session_key . '_cart_conditions';
$this->events->fire($this->getInstanceName() . '.created', array($this));
$this->events->dispatch($this->getInstanceName() . '.created', array($this));
if (!empty($custom_item_rules))
$this->item_rules = $custom_item_rules;
}
......@@ -201,7 +201,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
* of the item you want to update on it
*/
public function update($id, $data) {
$this->events->fire($this->getInstanceName() . '.updating', array($data, $this));
$this->events->dispatch($this->getInstanceName() . '.updating', array($data, $this));
$cart = $this->items();
......@@ -239,7 +239,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
$this->save($cart);
$this->events->fire($this->getInstanceName() . '.updated', array($item, $this));
$this->events->dispatch($this->getInstanceName() . '.updated', array($item, $this));
}
/**
......@@ -265,27 +265,27 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
public function remove($id) {
$cart = $this->items();
$this->events->fire($this->getInstanceName() . '.removing', array($id, $this));
$this->events->dispatch($this->getInstanceName() . '.removing', array($id, $this));
$cart->forget($id);
$this->save($cart);
$this->events->fire($this->getInstanceName() . '.removed', array($id, $this));
$this->events->dispatch($this->getInstanceName() . '.removed', array($id, $this));
}
/**
* clears cart items, all attributes and condisions remain
*/
public function clear() {
$this->events->fire($this->getInstanceName() . '.clearing', array($this));
$this->events->dispatch($this->getInstanceName() . '.clearing', array($this));
$this->session->put(
$this->sessionKeyCartItems,
array()
);
$this->events->fire($this->getInstanceName() . '.cleared', array($this));
$this->events->dispatch($this->getInstanceName() . '.cleared', array($this));
}
/**
......@@ -718,7 +718,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
if (!$item instanceof Item)
$item = $this->createCartItem($item);
$this->events->fire($this->getInstanceName() . '.adding', array($item, $this));
$this->events->dispatch($this->getInstanceName() . '.adding', array($item, $this));
$items = $this->items();
......@@ -726,7 +726,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
$this->save($items);
$this->events->fire($this->getInstanceName() . '.added', array($item, $this));
$this->events->dispatch($this->getInstanceName() . '.added', array($item, $this));
}
/**
......
<?php
namespace Test\Helpers;
use Bnet\Cart\Cart;
use Mockery as m;
use Test\TestCase;
/**
* User: thorsten
* Date: 27.01.20
* Time: 15:01
*/
class CartBase extends TestCase {
/**
* @var \Bnet\Cart\Cart
*/
protected $cart;
public function setUp(): void {
$events = m::mock('\Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('dispatch');
$this->cart = new Cart(
new SessionMock(),
$events,
'shopping',
'SAMPLESESSIONKEY'
);
}
public function tearDown(): void {
m::close();
}
}
\ No newline at end of file
<?php
namespace Test\Helpers;
use Bnet\Cart\CurrencyCart;
use Mockery as m;
use Test\TestCase;
/**
* User: thorsten
* Date: 27.01.20
* Time: 15:01
*/
class CurrencyCartBase extends TestCase {
/**
* @var \Bnet\Cart\Cart
*/
protected $cart;
public function setUp(): void
{
$events = m::mock('\Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('dispatch');
$this->cart = new CurrencyCart(
new SessionMock(),
$events,
'shopping',
'SAMPLESESSIONKEY'
);
}
public function tearDown(): void
{
m::close();
}
}
\ No newline at end of file
<?php
namespace Test\Helpers;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
......
<?php
namespace Test;
use PHPUnit\Framework\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase {
}
......@@ -6,36 +6,14 @@
* Time: 9:59 PM
*/
use Bnet\Cart\Cart;
namespace Test\Unit;
use Bnet\Cart\Condition;
use Bnet\Cart\Exceptions\InvalidConditionException;
use Bnet\Cart\Exceptions\InvalidItemException;
use Mockery as m;
require_once __DIR__ . '/helpers/SessionMock.php';
class CartConditionTest extends PHPUnit_Framework_TestCase {
/**
* @var Bnet\Cart\Cart
*/
protected $cart;
use Test\Helpers\CartBase;
public function setUp() {
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('fire');
$this->cart = new Cart(
new SessionMock(),
$events,
'shopping',
'SAMPLESESSIONKEY'
);
}
public function tearDown() {
m::close();
}
class CartConditionTest extends CartBase {
public function test_total_without_condition() {
$this->fillCart();
......@@ -798,7 +776,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
// when get attribute is called and there is no attributes added,
// it should return an empty array
$conditionAttribute = $contition->getAttributes();
$this->assertInternalType('array', $conditionAttribute);
$this->assertIsArray($conditionAttribute);
}
public function test_add_cart_condition_with_condition_attributes() {
......@@ -833,7 +811,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
// when get attribute is called and there is no attributes added,
// it should return an empty array
$conditionAttributes = $contition->getAttributes();
$this->assertInternalType('array', $conditionAttributes);
$this->assertIsArray($conditionAttributes);
$this->assertArrayHasKey('description', $conditionAttributes);
$this->assertArrayHasKey('sale_start_date', $conditionAttributes);
$this->assertArrayHasKey('sale_end_date', $conditionAttributes);
......
......@@ -6,34 +6,13 @@
* Time: 9:59 PM
*/
use Bnet\Cart\Cart;
use Bnet\Cart\Condition;
use Mockery as m;
require_once __DIR__ . '/helpers/SessionMock.php';
class CartTest extends PHPUnit_Framework_TestCase {
/**
* @var Bnet\Cart\Cart
*/
protected $cart;
public function setUp() {
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('fire');
namespace Test\Unit;
$this->cart = new Cart(
new SessionMock(),
$events,
'shopping',
'SAMPLESESSIONKEY'
);
}
use Bnet\Cart\Condition;
use Bnet\Money\Money;
use Test\Helpers\CartBase;
public function tearDown() {
m::close();
}
class CartTest extends CartBase {
public function test_cart_can_add_item() {
$this->cart->add(455, 'Sample Item', 10099, 2, array());
......@@ -235,7 +214,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
// add a price in a string format should be converted to int
$this->cart->add(455, 'Sample Item', '10099', 2, array());
$this->assertInternalType('int', $this->cart->items()->first()['price'], 'Cart price should be a int');
$this->assertIsInt($this->cart->items()->first()['price'], 'Cart price should be a int');
}
public function test_it_removes_an_item_on_cart_by_item_id() {
......@@ -402,19 +381,19 @@ class CartTest extends PHPUnit_Framework_TestCase {
}
public function test_should_throw_exception_when_provided_invalid_values_scenario_one() {
$this->setExpectedException('Bnet\Cart\Exceptions\InvalidItemException');
$this->expectException('Bnet\Cart\Exceptions\InvalidItemException');
$this->cart->add(455, 'Sample Item', 10099, 0, array());
}
public function test_should_throw_exception_when_provided_invalid_values_scenario_two() {
$this->setExpectedException('Bnet\Cart\Exceptions\InvalidItemException');
$this->expectException('Bnet\Cart\Exceptions\InvalidItemException');
$this->cart->add('', 'Sample Item', 10099, 2, array());
}
public function test_should_throw_exception_when_provided_invalid_values_scenario_three() {
$this->setExpectedException('Bnet\Cart\Exceptions\InvalidItemException');
$this->expectException('Bnet\Cart\Exceptions\InvalidItemException');
$this->cart->add(523, '', 10099, 2, array());
}
......@@ -481,7 +460,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->cart->isEmpty(), 'prove first cart is not empty');
// now let's count the cart's quantity
$this->assertInternalType("int", $this->cart->totalQuantity(), 'Return type should be INT');
$this->assertIsInt($this->cart->totalQuantity(), 'Return type should be INT');
$this->assertEquals(4, $this->cart->totalQuantity(), 'Cart\'s quantity should be 4.');
}
......@@ -498,7 +477,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
], 568 => [
'id' => 568,
'name' => 'Sample Item 2',
'price' => new \Bnet\Money\Money(6925),
'price' => new Money(6925),
'quantity' => 1,
],
];
......@@ -553,7 +532,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
], 568 => [
'id' => 568,
'name' => 'Sample Item 2',
'price' => new \Bnet\Money\Money(6925),
'price' => new Money(6925),
'quantity' => 1,
],
];
......
......@@ -6,25 +6,30 @@
* Time: 3:20 PM
*/
namespace Test\Unit;
use Bnet\Cart\Cart;
use Mockery as m;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use Test\Helpers\SessionMock;
use Test\TestCase;
require_once __DIR__ . '/helpers/SessionMock.php';
class CartTestEvents extends TestCase {
class CartTestEvents extends PHPUnit_Framework_TestCase {
use MockeryPHPUnitIntegration;
const CART_INSTANCE_NAME = 'shopping';
public function setUp() {
public function setUp(): void {
}
public function tearDown() {
public function tearDown(): void {
m::close();
}
public function test_event_cart_created() {
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$cart = new Cart(
new SessionMock(),
......@@ -36,9 +41,9 @@ class CartTestEvents extends PHPUnit_Framework_TestCase {
public function test_event_cart_adding() {
$events = m::mock('Illuminate\Events\Dispatcher');
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$cart = new Cart(
new SessionMock(),
......@@ -52,9 +57,9 @@ class CartTestEvents extends PHPUnit_Framework_TestCase {
public function test_event_cart_adding_multiple_times() {
$events = m::mock('Illuminate\Events\Dispatcher');
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('fire')->times(2)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('fire')->times(2)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('dispatch')->times(2)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('dispatch')->times(2)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$cart = new Cart(
new SessionMock(),
......@@ -69,9 +74,9 @@ class CartTestEvents extends PHPUnit_Framework_TestCase {
public function test_event_cart_adding_multiple_times_scenario_two() {
$events = m::mock('Illuminate\Events\Dispatcher');
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$items = array(
array(
......@@ -109,11 +114,11 @@ class CartTestEvents extends PHPUnit_Framework_TestCase {
public function test_event_cart_remove_item() {
$events = m::mock('Illuminate\Events\Dispatcher');
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('fire')->times(1)->with(self::CART_INSTANCE_NAME . '.removing', m::type('array'));
$events->shouldReceive('fire')->times(1)->with(self::CART_INSTANCE_NAME . '.removed', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('dispatch')->times(1)->with(self::CART_INSTANCE_NAME . '.removing', m::type('array'));
$events->shouldReceive('dispatch')->times(1)->with(self::CART_INSTANCE_NAME . '.removed', m::type('array'));
$items = array(
array(
......@@ -153,11 +158,11 @@ class CartTestEvents extends PHPUnit_Framework_TestCase {
public function test_event_cart_clear() {
$events = m::mock('Illuminate\Events\Dispatcher');
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.clearing', m::type('array'));
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME . '.cleared', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.created', m::type('array'));
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME . '.adding', m::type('array'));
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME . '.added', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.clearing', m::type('array'));
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME . '.cleared', m::type('array'));
$items = array(
array(
......
......@@ -6,33 +6,23 @@
* Time: 1:45 PM
*/
namespace Test\Unit;
use Bnet\Cart\Cart;
use Mockery as m;
use Test\Helpers\CartBase;
use Test\Helpers\SessionMock;
require_once __DIR__ . '/helpers/SessionMock.php';
class CartTestMultipleInstances extends PHPUnit_Framework_TestCase {
/**
* @var Bnet\Cart\Cart
*/
protected $cart1;
class CartTestMultipleInstances extends CartBase {
/**
* @var Bnet\Cart\Cart
*/
protected $cart2;
public function setUp() {
public function setUp(): void {
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('fire');
$this->cart1 = new Cart(
new SessionMock(),
$events,
'shopping',
'uniquesessionkey123'
);
$events->shouldReceive('dispatch');
$this->cart2 = new Cart(
new SessionMock(),
......@@ -40,10 +30,8 @@ class CartTestMultipleInstances extends PHPUnit_Framework_TestCase {
'wishlist',
'uniquesessionkey456'
);
}
public function tearDown() {
m::close();
parent::setUp();
}
public function test_cart_multiple_instances() {
......@@ -72,11 +60,11 @@ class CartTestMultipleInstances extends PHPUnit_Framework_TestCase {
),
);
$this->cart1->add($itemsForCart1);
$this->cart->add($itemsForCart1);
$this->assertFalse($this->cart1->isEmpty(), 'Cart should not be empty');
$this->assertEquals(3, count($this->cart1->items()->toArray()), 'Cart should have 3 items');
$this->assertEquals('shopping', $this->cart1->getInstanceName(), 'Cart 1 should have instance name of "shopping"');
$this->assertFalse($this->cart->isEmpty(), 'Cart should not be empty');
$this->assertEquals(3, count($this->cart->items()->toArray()), 'Cart should have 3 items');
$this->assertEquals('shopping', $this->cart->getInstanceName(), 'Cart 1 should have instance name of "shopping"');
// add 1 item on cart 2
$itemsForCart2 = array(
......
<?php
namespace Test\Unit;
use Bnet\Cart\Condition;
use Bnet\Cart\CurrencyCart;
use Bnet\Cart\CurrencyCondition;
use Bnet\Cart\CurrencyItem;
use Bnet\Cart\Exceptions\InvalidConditionException;
......@@ -9,32 +10,9 @@ use Bnet\Cart\Exceptions\InvalidItemException;
use Bnet\Money\Money;
use Bnet\Money\MoneyException;
use Bnet\Money\TaxedMoney;
use Mockery as m;
require_once __DIR__ . '/helpers/SessionMock.php';
class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
/**
* @var Bnet\Cart\CurrencyCart
*/
protected $cart;
use Test\Helpers\CurrencyCartBase;
public function setUp() {
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('fire');
$this->cart = new CurrencyCart(
new SessionMock(),
$events,
'shopping',
'SAMPLESESSIONKEY'
);
}
public function tearDown() {
m::close();
}
class CurrencyCartConditionTest extends CurrencyCartBase {
public function test_total_without_condition() {
$this->fillCart();
......@@ -819,7 +797,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
// when get attribute is called and there is no attributes added,
// it should return an empty array
$conditionAttribute = $contition->getAttributes();
$this->assertInternalType('array', $conditionAttribute);
$this->assertIsArray($conditionAttribute);
}
public function test_add_cart_condition_with_condition_attributes() {
......@@ -854,7 +832,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
// when get attribute is called and there is no attributes added,
// it should return an empty array
$conditionAttributes = $contition->getAttributes();
$this->assertInternalType('array', $conditionAttributes);
$this->assertIsArray($conditionAttributes);
$this->assertArrayHasKey('description', $conditionAttributes);
$this->assertArrayHasKey('sale_start_date', $conditionAttributes);
$this->assertArrayHasKey('sale_end_date', $conditionAttributes);
......@@ -864,17 +842,17 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
}
/**
* @expectedException \Bnet\Cart\Exceptions\CurrencyNotMachedException
*/
public function testAddItemWithDifferentCurrency() {
$this->expectException(\Bnet\Cart\Exceptions\CurrencyNotMachedException::class);
$this->cart->add(999, 'test', new Money(12345, 'USD'));
}
/**
* @expectedException \Bnet\Cart\Exceptions\InvalidConditionException
*/
public function test_total_with_condition_with_money_exception() {
$items = array(
$this->expectException(\Bnet\Cart\Exceptions\InvalidConditionException::class);
$items = array(
array(
'id' => 456,
'name' => 'Sample Item 1',
......@@ -884,7 +862,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
'name' => 'Test FIX 5EUR',
'type' => 'test',
'target' => Condition::TARGET_ITEM,
'value' => new Bnet\Money\Money(500, 'EUR'),
'value' => new Money(500, 'EUR'),
))
]
),
......@@ -905,7 +883,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
new CurrencyCondition(array(
'name' => 'Test FIX 5EUR',
'type' => 'test',
'value' => new Bnet\Money\Money(500, 'EUR'),
'value' => new Money(500, 'EUR'),
))
]
),
......@@ -920,7 +898,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
'name' => 'VAT 12.5%',
'type' => 'tax',
// 'target' => Condition::TARGET_CART,
'value' => new Bnet\Money\Money(123456, 'EUR'),
'value' => new Money(123456, 'EUR'),
));
$this->cart->condition($condition);
......
......@@ -6,35 +6,13 @@
* Time: 9:59 PM
*/
namespace Test\Unit;
use Bnet\Cart\Condition;
use Bnet\Cart\CurrencyCart as Cart;
use Bnet\Money\Money;
use Mockery as m;
require_once __DIR__ . '/helpers/SessionMock.php';
class CurrencyCartTest extends PHPUnit_Framework_TestCase {
/**
* @var Bnet\Cart\CurrencyCart
*/
protected $cart;
public function setUp() {
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
$events->shouldReceive('fire');
use Test\Helpers\CurrencyCartBase;
$this->cart = new Cart(
new SessionMock(),
$events,
'shopping',
'SAMPLESESSIONKEY'
);
}
public function tearDown() {
m::close();
}
class CurrencyCartTest extends CurrencyCartBase {
public function test_cart_can_add_item() {
$this->cart->add(455, 'Sample Item', new Money(10099), 2, array());
......@@ -409,19 +387,19 @@ class CurrencyCartTest extends PHPUnit_Framework_TestCase {
}
public function test_should_throw_exception_when_provided_invalid_values_scenario_one() {
$this->setExpectedException('Bnet\Cart\Exceptions\InvalidItemException');
$this->expectException('Bnet\Cart\Exceptions\InvalidItemException');
$this->cart->add(455, 'Sample Item', new Money(10099), 0, array());
}
public function test_should_throw_exception_when_provided_invalid_values_scenario_two() {
$this->setExpectedException('Bnet\Cart\Exceptions\InvalidItemException');
$this->expectException('Bnet\Cart\Exceptions\InvalidItemException');
$this->cart->add('', 'Sample Item', new Money(10099), 2, array());
}
public function test_should_throw_exception_when_provided_invalid_values_scenario_three() {
$this->setExpectedException('Bnet\Cart\Exceptions\InvalidItemException');
$this->expectException('Bnet\Cart\Exceptions\InvalidItemException');
$this->cart->add(523, '', new Money(10099), 2, array());
}
......@@ -477,7 +455,7 @@ class CurrencyCartTest extends PHPUnit_Fr