You are here

private function VisibilityTest::createGroup in Block Visibility Groups 8

Helper to create a block visibility group.

Parameters

array $configs: An array of condition config.

Return value

static

1 call to VisibilityTest::createGroup()
VisibilityTest::testSingleConditions in src/Tests/VisibilityTest.php

File

src/Tests/VisibilityTest.php, line 104

Class

VisibilityTest
Tests the block_visibility_groups Visibility Settings.

Namespace

Drupal\block_visibility_groups\Tests

Code

private function createGroup(array $configs) {
  $group = BlockVisibilityGroup::create([
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomString(),
  ]);
  $group
    ->save();
  foreach ($configs as $config) {
    $group
      ->addCondition($config);
  }
  $group
    ->save();
  return $group;
}