You are here

ContributedPluginDiscoveryTest.php in Rules 8.3

File

tests/src/Unit/Integration/ContributedPluginDiscoveryTest.php
View source
<?php

namespace Drupal\Tests\rules\Unit\Integration;


/**
 * Tests contributed plugin discovery by RulesIntegrationTestBase.
 *
 * Ensures that Rules plugins defined by contributed (and test) modules may
 * be found by RulesIntegrationTestBase.
 *
 * @coversDefaultClass \Drupal\rules_test\Plugin\Condition\TestConditionTrue
 * @group RulesCondition
 */
class ContributedPluginDiscoveryTest extends RulesEntityIntegrationTestBase {

  /**
   * The condition to be tested.
   *
   * @var \Drupal\rules\Core\RulesConditionInterface
   */
  protected $condition;

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this
      ->enableModule('rules_test');
    $this->condition = $this->conditionManager
      ->createInstance('rules_test_true');
  }

  /**
   * Tests evaluating a condition provided by the 'rules_test' module.
   *
   * We're trying to ensure that plugins from contributed modules are found in
   * the namespace established by the RulesIntegrationTestBase::enableModule().
   *
   * @covers ::evaluate
   */
  public function testPluginDiscovery() {
    $this
      ->assertTrue($this->condition
      ->evaluate());
  }

}

Classes

Namesort descending Description
ContributedPluginDiscoveryTest Tests contributed plugin discovery by RulesIntegrationTestBase.