You are here

public function IndividualExportImportTest::testExportEmptyFiles in Configuration Split 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/IndividualExportImportTest.php \Drupal\Tests\config_split\Kernel\IndividualExportImportTest::testExportEmptyFiles()

Test exporting when there is no files in the system.

File

tests/src/Kernel/IndividualExportImportTest.php, line 115

Class

IndividualExportImportTest
Test the export and import of individual splits.

Namespace

Drupal\Tests\config_split\Kernel

Code

public function testExportEmptyFiles() {

  // At the beginning all folders are empty.
  static::assertEmpty($this
    ->getSyncFileStorage()
    ->listAll());
  static::assertEmpty($this
    ->getSyncFileStorage()
    ->getAllCollectionNames());
  static::assertEmpty($this
    ->getSplitSourceStorage($this->split)
    ->listAll());
  static::assertEmpty($this
    ->getSplitSourceStorage($this->split)
    ->getAllCollectionNames());
  static::assertEmpty($this
    ->getSplitPreviewStorage($this->split)
    ->listAll());
  static::assertEmpty($this
    ->getSplitPreviewStorage($this->split)
    ->getAllCollectionNames());

  // Do the export.
  $this->container
    ->get('config_split.cli')
    ->ioExport($this->split
    ->getName(), $this->io, $this->t);

  // The sync storage is still empty.
  static::assertEmpty($this
    ->getSyncFileStorage()
    ->listAll());
  static::assertEmpty($this
    ->getSyncFileStorage()
    ->getAllCollectionNames());

  // The split is successfully exported.
  static::assertStorageEquals($this
    ->getSplitExpectationStorage(), $this
    ->getSplitSourceStorage($this->split));

  // Check the IO, but we skip checking the confirmation message.
  static::assertCount(2, $this->io->calls);
  static::assertEquals([
    'confirm',
  ], array_keys($this->io->calls[0]));
  static::assertEquals([
    'success' => [
      'Configuration successfully exported.',
    ],
  ], $this->io->calls[1]);
}