public function EntityQueryTest::testBaseFieldMultipleColumns in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php \Drupal\KernelTests\Core\Entity\EntityQueryTest::testBaseFieldMultipleColumns()
Test base fields with multiple columns.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityQueryTest.php, line 968
Class
- EntityQueryTest
- Tests Entity Query functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testBaseFieldMultipleColumns() {
$this
->enableModules([
'taxonomy',
]);
$this
->installEntitySchema('taxonomy_term');
Vocabulary::create([
'vid' => 'tags',
]);
$term1 = Term::create([
'name' => $this
->randomMachineName(),
'vid' => 'tags',
'description' => [
'value' => $this
->randomString(),
'format' => 'format1',
],
]);
$term1
->save();
$term2 = Term::create([
'name' => $this
->randomMachineName(),
'vid' => 'tags',
'description' => [
'value' => $this
->randomString(),
'format' => 'format2',
],
]);
$term2
->save();
$ids = $this->container
->get('entity_type.manager')
->getStorage('taxonomy_term')
->getQuery()
->condition('description.format', 'format1')
->execute();
$this
->assertCount(1, $ids);
$this
->assertEqual($term1
->id(), reset($ids));
}