Commit 749f7ea1 authored by catch's avatar catch

Issue #2254211 by sun: Fix test performance of Drupal\taxonomy\Tests\LegacyTest.

parent 6ae2108c
......@@ -8,13 +8,19 @@
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Field\FieldDefinitionInterface;
/**
* Test for legacy node bug.
*/
class LegacyTest extends TaxonomyTestBase {
protected $profile = 'standard';
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node', 'datetime');
public static function getInfo() {
return array(
......@@ -26,6 +32,42 @@ public static function getInfo() {
function setUp() {
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Tags',
'vid' => 'tags',
));
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
entity_create('field_config', array(
'name' => $field_name,
'entity_type' => 'node',
'type' => 'taxonomy_term_reference',
'cardinality' => FieldDefinitionInterface::CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $vocabulary->id(),
'parent' => 0,
),
),
),
))->save();
entity_create('field_instance_config', array(
'entity_type' => 'node',
'field_name' => $field_name,
'bundle' => 'article',
'label' => 'Tags',
))->save();
entity_get_form_display('node', 'article', 'default')
->setComponent($field_name, array(
'type' => 'taxonomy_autocomplete',
))
->save();
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'administer nodes', 'bypass node access'));
$this->drupalLogin($this->admin_user);
}
......
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