Issue #2065917 by SpadXIII, andrewbelcher, kboopathi: SelectQueryExtender::hasAnyTag uses hasAnyTags which doesn't exist.

8.0.x
Alex Pott 2014-01-25 21:46:45 +01:00
parent 723e5ea563
commit 34bb38f84f
2 changed files with 47 additions and 1 deletions

View File

@ -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) {

View File

@ -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.
*