@@ -18,7 +18,7 @@ class CartTest extends PHPUnit\Framework\TestCase {
1818 */
1919 protected $ cart ;
2020
21- public function setUp ()
21+ public function setUp (): void
2222 {
2323 $ events = m::mock ('Illuminate\Contracts\Events\Dispatcher ' );
2424 $ events ->shouldReceive ('dispatch ' );
@@ -32,7 +32,7 @@ public function setUp()
3232 );
3333 }
3434
35- public function tearDown ()
35+ public function tearDown (): void
3636 {
3737 m::close ();
3838 }
@@ -242,7 +242,7 @@ public function test_item_price_should_be_normalized_when_added_to_cart()
242242 // add a price in a string format should be converted to float
243243 $ this ->cart ->add (455 , 'Sample Item ' , '100.99 ' , 2 , array ());
244244
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 ' );
246246 }
247247
248248 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
413413 $ this ->assertEquals (3 , $ item ['quantity ' ], 'Item quantity of with item ID of 456 should now be reduced to 2 ' );
414414 }
415415
416- /**
417- * @expectedException Darryldecode\Cart\Exceptions\InvalidItemException
418- */
419416 public function test_should_throw_exception_when_provided_invalid_values_scenario_one ()
420417 {
418+ $ this ->expectException ('Darryldecode\Cart\Exceptions\InvalidItemException ' );
421419 $ this ->cart ->add (455 , 'Sample Item ' , 100.99 , 0 , array ());
422420 }
423421
424- /**
425- * @expectedException Darryldecode\Cart\Exceptions\InvalidItemException
426- */
427422 public function test_should_throw_exception_when_provided_invalid_values_scenario_two ()
428423 {
424+ $ this ->expectException ('Darryldecode\Cart\Exceptions\InvalidItemException ' );
429425 $ this ->cart ->add ('' , 'Sample Item ' , 100.99 , 2 , array ());
430426 }
431427
432- /**
433- * @expectedException Darryldecode\Cart\Exceptions\InvalidItemException
434- */
435428 public function test_should_throw_exception_when_provided_invalid_values_scenario_three ()
436429 {
430+ $ this ->expectException ('Darryldecode\Cart\Exceptions\InvalidItemException ' );
437431 $ this ->cart ->add (523 , '' , 100.99 , 2 , array ());
438432 }
439433
@@ -490,7 +484,7 @@ public function test_cart_get_total_quantity()
490484 $ this ->assertFalse ($ this ->cart ->isEmpty (),'prove first cart is not empty ' );
491485
492486 // 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 ' );
494488 $ this ->assertEquals (4 , $ this ->cart ->getTotalQuantity (),'Cart \'s quantity should be 4. ' );
495489 }
496490}
0 commit comments