function PackageManagerKernelTestBase::tearDown

Invokes the test preconditions assertion after each test run.

This ensures that no test method leaves behind violations of test preconditions. This makes it trivial to discover broken tests.

Overrides AssertPreconditionsTrait::tearDown

2 calls to PackageManagerKernelTestBase::tearDown()
ComposerValidatorTest::tearDown in core/modules/package_manager/tests/src/Kernel/ComposerValidatorTest.php
FixtureManipulatorTest::tearDown in core/modules/package_manager/tests/src/Kernel/FixtureManipulatorTest.php
@todo Remove the line below when https://github.com/phpstan/phpstan-phpunit/issues/187 is fixed. @phpstan-ignore-next-line
2 methods override PackageManagerKernelTestBase::tearDown()
ComposerValidatorTest::tearDown in core/modules/package_manager/tests/src/Kernel/ComposerValidatorTest.php
FixtureManipulatorTest::tearDown in core/modules/package_manager/tests/src/Kernel/FixtureManipulatorTest.php
@todo Remove the line below when https://github.com/phpstan/phpstan-phpunit/issues/187 is fixed. @phpstan-ignore-next-line

File

core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php, line 419

Class

PackageManagerKernelTestBase
Base class for kernel tests of Package Manager's functionality.

Namespace

Drupal\Tests\package_manager\Kernel

Code

protected function tearDown() : void {
  // Delete the test project root, which contains the active directory and
  // the stage directory. First, make it writable in case any permissions were
  // changed during the test.
  if ($this->testProjectRoot) {
    $this->fileSystem
      ->chmod($this->testProjectRoot, 0777, 00, TRUE);
    $this->fileSystem
      ->remove($this->testProjectRoot);
  }
  StageFixtureManipulator::handleTearDown();
  // Ensure no warnings (or worse) were logged by Package Manager.
  $this->assertFalse($this->failureLogger
    ->hasRecords(RfcLogLevel::EMERGENCY), 'Package Manager logged emergencies.');
  $this->assertFalse($this->failureLogger
    ->hasRecords(RfcLogLevel::ALERT), 'Package Manager logged alerts.');
  $this->assertFalse($this->failureLogger
    ->hasRecords(RfcLogLevel::CRITICAL), 'Package Manager logged critical errors.');
  $this->assertFalse($this->failureLogger
    ->hasRecords(RfcLogLevel::ERROR), 'Package Manager logged errors.');
  $this->assertFalse($this->failureLogger
    ->hasRecords(RfcLogLevel::WARNING), 'Package Manager logged warnings.');
  parent::tearDown();
}

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