ppoidc-8.x-1.2/src/Tests/SettingsFormTest.php

src/Tests/SettingsFormTest.php
<?php

namespace Drupal\pixelpin_openid_connect\Tests;

use Drupal\simpletest\WebTestBase;

/**
 * Provides tests for the settings form.
 *
 * @group pixelpin_openid_connect
 */
class SettingsFormTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = ['pixelpin_openid_connect'];

  /**
   * A regular user.
   *
   * @var \Drupal\user\UserInterface
   */
  protected $webUser;

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->webUser = $this->drupalCreateUser([
      'administer site configuration',
    ]);
  }

  /**
   * Tests the OpenID connect settings form.
   */
  public function testUpdateSettings() {
    $this->drupalLogin($this->webUser);
    $this->drupalGet('admin/config/services/openid-connect');

    // Override the default values.
    $edit = [
      'always_save_userinfo' => FALSE,
    ];

    $this->drupalPostForm(NULL, $edit, 'Save configuration', [], [], 'openid-connect-admin-settings');

    // Check the config was updated.
    $config_factory = $this->container->get('config.factory');
    /* @var \Drupal\Core\Config\Config $config */
    $config = $config_factory->get('pixelpin_openid_connect.settings');
    $user_info = $config->get('always_save_userinfo');
    $this->assertFalse($user_info);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc