Skip to content

Commit

Permalink
Update test scripts for improved coverage.
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Dec 23, 2024
1 parent 962331f commit f9c8d63
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Models/AutomationRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,20 @@
expect(callProtectedMethod($rule, 'checkConditions', [[]]))->toBeFalse();
});

it('deletes relationships when deleting automation rule', function() {
$automationRule = AutomationRule::create(['event_class' => TestEvent::class]);
$automationRule->conditions()->save(RuleCondition::create(['class_name' => TestCondition::class]));
$automationRule->actions()->save(RuleAction::create(['class_name' => TestAction::class]));
$automationRule->logs()->save(AutomationLog::create());

$automationRule->delete();

$this->assertDatabaseCount('igniter_automation_rules', 0);
$this->assertDatabaseCount('igniter_automation_rule_conditions', 0);
$this->assertDatabaseCount('igniter_automation_rule_actions', 0);
$this->assertDatabaseCount('igniter_automation_logs', 0);
});

it('configures automation rule model correctly', function() {
$automationRule = new AutomationRule;

Expand Down

0 comments on commit f9c8d63

Please sign in to comment.