public function ConfigEntityCalculateDependencyTest::testBusinessRuleCalculateDependencies in Business Rules 8
Same name and namespace in other branches
- 2.x tests/src/Unit/ConfigEntityCalculateDependencyTest.php \Drupal\Tests\business_rules\Unit\ConfigEntityCalculateDependencyTest::testBusinessRuleCalculateDependencies()
@covers \Drupal\business_rules\Entity\BusinessRule::calculateDependencies
File
- tests/
src/ Unit/ ConfigEntityCalculateDependencyTest.php, line 119
Class
- ConfigEntityCalculateDependencyTest
- Test dependencies calculation.
Namespace
Drupal\Tests\business_rules\UnitCode
public function testBusinessRuleCalculateDependencies() {
$business_rule = new BusinessRule([]);
$dependencies = $business_rule
->calculateDependencies()
->getDependencies();
$this
->assertArrayNotHasKey('config', $dependencies);
$dependencyA = new BusinessRulesItemObject('test_action_a', 'action', 0);
$business_rule
->addItem($dependencyA);
$dependencies = $business_rule
->calculateDependencies()
->getDependencies();
$this
->assertEquals([
'business_rules.action.test_action_a',
], $dependencies['config']);
$dependencyB = new BusinessRulesItemObject('test_condition_a', 'condition', 0);
$business_rule
->addItem($dependencyB);
$dependencies = $business_rule
->calculateDependencies()
->getDependencies();
$this
->assertEquals([
'business_rules.action.test_action_a',
'business_rules.condition.test_condition_a',
], $dependencies['config']);
}