You are here

public function SquareConfigurationUpradeTest::testUpgrade2 in Commerce Square Connect 8

Tests the upgrade to move access token to state.

File

tests/src/Kernel/SquareConfigurationUpradeTest.php, line 78

Class

SquareConfigurationUpradeTest
Tests config schema upgrade for beta3 to beta4.

Namespace

Drupal\Tests\commerce_square\Kernel

Code

public function testUpgrade2() {
  $this
    ->testUpgrade1();
  module_load_install('commerce_square');
  commerce_square_update_8002();
  $config = $this
    ->config('commerce_square.settings');
  $this
    ->assertNull($config
    ->get('production_access_token'));
  $this
    ->assertNull($config
    ->get('production_access_token_expiry'));
  $state = $this->container
    ->get('state');
  $this
    ->assertEquals('live-sq0atb', $state
    ->get('commerce_square.production_access_token'));
  $this
    ->assertEquals($this->container
    ->get('datetime.time')
    ->getRequestTime(), $state
    ->get('commerce_square.production_access_token_expiry'));
}