You are here

CartEventTestBase.php in Ubercart 8.4

File

uc_cart/tests/src/Unit/Integration/Event/CartEventTestBase.php
View source
<?php

namespace Drupal\Tests\uc_cart\Unit\Integration\Event;

use Drupal\rules\Core\RulesEventManager;
use Drupal\Tests\rules\Unit\Integration\Event\EventTestBase;

/**
 * Base class containing common code for uc_cart event tests.
 *
 * @group ubercart
 *
 * @requires module rules
 */
abstract class CartEventTestBase extends EventTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();

    // Must enable our module to make our plugins discoverable.
    $this
      ->enableModule('uc_cart', [
      'Drupal\\uc_cart' => __DIR__ . '/../../../../../src',
    ]);

    // Tell the plugin manager where to look for plugins.
    $this->moduleHandler
      ->getModuleDirectories()
      ->willReturn([
      'uc_cart' => __DIR__ . '/../../../../../',
    ]);

    // Create a real plugin manager with a mock moduleHandler.
    $this->eventManager = new RulesEventManager($this->moduleHandler
      ->reveal(), $this->entityTypeBundleInfo
      ->reveal());
  }

}

Classes

Namesort descending Description
CartEventTestBase Base class containing common code for uc_cart event tests.