You are here

protected function FeaturesAssignTest::enableAssignmentMethod in Features 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/FeaturesAssignTest.php \Drupal\Tests\features\Kernel\FeaturesAssignTest::enableAssignmentMethod()

Enables a specified assignment method.

Parameters

string $method_id: The ID of an assignment method.

bool $exclusive: (optional) Whether to set the method as the only enabled method. Defaults to TRUE.

12 calls to FeaturesAssignTest::enableAssignmentMethod()
FeaturesAssignTest::testAssignAlter in tests/src/Kernel/FeaturesAssignTest.php
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentAlter
FeaturesAssignTest::testAssignBase in tests/src/Kernel/FeaturesAssignTest.php
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentBaseType
FeaturesAssignTest::testAssignCore in tests/src/Kernel/FeaturesAssignTest.php
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentCoreType
FeaturesAssignTest::testAssignDependency in tests/src/Kernel/FeaturesAssignTest.php
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentDependency
FeaturesAssignTest::testAssignExclude in tests/src/Kernel/FeaturesAssignTest.php
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentExclude

... See full list

File

tests/src/Kernel/FeaturesAssignTest.php, line 827

Class

FeaturesAssignTest
The Feature Assign test.

Namespace

Drupal\Tests\features\Kernel

Code

protected function enableAssignmentMethod($method_id, $exclusive = TRUE) {
  if ($exclusive) {
    $this->bundle
      ->setEnabledAssignments([
      $method_id,
    ]);
  }
  else {
    $enabled = array_keys($this->bundle
      ->getEnabledAssignments());
    $enabled[] = $method_id;
    $this->bundle
      ->setEnabledAssignments($enabled);
  }
}