public function FixtureTest::testFixtureCreateFiles in Mini site 8
Test fixtureCreateFiles() method.
File
- tests/
src/ Unit/ FixtureTest.php, line 67
Class
- FixtureTest
- Class FixtureTest.
Namespace
Drupal\Tests\minisite\UnitCode
public function testFixtureCreateFiles() {
// @codingStandardsIgnoreStart
$files = [
'dir1',
'file1' => 'content1',
'dir2/file21' => 'content21',
'dir2/file22' => 'content22',
'dir3/dir31/dir/311',
];
// @codingStandardsIgnoreEnd
$expected_files = [
$this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir1' => 'dir1',
$this->fixtureDir . \DIRECTORY_SEPARATOR . 'file1' => 'file1',
$this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir2/file21' => 'dir2/file21',
$this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir2/file22' => 'dir2/file22',
$this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir3/dir31/dir/311' => 'dir3/dir31/dir/311',
];
$actual_files = $this
->fixtureCreateFiles($files);
$this
->assertEquals($expected_files, $actual_files);
$this
->assertDirectoryExists($this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir1');
$this
->assertFileExists($this->fixtureDir . \DIRECTORY_SEPARATOR . 'file1');
$this
->assertStringEqualsFile($this->fixtureDir . \DIRECTORY_SEPARATOR . 'file1', 'content1');
$this
->assertStringEqualsFile($this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir2/file21', 'content21');
$this
->assertStringEqualsFile($this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir2/file22', 'content22');
$this
->assertDirectoryExists($this->fixtureDir . \DIRECTORY_SEPARATOR . 'dir3/dir31/dir/311');
}