public function FixtureTest::testSetupTeardown in Mini site 8
Test SetUp and TearDown methods for the trait.
File
- tests/
src/ Unit/ FixtureTest.php, line 42
Class
- FixtureTest
- Class FixtureTest.
Namespace
Drupal\Tests\minisite\UnitCode
public function testSetupTeardown() {
// $fixtureDir is already populated from the setUp() of this test,
// so we need to remove it.
$fs = new Filesystem();
$fs
->remove($this->fixtureDir);
$this
->fixtureSetUp();
$first_dir = $this->fixtureDir;
$this
->assertNotEmpty($first_dir, 'fixtureSetUp() populates $fixtureDir variable');
$this
->assertDirectoryExists($first_dir, 'fixtureSetUp() creates directory');
$this
->fixtureSetUp();
$second_dir = $this->fixtureDir;
$this
->assertNotEmpty($second_dir, 'fixtureSetUp() populates $fixtureDir variable');
$this
->assertDirectoryExists($second_dir, 'fixtureSetUp() creates directory');
$this
->assertNotEquals($first_dir, $second_dir, 'fixtureSetUp() creates new directory on every call');
$this
->fixtureTearDown();
$this
->assertDirectoryNotExists($second_dir, 'fixtureTearDown() removes directory');
$this
->assertEmpty($this->fixtureDir, 'fixtureTearDown() removes the value from $fixtureDir');
}