You are here

class TestWorkspaceNegotiator in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator

Defines a workspace negotiator used for testing.

Hierarchy

Expanded class hierarchy of TestWorkspaceNegotiator

1 string reference to 'TestWorkspaceNegotiator'
workspace_update_test.services.yml in core/modules/workspaces/tests/modules/workspace_update_test/workspace_update_test.services.yml
core/modules/workspaces/tests/modules/workspace_update_test/workspace_update_test.services.yml
1 service uses TestWorkspaceNegotiator
workspace_update_test.negotiator.test in core/modules/workspaces/tests/modules/workspace_update_test/workspace_update_test.services.yml
Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator

File

core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php, line 13

Namespace

Drupal\workspace_update_test\Negotiator
View source
class TestWorkspaceNegotiator implements WorkspaceNegotiatorInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(Request $request) {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function getActiveWorkspace(Request $request) {
    return Workspace::create([
      'id' => 'test',
      'label' => 'Test',
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function setActiveWorkspace(WorkspaceInterface $workspace) {

    // Nothing to do here.
  }

  /**
   * {@inheritdoc}
   */
  public function unsetActiveWorkspace() {

    // Nothing to do here.
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestWorkspaceNegotiator::applies public function Checks whether the negotiator applies to the current request or not. Overrides WorkspaceNegotiatorInterface::applies
TestWorkspaceNegotiator::getActiveWorkspace public function Gets the negotiated workspace, if any. Overrides WorkspaceNegotiatorInterface::getActiveWorkspace
TestWorkspaceNegotiator::setActiveWorkspace public function Sets the negotiated workspace. Overrides WorkspaceNegotiatorInterface::setActiveWorkspace
TestWorkspaceNegotiator::unsetActiveWorkspace public function Unsets the negotiated workspace. Overrides WorkspaceNegotiatorInterface::unsetActiveWorkspace