public function CartHandlerTest::testDeleteCart in Mailchimp E-Commerce 8
@covers ::deleteCart
File
- tests/
src/ Unit/ CartHandlerTest.php, line 120
Class
- CartHandlerTest
- Tests cart handler methods.
Namespace
Drupal\Tests\mailchimp_ecommerce\UnitCode
public function testDeleteCart() {
$this->helper
->method('getStoreId')
->willReturn('my_store');
$this->mcEcommerce
->expects($this
->at(0))
->method('deleteCart');
$this->handler
->deleteCart('my_cart');
// Test ignored exception handling.
$exception = new \Exception('Error!', 404);
$this->mcEcommerce
->expects($this
->at(0))
->method('deleteCart')
->will($this
->throwException($exception));
$this->handler
->deleteCart('my_cart');
$this
->assertEmpty($this->errors);
// Test real exception handling.
$exception = new \Exception('Error!', 500);
$this->mcEcommerce
->expects($this
->at(0))
->method('deleteCart')
->will($this
->throwException($exception));
$this->handler
->deleteCart('my_cart');
$this
->assertContains('Error!', $this->errors);
}