Skip to content

Commit

Permalink
Merge 0b62d6b into 826dabf
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti authored Mar 26, 2024
2 parents 826dabf + 0b62d6b commit 3f908eb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/Kernel/TunnistamoClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Drupal\Tests\helfi_tunnistamo\Kernel;

use Drupal\Core\Form\FormState;
use Drupal\user\Entity\Role;

/**
* Tests Tunnistamo configuration.
*
Expand Down Expand Up @@ -76,4 +79,20 @@ public function testEndpoints() : void {
}
}

/**
* Tests configuration form default values.
*/
public function testConfigurationForm() : void {
Role::create(['id' => 'test', 'label' => 'test'])->save();
$this->setupEndpoints();
$plugin = $this->getPlugin();
$configuration = $plugin->getConfiguration();
$form = $plugin->buildConfigurationForm([], new FormState());
$this->assertEquals($configuration['auto_login'], $form['auto_login']['#default_value']);
$this->assertEquals($configuration['client_scopes'], $form['client_scopes']['#default_value']);
$this->assertEquals('https://localhost', $form['environment_url']['#default_value']);
$this->assertEquals(['test' => 'test'], $form['client_roles']['#options']);
$this->assertEquals($configuration['client_roles'], $form['client_roles']['#default_value']);
}

}

0 comments on commit 3f908eb

Please sign in to comment.