You are here

public function CartHandlerTest::testDeleteCartLine in Mailchimp E-Commerce 8

@covers ::deleteCartLine

File

tests/src/Unit/CartHandlerTest.php, line 158

Class

CartHandlerTest
Tests cart handler methods.

Namespace

Drupal\Tests\mailchimp_ecommerce\Unit

Code

public function testDeleteCartLine() {
  $this->helper
    ->method('getStoreId')
    ->willReturn('my_store');
  $this->mcEcommerce
    ->expects($this
    ->at(0))
    ->method('deleteCartLine');
  $this->handler
    ->deleteCartLine('my_cart', 1);

  // Test error handling.
  $exception = new \Exception('Error!');
  $this->mcEcommerce
    ->expects($this
    ->at(0))
    ->method('deleteCartLine')
    ->will($this
    ->throwException($exception));
  $this->handler
    ->deleteCartLine('my_cart', 1, []);
  $this
    ->assertContains('Error!', $this->errors);
}