Commit 34bb38f8 authored by alexpott's avatar alexpott

Issue #2065917 by SpadXIII, andrewbelcher, kboopathi:...

Issue #2065917 by SpadXIII, andrewbelcher, kboopathi: SelectQueryExtender::hasAnyTag uses hasAnyTags which doesn't exist.
parent 723e5ea5
......@@ -74,7 +74,7 @@ public function hasAllTags() {
}
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 @@ function testHasAnyTag() {
$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.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment