function BaseRequirementsFulfilledValidatorTest::testBaseRequirement

Tests that base requirement failures stop event propagation.

@dataProvider providerBaseRequirement

Parameters

string $event_class: The event which should raise a base requirement error, and thus stop event propagation.

File

core/modules/package_manager/tests/src/Kernel/BaseRequirementsFulfilledValidatorTest.php, line 77

Class

BaseRequirementsFulfilledValidatorTest
@covers \Drupal\package_manager\Validator\BaseRequirementsFulfilledValidator @covers \Drupal\package_manager\Validator\BaseRequirementValidatorTrait

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testBaseRequirement(string $event_class) : void {
    $this->eventClass = $event_class;
    $validator = $this->container
        ->get(BaseRequirementsFulfilledValidator::class);
    $this->assertEventPropagationStopped($event_class, [
        $validator,
        'validate',
    ]);
    $result = ValidationResult::createError([
        t('This will not stand!'),
    ]);
    if ($event_class === StatusCheckEvent::class) {
        $this->assertStatusCheckResults([
            $result,
        ]);
    }
    else {
        $this->assertResults([
            $result,
        ], $event_class);
    }
}

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