You are here

public function BynderApiUnitTest::providerHasAccessToken in Bynder 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/BynderApiUnitTest.php \Drupal\Tests\bynder\Unit\BynderApiUnitTest::providerHasAccessToken()
  2. 8 tests/src/Unit/BynderApiUnitTest.php \Drupal\Tests\bynder\Unit\BynderApiUnitTest::providerHasAccessToken()
  3. 8.2 tests/src/Unit/BynderApiUnitTest.php \Drupal\Tests\bynder\Unit\BynderApiUnitTest::providerHasAccessToken()

Data provider for testHasAccessToken().

File

tests/src/Unit/BynderApiUnitTest.php, line 49

Class

BynderApiUnitTest
@coversDefaultClass \Drupal\bynder\BynderApi

Namespace

Drupal\Tests\bynder\Unit

Code

public function providerHasAccessToken() {
  $data = [];
  $data['no_session_data'] = [
    [],
    'valid_hash',
    0,
    FALSE,
  ];
  $data['no_token'] = [
    [
      'access_token' => new \stdClass(),
    ],
    'valid_hash',
    0,
    FALSE,
  ];
  $data['no_hash'] = [
    [
      'access_token' => new AccessToken([
        'access_token' => 'foo',
        'expires' => 1601998092 + 1,
      ]),
    ],
    'valid_hash',
    0,
    FALSE,
  ];
  $data['valid'] = [
    [
      'access_token' => new AccessToken([
        'access_token' => 'foo',
        'expires' => 1601998092 + 1,
      ]),
      'config_hash' => 'valid_hash',
    ],
    'valid_hash',
    1,
    TRUE,
  ];
  $data['expired'] = [
    [
      'access_token' => new AccessToken([
        'access_token' => 'foo',
        'expires' => 1601998092 - 1,
      ]),
      'config_hash' => 'valid_hash',
    ],
    'valid_hash',
    1,
    FALSE,
    [],
  ];
  return $data;
}