You are here

protected function BrokenSetUpTest::tearDown in SimpleTest 8.3

Cleans up after testing.

Deletes created files and temporary files directory, deletes the tables created by setUp(), and resets the database prefix.

Overrides WebTestBase::tearDown

File

src/Tests/BrokenSetUpTest.php, line 58

Class

BrokenSetUpTest
Tests a test case that does not call parent::setUp().

Namespace

Drupal\simpletest\Tests

Code

protected function tearDown() {

  // If the test is being run from the main site, tear down normally.
  if (!$this
    ->isInChildSite()) {
    unlink($this->sharedTriggerFile);
    parent::tearDown();
  }
  else {
    if (file_get_contents($this->sharedTriggerFile) === 'teardown') {
      throw new \Exception('Broken teardown');
    }
    $this
      ->pass('The tearDown() method has run.');
  }
}