TestWorkspaceNegotiator.php

Same filename in other branches
  1. 8.9.x core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php
  2. 10 core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php
  3. 11.x core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php

Namespace

Drupal\workspace_update_test\Negotiator

File

core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php

View source
<?php

namespace Drupal\workspace_update_test\Negotiator;

use Drupal\workspaces\Entity\Workspace;
use Drupal\workspaces\Negotiator\WorkspaceNegotiatorInterface;
use Drupal\workspaces\WorkspaceInterface;
use Symfony\Component\HttpFoundation\Request;

/**
 * Defines a workspace negotiator used for testing.
 */
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.
    }

}

Classes

Title Deprecated Summary
TestWorkspaceNegotiator Defines a workspace negotiator used for testing.

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