function ReactionRuleConfigTest::testAddEvent

@covers ::addEvent @covers ::getEvents

@dataProvider addEventDataProvider

File

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

Class

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

Namespace

Drupal\Tests\rules\Unit\Entity

Code

public function testAddEvent(array $expected, array $events_init, array $event_add) {
    $rule = $this->createRule([
        'events' => $events_init,
    ]);
    if (isset($event_add['configuration'])) {
        $this->assertSame($rule, $rule->addEvent($event_add['event_name'], $event_add['configuration']));
    }
    else {
        $this->assertSame($rule, $rule->addEvent($event_add['event_name']));
    }
    $this->assertSame($expected, $rule->getEvents());
}