You are here

public function LingotekSettingsTabUtilitiesFormTest::testRefreshResources in Lingotek Translation 3.5.x

Same name in this branch
  1. 3.5.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  2. 3.5.x tests/src/Unit/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  2. 3.0.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  3. 3.1.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  4. 3.2.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  5. 3.3.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  6. 3.4.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  7. 3.6.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  8. 3.7.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()
  9. 3.8.x tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabUtilitiesFormTest::testRefreshResources()

Test the table shows the right values.

File

tests/src/Functional/Form/LingotekSettingsTabUtilitiesFormTest.php, line 34

Class

LingotekSettingsTabUtilitiesFormTest
Tests the Lingotek utilities settings form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

public function testRefreshResources() {
  $assert_session = $this
    ->assertSession();

  // Activate the settings tab.
  $this
    ->drupalGet('admin/lingotek/settings');
  $this
    ->drupalPostForm(NULL, [], 'Refresh', [], 'lingoteksettings-tab-utilities-form');
  $assert_session
    ->responseContains('Project, workflow, vault, and filter information have been refreshed.');
  $config = \Drupal::configFactory()
    ->getEditable('lingotek.settings');
  $communities = $config
    ->get('account.resources.community');
  $this
    ->assertCount(2, $communities);
  $this
    ->assertEquals([
    'test_community' => 'Test community',
    'test_community2' => 'Test community 2',
  ], $communities);
  $projects = $config
    ->get('account.resources.project');
  $this
    ->assertCount(2, $projects);
  $this
    ->assertEquals([
    'test_project' => 'test_project',
    'test_project2' => 'test_project 2',
  ], $projects);
  $vaults = $config
    ->get('account.resources.vault');
  $this
    ->assertCount(2, $vaults);
  $this
    ->assertEquals([
    'test_vault' => 'test_vault',
    'test_vault2' => 'test_vault 2',
  ], $vaults);
  $workflows = $config
    ->get('account.resources.workflow');
  $this
    ->assertCount(2, $workflows);
  $this
    ->assertEquals([
    'test_workflow' => 'test_workflow',
    'test_workflow2' => 'test_workflow 2',
  ], $workflows);
  $filters = $config
    ->get('account.resources.filter');
  $this
    ->assertCount(3, $filters);
  $this
    ->assertEquals([
    'test_filter' => 'test_filter',
    'test_filter2' => 'test_filter 2',
    'test_filter3' => 'test_filter 3',
  ], $filters);
}