protected function MetatagImportTest::setUp in Metatag Import Export CSV 8
Overrides EntityKernelTestBase::setUp
File
- tests/
src/ Kernel/ MetatagImportTest.php, line 44
Class
- MetatagImportTest
- Tests importing CSV data.
Namespace
Drupal\Tests\metatag_import_export_csv\KernelCode
protected function setUp() : void {
parent::setUp();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this
->installSchema('node', 'node_access');
$this
->installEntitySchema('node');
$this
->installEntitySchema('path_alias');
$this
->installConfig([
'language',
]);
ConfigurableLanguage::createFromLangcode('fr')
->save();
// Setup an anonymous user, so URL operations work.
// See https://www.drupal.org/project/drupal/issues/3056234.
$this->entityTypeManager
->getStorage('user')
->create([
'name' => '',
'uid' => 0,
])
->save();
// Create the node type.
$node_type_storage = $this->entityTypeManager
->getStorage('node_type');
$type = $node_type_storage
->create([
'type' => 'page',
'name' => 'Page',
]);
$type
->save();
// Create the metatags field.
$field_name = 'field_metatags';
$this->entityTypeManager
->getStorage('field_storage_config')
->create([
'field_name' => $field_name,
'entity_type' => 'node',
'type' => 'metatag',
])
->save();
$this->entityTypeManager
->getStorage('field_config')
->create([
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => 'page',
])
->save();
}