HiddenTaxonomyTermReferenceFieldWizardTest.php in Drupal 10
File
core/modules/node/tests/src/Functional/Views/Wizard/HiddenTaxonomyTermReferenceFieldWizardTest.php
View source
<?php
namespace Drupal\Tests\node\Functional\Views\Wizard;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\views\Functional\Wizard\WizardTestBase;
class HiddenTaxonomyTermReferenceFieldWizardTest extends WizardTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'taxonomy',
];
public function testHiddenTaxonomyTermReferenceField() {
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$field_name = mb_strtolower($this
->randomMachineName());
FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => 'node',
'type' => 'entity_reference',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
'settings' => [
'target_type' => 'taxonomy_term',
],
])
->save();
FieldConfig::create([
'field_name' => $field_name,
'bundle' => 'article',
'entity_type' => 'node',
'settings' => [
'handler' => 'default',
],
])
->save();
$this
->drupalGet('admin/structure/views/add');
$this
->assertSession()
->statusCodeEquals(200);
}
}