You are here

protected function BusinessRulesProcessorTest::setUp in Business Rules 2.x

Overrides KernelTestBase::setUp

File

tests/src/Kernel/BusinessRulesProcessorTest.php, line 39

Class

BusinessRulesProcessorTest
Tests the BusinessRulesProcessor.

Namespace

Drupal\Tests\business_rules\Kernel

Code

protected function setUp() {
  parent::setUp();

  // Set up the service container.
  $this->sutContainer = new ContainerBuilder();

  // Mock a bunch of stuff that BusinessRulesProcessor requires but are
  // irrelevant to the tests in this class.
  $this->sutContainer
    ->set('business_rules.util', $this
    ->createMock(BusinessRulesUtil::class));
  $this->sutContainer
    ->set('plugin.manager.business_rules.action', $this
    ->createMock(BusinessRulesActionManager::class));
  $this->sutContainer
    ->set('plugin.manager.business_rules.condition', $this
    ->createMock(BusinessRulesConditionManager::class));
  $this->sutContainer
    ->set('plugin.manager.business_rules.variable', $this
    ->createMock(BusinessRulesVariableManager::class));
  $this->sutContainer
    ->set('entity_type.manager', $this
    ->createMock(EntityTypeManagerInterface::class));
  $this->sutContainer
    ->set('messenger', $this
    ->createMock(MessengerInterface::class));

  // Mock a class used by \Drupal\business_rules\Entity\BusinessRule, which is
  // constructed when BusinessRulesProcessor processes an event.
  $this->sutContainer
    ->set('plugin.manager.business_rules.reacts_on', $this
    ->createMock(BusinessRulesReactsOnManager::class));
}