You are here

public function FixtureTest::testFixtureCreateArchive in Mini site 8

Test fixtureCreateArchive() method.

File

tests/src/Unit/FixtureTest.php, line 100

Class

FixtureTest
Class FixtureTest.

Namespace

Drupal\Tests\minisite\Unit

Code

public function testFixtureCreateArchive() {

  // @codingStandardsIgnoreStart
  $files = [
    'dir1',
    'file1' => 'content1',
    'dir2/file21' => 'content21',
    'dir2/file22' => 'content22',
    'dir3/dir31/dir/311',
  ];

  // @codingStandardsIgnoreEnd
  $expected_files = [
    'dir1/',
    'file1',
    'dir2/file21',
    'dir2/file22',
    'dir3/dir31/dir/311/',
  ];
  $archive_filename = $this
    ->fixtureCreateArchive($files, 'zip');
  $this
    ->assertFileExists($archive_filename);
  $archive = new Zip($archive_filename);
  $actual_files = $archive
    ->listContents();
  sort($expected_files);
  sort($actual_files);
  $this
    ->assertEquals($expected_files, $actual_files);
}