function TestSubscriber::setTestResult

Sets validation results for a specific event.

This method is static to enable setting the expected results before this module is enabled.

Parameters

\Drupal\package_manager\ValidationResult[]|null $results: The validation results, or NULL to delete stored results.

string $event: The event class.

File

core/modules/package_manager/tests/modules/package_manager_test_validation/src/EventSubscriber/TestSubscriber.php, line 71

Class

TestSubscriber
Defines an event subscriber for testing validation of Package Manager events.

Namespace

Drupal\package_manager_test_validation\EventSubscriber

Code

public static function setTestResult(?array $results, string $event) : void {
    $key = static::getStateKey($event);
    $state = \Drupal::state();
    if (isset($results)) {
        $state->set($key, $results);
    }
    else {
        $state->delete($key);
    }
}

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