function PackageManagerKernelTestBase::addEventTestListener

Adds an event listener on an event for testing purposes.

Parameters

callable $listener: The listener to add.

string $event_class: (optional) The event to listen to. Defaults to PreApplyEvent.

int $priority: (optional) The priority. Defaults to PHP_INT_MAX.

22 calls to PackageManagerKernelTestBase::addEventTestListener()
DiskSpaceValidatorTest::testDiskSpaceValidationDuringPreApply in core/modules/package_manager/tests/src/Kernel/DiskSpaceValidatorTest.php
Tests disk space validation during pre-apply.
EnvironmentSupportValidatorTest::testInvalidUrlDuringPreApply in core/modules/package_manager/tests/src/Kernel/EnvironmentSupportValidatorTest.php
Tests an invalid URL in the environment support variable during pre-apply.
EnvironmentSupportValidatorTest::testValidUrlDuringPreApply in core/modules/package_manager/tests/src/Kernel/EnvironmentSupportValidatorTest.php
Tests that the validation message links to the provided URL during pre-apply.
LockFileValidatorTest::testLockFileChanged in core/modules/package_manager/tests/src/Kernel/LockFileValidatorTest.php
Tests validation when the lock file has changed.
LockFileValidatorTest::testLockFileDeleted in core/modules/package_manager/tests/src/Kernel/LockFileValidatorTest.php
Tests validation when the lock file is deleted.

... See full list

File

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

Class

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

Namespace

Drupal\Tests\package_manager\Kernel

Code

protected function addEventTestListener(callable $listener, string $event_class = PreApplyEvent::class, int $priority = PHP_INT_MAX) : void {
    $this->container
        ->get('event_dispatcher')
        ->addListener($event_class, $listener, $priority);
}

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