class StatusCheckTraitTest
@covers \Drupal\package_manager\StatusCheckTrait @group package_manager @internal
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait
- class \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase extends \Drupal\KernelTests\KernelTestBase uses \Drupal\Tests\package_manager\Traits\AssertPreconditionsTrait, \Drupal\Tests\package_manager\Traits\ComposerStagerTestTrait, \Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait, \Drupal\Tests\package_manager\Traits\FixtureUtilityTrait, \Drupal\package_manager\StatusCheckTrait, \Drupal\Tests\package_manager\Traits\ValidationTestTrait
- class \Drupal\Tests\package_manager\Kernel\StatusCheckTraitTest extends \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase uses \Drupal\package_manager\StatusCheckTrait
- class \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase extends \Drupal\KernelTests\KernelTestBase uses \Drupal\Tests\package_manager\Traits\AssertPreconditionsTrait, \Drupal\Tests\package_manager\Traits\ComposerStagerTestTrait, \Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait, \Drupal\Tests\package_manager\Traits\FixtureUtilityTrait, \Drupal\package_manager\StatusCheckTrait, \Drupal\Tests\package_manager\Traits\ValidationTestTrait
Expanded class hierarchy of StatusCheckTraitTest
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ StatusCheckTraitTest.php, line 17
Namespace
Drupal\Tests\package_manager\KernelView source
class StatusCheckTraitTest extends PackageManagerKernelTestBase {
use StatusCheckTrait;
/**
* Tests that StatusCheckTrait will collect paths to exclude.
*/
public function testPathsToExcludeCollected() : void {
$this->addEventTestListener(function (CollectPathsToExcludeEvent $event) : void {
$event->add('/junk/drawer');
}, CollectPathsToExcludeEvent::class);
$status_check_called = FALSE;
$this->addEventTestListener(function (StatusCheckEvent $event) use (&$status_check_called) : void {
$this->assertContains('/junk/drawer', $event->excludedPaths
->getAll());
$status_check_called = TRUE;
}, StatusCheckEvent::class);
$this->runStatusCheck($this->createStage(), $this->container
->get('event_dispatcher'));
$this->assertTrue($status_check_called);
}
/**
* Tests that any error will be added to the status check event.
*/
public function testNoErrorIfPathsToExcludeCannotBeCollected() : void {
$e = new \Exception('Not a chance, friend.');
$listener = function () use ($e) : never {
throw $e;
};
$this->addEventTestListener($listener, CollectPathsToExcludeEvent::class);
$excluded_paths_are_null = FALSE;
$listener = function (StatusCheckEvent $event) use (&$excluded_paths_are_null) : void {
$excluded_paths_are_null = is_null($event->excludedPaths);
};
$this->addEventTestListener($listener, StatusCheckEvent::class);
$this->assertStatusCheckResults([
ValidationResult::createErrorFromThrowable($e),
]);
$this->assertTrue($excluded_paths_are_null);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.