public function SearchApiSolrLocationTest::insertExampleContent in Search API Solr 8
Same name and namespace in other branches
- 8.3 tests/src/Kernel/SearchApiSolrLocationTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrLocationTest::insertExampleContent()
- 8.2 tests/src/Kernel/SearchApiSolrLocationTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrLocationTest::insertExampleContent()
- 4.x tests/src/Kernel/SearchApiSolrLocationTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrLocationTest::insertExampleContent()
Creates several test entities.
Overrides ExampleContentTrait::insertExampleContent
1 call to SearchApiSolrLocationTest::insertExampleContent()
- SearchApiSolrLocationTest::commonSolrBackendSetUp in tests/
src/ Kernel/ SearchApiSolrLocationTest.php - Required parts of the setUp() function that are the same for all backends.
File
- tests/
src/ Kernel/ SearchApiSolrLocationTest.php, line 162
Class
- SearchApiSolrLocationTest
- Tests location searches and distance facets using the Solr search backend.
Namespace
Drupal\Tests\search_api_solr\KernelCode
public function insertExampleContent() {
$this
->addTestEntity(1, [
'name' => 'London',
'body' => 'London',
'type' => 'item',
'location' => 'POINT(-0.076132 51.508530)',
]);
$this
->addTestEntity(2, [
'name' => 'New York',
'body' => 'New York',
'type' => 'item',
'location' => 'POINT(-73.138260 40.792240)',
]);
$this
->addTestEntity(3, [
'name' => 'Brussels',
'body' => 'Brussels',
'type' => 'item',
'location' => 'POINT(4.355607 50.878899)',
]);
$count = \Drupal::entityQuery('entity_test_mulrev_changed')
->count()
->execute();
$this
->assertEquals(3, $count, "{$count} items inserted.");
}