@@ -18,7 +18,7 @@ class CartTest extends PHPUnit\Framework\TestCase {
18
18
*/
19
19
protected $ cart ;
20
20
21
- public function setUp ()
21
+ public function setUp (): void
22
22
{
23
23
$ events = m::mock ('Illuminate\Contracts\Events\Dispatcher ' );
24
24
$ events ->shouldReceive ('dispatch ' );
@@ -32,7 +32,7 @@ public function setUp()
32
32
);
33
33
}
34
34
35
- public function tearDown ()
35
+ public function tearDown (): void
36
36
{
37
37
m::close ();
38
38
}
@@ -242,7 +242,7 @@ public function test_item_price_should_be_normalized_when_added_to_cart()
242
242
// add a price in a string format should be converted to float
243
243
$ this ->cart ->add (455 , 'Sample Item ' , '100.99 ' , 2 , array ());
244
244
245
- $ this ->assertInternalType ( ' float ' , $ this ->cart ->getContent ()->first ()['price ' ], 'Cart price should be a float ' );
245
+ $ this ->assertIsFloat ( $ this ->cart ->getContent ()->first ()['price ' ], 'Cart price should be a float ' );
246
246
}
247
247
248
248
public function test_it_removes_an_item_on_cart_by_item_id ()
@@ -413,27 +413,21 @@ public function test_item_quantity_update_by_reduced_should_not_reduce_if_quanti
413
413
$ this ->assertEquals (3 , $ item ['quantity ' ], 'Item quantity of with item ID of 456 should now be reduced to 2 ' );
414
414
}
415
415
416
- /**
417
- * @expectedException Darryldecode\Cart\Exceptions\InvalidItemException
418
- */
419
416
public function test_should_throw_exception_when_provided_invalid_values_scenario_one ()
420
417
{
418
+ $ this ->expectException ('Darryldecode\Cart\Exceptions\InvalidItemException ' );
421
419
$ this ->cart ->add (455 , 'Sample Item ' , 100.99 , 0 , array ());
422
420
}
423
421
424
- /**
425
- * @expectedException Darryldecode\Cart\Exceptions\InvalidItemException
426
- */
427
422
public function test_should_throw_exception_when_provided_invalid_values_scenario_two ()
428
423
{
424
+ $ this ->expectException ('Darryldecode\Cart\Exceptions\InvalidItemException ' );
429
425
$ this ->cart ->add ('' , 'Sample Item ' , 100.99 , 2 , array ());
430
426
}
431
427
432
- /**
433
- * @expectedException Darryldecode\Cart\Exceptions\InvalidItemException
434
- */
435
428
public function test_should_throw_exception_when_provided_invalid_values_scenario_three ()
436
429
{
430
+ $ this ->expectException ('Darryldecode\Cart\Exceptions\InvalidItemException ' );
437
431
$ this ->cart ->add (523 , '' , 100.99 , 2 , array ());
438
432
}
439
433
@@ -490,7 +484,7 @@ public function test_cart_get_total_quantity()
490
484
$ this ->assertFalse ($ this ->cart ->isEmpty (),'prove first cart is not empty ' );
491
485
492
486
// now let's count the cart's quantity
493
- $ this ->assertInternalType ( " int " , $ this ->cart ->getTotalQuantity (), 'Return type should be INT ' );
487
+ $ this ->assertIsInt ( $ this ->cart ->getTotalQuantity (), 'Return type should be INT ' );
494
488
$ this ->assertEquals (4 , $ this ->cart ->getTotalQuantity (),'Cart \'s quantity should be 4. ' );
495
489
}
496
490
}
0 commit comments