You are here

protected function BrokenSetUpTest::tearDown in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/Tests/BrokenSetUpTest.php \Drupal\simpletest\Tests\BrokenSetUpTest::tearDown()

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

core/modules/simpletest/src/Tests/BrokenSetUpTest.php, line 61
Contains \Drupal\simpletest\Tests\BrokenSetUpTest.

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.');
  }
}