You are here

public function TaggingTest::testExtenderHasTag in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/TaggingTest.php \Drupal\KernelTests\Core\Database\TaggingTest::testExtenderHasTag()

Confirms that an extended query has a tag added to it.

File

core/tests/Drupal/KernelTests/Core/Database/TaggingTest.php, line 63

Class

TaggingTest
Tests the tagging capabilities of the Select builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testExtenderHasTag() {
  $query = $this->connection
    ->select('test')
    ->extend(SelectExtender::class);
  $query
    ->addField('test', 'name');
  $query
    ->addField('test', 'age', 'age');
  $query
    ->addTag('test');
  $this
    ->assertTrue($query
    ->hasTag('test'), 'hasTag() returned true.');
  $this
    ->assertFalse($query
    ->hasTag('other'), 'hasTag() returned false.');
}