You are here

protected function CartHandlerTest::setUp in Mailchimp E-Commerce 8

Overrides UnitTestCase::setUp

File

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

Class

CartHandlerTest
Tests cart handler methods.

Namespace

Drupal\Tests\mailchimp_ecommerce\Unit

Code

protected function setUp() {
  parent::setUp();
  $this->mcEcommerce = $this
    ->createMock(MailchimpEcommerce::class);
  $this->helper = $this
    ->createMock(MailchimpEcommerceHelper::class);
  $this->messenger = $this
    ->createMock(MessengerInterface::class);
  $this->handler = new CartHandler($this->mcEcommerce, $this->helper, $this->messenger);
  $this->errors = [];
  $this->messenger
    ->method('addError')
    ->willReturnCallback(function ($error) {
    $this->errors[] = $error;
  });
}