You are here

public function ConnectTest::testConnectService in Commerce Square Connect 8

Tests the methods.

File

tests/src/Kernel/ConnectTest.php, line 40

Class

ConnectTest
Tests the Connect service to act as application configuration.

Namespace

Drupal\Tests\commerce_square\Kernel

Code

public function testConnectService() {
  $connect = $this->container
    ->get('commerce_square.connect');
  $this
    ->assertEquals('Testing', $connect
    ->getAppName());
  $this
    ->assertEquals('Test secret', $connect
    ->getAppSecret());
  $this
    ->assertEquals('sandbox-sq0idp-nV_lBSwvmfIEF62s09z0-Q', $connect
    ->getAppId('sandbox'));
  $this
    ->assertEquals('sandbox-sq0atb-uEZtx4_Qu36ff-kBTojVNw', $connect
    ->getAccessToken('sandbox'));
  $this
    ->assertEquals(-1, $connect
    ->getAccessTokenExpiration('sandbox'));
  $this
    ->assertEquals('live-sq0idp', $connect
    ->getAppId('production'));
  $this
    ->assertEquals('TESTTOKEN', $connect
    ->getAccessToken('production'));
  $this
    ->assertEquals($this->container
    ->get('datetime.time')
    ->getRequestTime(), $connect
    ->getAccessTokenExpiration('production'));
}