function ReactionRuleConfigTest::testHasEvent

@covers ::hasEvent

File

tests/src/Unit/Entity/ReactionRuleConfigTest.php, line 122

Class

ReactionRuleConfigTest
@coversDefaultClass \Drupal\rules\Entity\ReactionRuleConfig @group Rules

Namespace

Drupal\Tests\rules\Unit\Entity

Code

public function testHasEvent() {
    // Create a rule with a few events.
    $rule = $this->createRule([
        'events' => [
            [
                'event_name' => 'foo',
            ],
            [
                'event_name' => 'bar',
                'configuration' => [
                    'qux' => 'baz',
                ],
            ],
        ],
    ]);
    $this->assertTrue($rule->hasEvent('foo'));
    $this->assertTrue($rule->hasEvent('bar'));
    $this->assertFalse($rule->hasEvent('qux'));
    $this->assertFalse($rule->hasEvent('baz'));
}