function StatusCheckTraitTest::testNoErrorIfPathsToExcludeCannotBeCollected

Tests that any error will be added to the status check event.

File

core/modules/package_manager/tests/src/Kernel/StatusCheckTraitTest.php, line 41

Class

StatusCheckTraitTest
@covers \Drupal\package_manager\StatusCheckTrait @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

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.