Issue #2065917 by SpadXIII, andrewbelcher, kboopathi: SelectQueryExtender::hasAnyTag uses hasAnyTags which doesn't exist.
parent
723e5ea563
commit
34bb38f84f
|
@ -74,7 +74,7 @@ class SelectExtender implements SelectInterface {
|
|||
}
|
||||
|
||||
public function hasAnyTag() {
|
||||
return call_user_func_array(array($this->query, 'hasAnyTags'), func_get_args());
|
||||
return call_user_func_array(array($this->query, 'hasAnyTag'), func_get_args());
|
||||
}
|
||||
|
||||
public function addMetaData($key, $object) {
|
||||
|
|
|
@ -66,6 +66,52 @@ class TaggingTest extends DatabaseTestBase {
|
|||
$this->assertFalse($query->hasAnyTag('other', 'stuff'), 'hasAnyTag() returned false.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that an extended query has a tag added to it.
|
||||
*/
|
||||
function testExtenderHasTag() {
|
||||
$query = db_select('test')
|
||||
->extend('Drupal\Core\Database\Query\SelectExtender');
|
||||
$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.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests extended query tagging "has all of these tags" functionality.
|
||||
*/
|
||||
function testExtenderHasAllTags() {
|
||||
$query = db_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.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests extended query tagging "has at least one of these tags" functionality.
|
||||
*/
|
||||
function testExtenderHasAnyTag() {
|
||||
$query = db_select('test')
|
||||
->extend('Drupal\Core\Database\Query\SelectExtender');
|
||||
$query->addField('test', 'name');
|
||||
$query->addField('test', 'age', 'age');
|
||||
|
||||
$query->addTag('test');
|
||||
|
||||
$this->assertTrue($query->hasAnyTag('test', 'other'), 'hasAnyTag() returned true.');
|
||||
$this->assertFalse($query->hasAnyTag('other', 'stuff'), 'hasAnyTag() returned false.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that we can attach metadata to a query object.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue