function StageEventsTest::testEvents

Tests that the stage fires life cycle events in a specific order.

File

core/modules/package_manager/tests/src/Kernel/StageEventsTest.php, line 98

Class

StageEventsTest
Tests that the stage fires events during its lifecycle.

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testEvents() : void {
    $this->container
        ->get('event_dispatcher')
        ->addSubscriber($this);
    $this->stage
        ->create();
    $this->stage
        ->require([
        'ext-json:*',
    ]);
    $this->stage
        ->apply();
    $this->stage
        ->postApply();
    $this->stage
        ->destroy();
    $this->assertSame($this->events, [
        PreCreateEvent::class,
        PostCreateEvent::class,
        PreRequireEvent::class,
        PostRequireEvent::class,
        PreApplyEvent::class,
        PostApplyEvent::class,
    ]);
}

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