function ContentExportTest::doTestExportSingleEntityToDirectory
Tests exporting a single entity to a directory with attachments.
1 call to ContentExportTest::doTestExportSingleEntityToDirectory()
- ContentExportTest::testEntityExportScenarios in core/
tests/ Drupal/ FunctionalTests/ DefaultContent/ ContentExportTest.php - Tests various entity export scenarios.
File
-
core/
tests/ Drupal/ FunctionalTests/ DefaultContent/ ContentExportTest.php, line 208
Class
- ContentExportTest
- Tests exporting content in YAML format.
Namespace
Drupal\FunctionalTests\DefaultContentCode
protected function doTestExportSingleEntityToDirectory() : void {
$file = $this->container
->get(EntityRepositoryInterface::class)
->loadEntityByUuid('file', '7fb09f9f-ba5f-4db4-82ed-aa5ccf7d425d');
$this->assertInstanceOf(File::class, $file);
$dir = 'public://export-content';
$process = $this->runDrupalCommand([
'content:export',
'file',
$file->id(),
"--dir={$dir}",
]);
$this->assertSame(0, $process->wait());
$this->assertStringContainsString('One entity was exported to', $process->getOutput());
$this->assertFileExists($dir . '/file/' . $file->uuid() . '.yml');
$this->assertFileExists($dir . '/file/' . $file->getFilename());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.