You are here

protected function RequestQueryArgumentResolverTest::getTestEntityProperties in Organic groups 8

Returns properties used to create mock test entities.

This is used to facilitate referring to entities in data providers. Since a data provider is called before the test setup runs, we cannot return actual entities in the data provider. Instead the data provider can refer to these test entities by ID, and the actual entity mocks will be generated in the test setup.

The test groups should be declared first, the group content last.

Return value

array An array of entity metadata, keyed by test entity ID. Each item is an array with the following keys:

  • type (required): The entity type ID.
  • bundle (required): The entity bundle.
  • group (optional): Whether or not the entity is a group.
  • group_content (optional): An array containing IDs of groups this group content belongs to.

Overrides OgGroupResolverTestBase::getTestEntityProperties

1 call to RequestQueryArgumentResolverTest::getTestEntityProperties()
RequestQueryArgumentResolverTest::testResolve in tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php
@covers ::resolve @dataProvider resolveProvider

File

tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php, line 153

Class

RequestQueryArgumentResolverTest
Tests the RequestQueryArgumentResolver plugin.

Namespace

Drupal\Tests\og\Unit\Plugin\OgGroupResolver

Code

protected function getTestEntityProperties() {
  return [
    // A test group.
    'group-0' => [
      'type' => 'node',
      'bundle' => 'group',
      'group' => TRUE,
    ],
    // Another test group.
    'group-1' => [
      'type' => 'taxonomy_term',
      'bundle' => 'assembly',
      'group' => TRUE,
    ],
    // A group content entity.
    'group_content' => [
      'type' => 'entity_test',
      'bundle' => 'content',
      'group_content' => [
        'group-0',
      ],
    ],
    // An entity that is not a group nor group content.
    'non_group' => [
      'type' => 'entity_test',
      'bundle' => 'non_group',
    ],
  ];
}