function ImporterTest::testChangeDataOnImport
Tests changing entity data upon import.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ DefaultContent/ ImporterTest.php, line 75
Class
- ImporterTest
- Tests the Default Content Importer.
Namespace
Drupal\KernelTests\Core\DefaultContentCode
public function testChangeDataOnImport() : void {
$this->setUpCurrentUser(admin: TRUE);
$finder = new Finder($this->getDrupalRoot() . '/core/tests/fixtures/pre_entity_import_default_content');
$this->container
->get(Importer::class)
->importContent($finder);
$entity = $this->container
->get(EntityRepositoryInterface::class)
->loadEntityByUuid('entity_test', '01234567-89ab-cdef-0123-456789abcdef');
self::assertSame('Changed name', $entity?->label());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.