Skip to content
Snippets Groups Projects
Verified Commit 999d5671 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2254187 by smustgrave, NickDickinsonWilde, markdorison, andregp: Fix...

Issue #2254187 by smustgrave, NickDickinsonWilde, markdorison, andregp: Fix test performance of Drupal\node\Tests\NodeAccessBaseTableTest
parent 6cbea8d6
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,11 @@
namespace Drupal\Tests\node\Functional;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\node\Entity\NodeType;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
/**
* Tests behavior of the node access subsystem if the base table is not node.
......@@ -11,27 +15,25 @@
*/
class NodeAccessBaseTableTest extends NodeTestBase {
use EntityReferenceTestTrait;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = ['node_access_test', 'views'];
protected static $modules = [
'node_access_test',
'views',
'taxonomy',
'search',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The installation profile to use with this test.
*
* This test class requires the "tags" taxonomy field.
*
* @var string
*/
protected $profile = 'standard';
/**
* Nodes by user.
*
......@@ -68,6 +70,33 @@ class NodeAccessBaseTableTest extends NodeTestBase {
protected function setUp(): void {
parent::setUp();
// Create the vocabulary for the tag field.
$vocabulary = Vocabulary::create([
'name' => 'Tags',
'vid' => 'tags',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]);
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
$handler_settings = [
'target_bundles' => [
$vocabulary->id() => $vocabulary->id(),
],
'auto_create' => TRUE,
];
$this->createEntityReferenceField('node', 'article', $field_name, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
$entity_type_manager = $this->container->get('entity_type.manager');
$entity_type_manager
->getStorage('entity_form_display')
->load('node.article.default')
->setComponent($field_name, [
'type' => 'entity_reference_autocomplete_tags',
'weight' => -4,
])
->save();
node_access_test_add_field(NodeType::load('article'));
node_access_rebuild();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment