mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-22 15:15:27 +00:00
Replaced deprecated OR operator https://getcomposer.org/doc/articles/versions.md#version-range
Added 5.8.* compatibility Updated dependency versions Added phpunit result cache to gitignore
This commit is contained in:
@@ -59,7 +59,7 @@ class CartTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@@ -215,11 +215,12 @@ class CartTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Please supply a valid identifier.
|
||||
*/
|
||||
public function it_will_validate_the_identifier()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Please supply a valid identifier.');
|
||||
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(null, 'Some title', 1, 10.00);
|
||||
@@ -227,11 +228,12 @@ class CartTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Please supply a valid name.
|
||||
*/
|
||||
public function it_will_validate_the_name()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Please supply a valid name.');
|
||||
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(1, null, 1, 10.00);
|
||||
@@ -239,11 +241,12 @@ class CartTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Please supply a valid quantity.
|
||||
*/
|
||||
public function it_will_validate_the_quantity()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Please supply a valid quantity.');
|
||||
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(1, 'Some title', 'invalid', 10.00);
|
||||
@@ -251,11 +254,12 @@ class CartTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Please supply a valid price.
|
||||
*/
|
||||
public function it_will_validate_the_price()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Please supply a valid price.');
|
||||
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(1, 'Some title', 1, 'invalid');
|
||||
@@ -343,10 +347,11 @@ class CartTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Gloudemans\Shoppingcart\Exceptions\InvalidRowIDException
|
||||
*/
|
||||
public function it_will_throw_an_exception_if_a_rowid_was_not_found()
|
||||
{
|
||||
$this->expectException(\Gloudemans\Shoppingcart\Exceptions\InvalidRowIDException::class);
|
||||
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(new BuyableProduct());
|
||||
@@ -608,7 +613,7 @@ class CartTest extends TestCase
|
||||
|
||||
$cartItem = $cart->get('027c91341fd5cf4d2579b49c4b6a90da');
|
||||
|
||||
$this->assertContains(BuyableProduct::class, Assert::readAttribute($cartItem, 'associatedModel'));
|
||||
$this->assertEquals(BuyableProduct::class, $cartItem->modelFQCN);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
@@ -622,16 +627,17 @@ class CartTest extends TestCase
|
||||
|
||||
$cartItem = $cart->get('027c91341fd5cf4d2579b49c4b6a90da');
|
||||
|
||||
$this->assertEquals(ProductModel::class, Assert::readAttribute($cartItem, 'associatedModel'));
|
||||
$this->assertEquals(ProductModel::class, $cartItem->modelFQCN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Gloudemans\Shoppingcart\Exceptions\UnknownModelException
|
||||
* @expectedExceptionMessage The supplied model SomeModel does not exist.
|
||||
*/
|
||||
public function it_will_throw_an_exception_when_a_non_existing_model_is_being_associated()
|
||||
{
|
||||
$this->expectException(\Gloudemans\Shoppingcart\Exceptions\UnknownModelException::class);
|
||||
$this->expectExceptionMessage('The supplied model SomeModel does not exist.');
|
||||
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(1, 'Test item', 1, 10.00);
|
||||
@@ -825,11 +831,12 @@ class CartTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Gloudemans\Shoppingcart\Exceptions\CartAlreadyStoredException
|
||||
* @expectedExceptionMessage A cart with identifier 123 was already stored.
|
||||
*/
|
||||
public function it_will_throw_an_exception_when_a_cart_was_already_stored_using_the_specified_identifier()
|
||||
{
|
||||
$this->expectException(\Gloudemans\Shoppingcart\Exceptions\CartAlreadyStoredException::class);
|
||||
$this->expectExceptionMessage('A cart with identifier 123 was already stored.');
|
||||
|
||||
$this->artisan('migrate', [
|
||||
'--database' => 'testing',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user