Commit ab22b87b authored by alexpott's avatar alexpott

Issue #2024111 by followup damiankloip, Berdir: Fixed TaxonomyIndexTid filter...

Issue #2024111 by followup damiankloip, Berdir: Fixed TaxonomyIndexTid filter handler autocomplete does not work.
parent d0d18177
......@@ -7,22 +7,44 @@
namespace Drupal\views\Tests;
use Drupal\taxonomy\Tests\Views\TaxonomyTestBase;
use Drupal\views\Tests\ViewTestBase;
use Drupal\Component\Utility\MapArray;
use Drupal\Core\Language\Language;
/**
* Tests the views taxonomy complete menu callback.
*
* @see views_ajax_autocomplete_taxonomy()
*/
class ViewsTaxonomyAutocompleteTest extends TaxonomyTestBase {
class ViewsTaxonomyAutocompleteTest extends ViewTestBase {
/**
* The taxonomy vocabulary created for this test.
*
* @var \Drupal\taxonomy\VocabularyInterface
*/
protected $vocabulary;
/**
* Stores the first term used in the different tests.
*
* @var \Drupal\taxonomy\TermInterface
*/
protected $term1;
/**
* Stores the second term used in the different tests.
*
* @var \Drupal\taxonomy\TermInterface
*/
protected $term2;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('views');
public static $modules = array('taxonomy');
public static function getInfo() {
return array(
......@@ -32,6 +54,20 @@ public static function getInfo() {
);
}
public function setUp() {
parent::setUp();
// Create the vocabulary for the tag field.
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Views testing tags',
'vid' => 'views_testing_tags',
));
$this->vocabulary->save();
$this->term1 = $this->createTerm('term');
$this->term2 = $this->createTerm('another');
}
/**
* Tests the views_ajax_autocomplete_taxonomy() AJAX callback.
*/
......@@ -52,4 +88,24 @@ public function testTaxonomyAutocomplete() {
$this->assertIdentical($expected, $this->drupalGetJSON($base_autocomplete_path, array('query' => array('q' => $partial))));
}
/**
* Returns a new term with random properties.
*
* @param string $name
* (optional) The name of the taxonomy term.
*
* @return \Drupal\taxonomy\Plugin\Core\Entity\Term
* The created taxonomy term.
*/
protected function createTerm($name = NULL) {
$term = entity_create('taxonomy_term', array(
'name' => $name ?: $this->randomName(),
'description' => $this->randomName(),
'vid' => $this->vocabulary->id(),
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
));
$term->save();
return $term;
}
}
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