function WorkspaceQueryParameterNegotiatorTest::providerTestWorkspaceQueryParameter

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

Data provider for testWorkspaceQueryParameter.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceQueryParameterNegotiatorTest.php, line 77

Class

WorkspaceQueryParameterNegotiatorTest
Tests the query parameter workspace negotiator.

Namespace

Drupal\Tests\workspaces\Kernel

Code

public static function providerTestWorkspaceQueryParameter() : array {
    return [
        'no workspace, no token' => [
            'workspace' => NULL,
            'token' => NULL,
            'negotiated_workspace' => NULL,
            'has_active_workspace' => FALSE,
        ],
        'fake workspace, no token' => [
            'workspace' => 'fake_id',
            'token' => NULL,
            'negotiated_workspace' => NULL,
            'has_active_workspace' => FALSE,
        ],
        'fake workspace, fake token' => [
            'workspace' => 'fake_id',
            'token' => 'fake_token',
            'negotiated_workspace' => NULL,
            'has_active_workspace' => FALSE,
        ],
        'good workspace, fake token' => [
            'workspace' => 'stage',
            'token' => 'fake_token',
            'negotiated_workspace' => NULL,
            'has_active_workspace' => FALSE,
        ],
        // The fake workspace will be accepted by the negotiator in this case, but
        // the workspace manager will try to load and check access for it, and
        // won't set it as the active workspace. Note that "fake" can also mean a
        // workspace that existed at some point, then it was deleted and the user
        // is just accessing a stale link.
'fake workspace, good token' => [
            'workspace' => 'fake_id',
            'token' => 'good_token',
            'negotiated_workspace' => 'fake_id',
            'has_active_workspace' => FALSE,
        ],
        'good workspace, good token' => [
            'workspace' => 'stage',
            'token' => 'good_token',
            'negotiated_workspace' => 'stage',
            'has_active_workspace' => TRUE,
        ],
    ];
}

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