function ReactionRuleConfigTest::testRemoveEvent

@covers ::removeEvent @covers ::getEvents

File

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

Class

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

Namespace

Drupal\Tests\rules\Unit\Entity

Code

public function testRemoveEvent() {
    // Create a rule with a few events.
    $rule = $this->createRule([
        'events' => [
            [
                'event_name' => 'foo',
            ],
            [
                'event_name' => 'bar',
                'configuration' => [
                    'qux' => 'baz',
                ],
            ],
        ],
    ]);
    $this->assertSame($rule, $rule->removeEvent('bar'));
    $this->assertSame([
        [
            'event_name' => 'foo',
        ],
    ], $rule->getEvents());
}