You are here

public function InstagramBlockUpdatePathTest::testUpdateMoveAccessTokens in Instagram Block 8.3

Same name and namespace in other branches
  1. 8.2 src/Tests/Update/InstagramBlockUpdatePathTest.php \Drupal\instagram_block\Tests\Update\InstagramBlockUpdatePathTest::testUpdateMoveAccessTokens()

Test that after the update access token is now set on the block.

File

src/Tests/Update/InstagramBlockUpdatePathTest.php, line 28

Class

InstagramBlockUpdatePathTest
Tests the update path for moving access token to block configuration.

Namespace

Drupal\instagram_block\Tests\Update

Code

public function testUpdateMoveAccessTokens() {

  // Check that there is no access token before update.
  $block_before = Block::load('testaccesstokenmove');
  $settings = $block_before
    ->get('settings');
  $this
    ->assertTrue(!isset($settings['access_token']), 'No access token setting on block before update.');
  $this
    ->runUpdates();

  // Check that the correct access token is now in the block settings.
  $block_after = Block::load('testaccesstokenmove');
  $access_token = $block_after
    ->get('settings')['access_token'];
  $this
    ->assertEquals($access_token, '412345678.123ab45.cde678fg901h234ij567klm89nop0123', 'Access token copied to block successfully.');
}