function EntityQueryTest::testMetaData

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php \Drupal\KernelTests\Core\Entity\EntityQueryTest::testMetaData()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php \Drupal\KernelTests\Core\Entity\EntityQueryTest::testMetaData()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php \Drupal\KernelTests\Core\Entity\EntityQueryTest::testMetaData()

Test adding a tag and metadata to the Entity query object.

The tags and metadata should propagate to the SQL query object.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php, line 735

Class

EntityQueryTest
Tests Entity Query functionality.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testMetaData() {
    $query = $this->storage
        ->getQuery();
    $query->addTag('efq_metadata_test')
        ->addMetaData('foo', 'bar')
        ->execute();
    global $efq_test_metadata;
    $this->assertEqual($efq_test_metadata, 'bar', 'Tag and metadata propagated to the SQL query object.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.