You are here

protected function ExampleContentTrait::addTestEntity in Search API 8

Creates and saves a test entity with the given values.

Parameters

int $id: The entity's ID.

array $values: The entity's property values.

Return value

\Drupal\entity_test\Entity\EntityTestMulRevChanged The created entity.

10 calls to ExampleContentTrait::addTestEntity()
BackendTest::regressionTest2873023 in modules/search_api_db/tests/src/Kernel/BackendTest.php
Tests whether keywords with special characters work correctly.
BackendTest::regressionTest2916534 in modules/search_api_db/tests/src/Kernel/BackendTest.php
Tests edge cases for partial matching.
BackendTest::regressionTest3199355 in modules/search_api_db/tests/src/Kernel/BackendTest.php
Tests whether string field values with trailing spaces work correctly.
BackendTest::testDateIndexing in modules/search_api_db/tests/src/Kernel/BackendTest.php
Tests whether indexing of dates works correctly.
BackendTestBase::regressionTest1916474 in tests/src/Kernel/BackendTestBase.php
Regression tests for correctly indexing multiple float/decimal fields.

... See full list

File

tests/src/Functional/ExampleContentTrait.php, line 94

Class

ExampleContentTrait
Contains helpers to create data that can be used by tests.

Namespace

Drupal\Tests\search_api\Functional

Code

protected function addTestEntity($id, array $values) {
  $entity_type = 'entity_test_mulrev_changed';
  $storage = \Drupal::entityTypeManager()
    ->getStorage($entity_type);
  $values['id'] = $id;
  $this->entities[$id] = $storage
    ->create($values);
  $this->entities[$id]
    ->save();
  $this->ids[$id] = Utility::createCombinedId("entity:{$entity_type}", "{$id}:en");
  return $this->entities[$id];
}