function BrokenSetUpTest::tearDown

Overrides WebTestBase::tearDown

File

core/modules/simpletest/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.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.