You are here

protected function ExistenceCheckingTest::getContentAttributes in YAML Content 8

Helper function to provide content attributes based on active test data.

Parameters

string $entity_type: The entity type ID.

array $content_data: Content data array being tested.

Return value

array Test content grouped by properties and fields according to test entity definitions.

See also

\Drupal\Tests\yaml_content\Unit\ContentLoader\ExistenceCheckingTest::$testEntityDefinitions

2 calls to ExistenceCheckingTest::getContentAttributes()
ExistenceCheckingTest::testCreateEntityDoesCallEntityExistsWhenEnabled in tests/src/Unit/ContentLoader/ExistenceCheckingTest.php
Confirm createEntity does check for existing entities when enabled.
ExistenceCheckingTest::testCreateEntityDoesNotCallEntityExistsWhenDisabled in tests/src/Unit/ContentLoader/ExistenceCheckingTest.php
Confirm createEntity doesn't check for existing entities when disabled.

File

tests/src/Unit/ContentLoader/ExistenceCheckingTest.php, line 383

Class

ExistenceCheckingTest
Test the existence checking functionality of the ContentLoader class.

Namespace

Drupal\Tests\yaml_content\Unit\ContentLoader

Code

protected function getContentAttributes($entity_type, array $content_data) {
  $attributes = [];
  $attributes['property'] = array_intersect_key($content_data, $this->testEntityDefinitions[$entity_type]['entity_keys']);
  $attributes['field'] = array_intersect_key($content_data, $this->testEntityDefinitions[$entity_type]['fields']);
  return $attributes;
}