function WorkspaceAssociationDeprecationTest::testPostPublishDeprecation

Same name in other branches
  1. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationDeprecationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceAssociationDeprecationTest::testPostPublishDeprecation()

@covers ::postPublish

File

core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationDeprecationTest.php, line 32

Class

WorkspaceAssociationDeprecationTest
@coversDefaultClass \Drupal\workspaces\WorkspaceAssociation @group legacy

Namespace

Drupal\Tests\workspaces\Kernel

Code

public function testPostPublishDeprecation() : void {
    $this->expectDeprecation('Drupal\\workspaces\\WorkspaceAssociation::postPublish() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use the \\Drupal\\workspaces\\Event\\WorkspacePostPublishEvent event instead. See https://www.drupal.org/node/3242573');
    $workspace = Workspace::create([
        'id' => 'test',
        'label' => 'Test',
    ]);
    $workspace->save();
    \Drupal::service('workspaces.association')->postPublish($workspace);
}

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