function WorkspaceAssociationDeprecationTest::testPostPublishDeprecation

Same name and namespace 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 <a href="/api/drupal/core%21modules%21workspaces%21src%21WorkspaceAssociation.php/class/WorkspaceAssociation/11.x" title="Provides a class for CRUD operations on workspace associations." class="local">\Drupal\workspaces\WorkspaceAssociation</a> @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.