function TaggingTest::testExtenderHasAllTags

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

Tests extended query tagging "has all of these tags" functionality.

File

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

Class

TaggingTest
Tests the tagging capabilities of the Select builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testExtenderHasAllTags() {
    $query = $this->connection
        ->select('test')
        ->extend('Drupal\\Core\\Database\\Query\\SelectExtender');
    $query->addField('test', 'name');
    $query->addField('test', 'age', 'age');
    $query->addTag('test');
    $query->addTag('other');
    $this->assertTrue($query->hasAllTags('test', 'other'), 'hasAllTags() returned true.');
    $this->assertFalse($query->hasAllTags('test', 'stuff'), 'hasAllTags() returned false.');
}

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