Skip to content
Snippets Groups Projects

Issue #3491351: Add schema validation tests ai.settings

Issue #3491351: Add schema validation tests ai.settings
2 open threads

Closes #3491351

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
432 426 return $form['default_providers'][$operation_type]['model'];
433 427 }
434 428
429 /**
430 * Add the hardcoded selections of filtered types.
431 *
432 * @return array
433 * The operation types array.
434 */
435 public function getOperationTypes(): array {
436 return array_merge($this->providerManager->getOperationTypes(), $this->hardcodedSelections);
  • 37
    38 // Install config schema.
    39 $this->installConfig(['ai']);
    40 }
    41
    42 /**
    43 * Tests AI settings using the settings form.
    44 */
    45 public function testAiSettings() {
    46 $ai_setting_form = AiSettingsForm::create(\Drupal::getContainer());
    47 $form_values = [
    48 'default_vdb_provider' => $this->randomString(),
    49 ];
    50 foreach ($ai_setting_form->getOperationTypes() as $operation_type) {
    51 $form_values['operation__' . $operation_type['id']] =
    52 $form_values['model__' . $operation_type['id']] = $this->randomString();
    • I think we might needs to test something here, in the submit form, if the value is empty, its not set at all which could cause a test failure.

      Could you make another test with some of these values empty?

      Also we have the pseudo operation types from the hardcoded selection that should be in the schema.

    • Could you make another test with some of these values empty?

      Sure, I'll add a new tests.

      Also we have the pseudo operation types from the hardcoded selection that should be in the schema.

      I think, I have covered everything in the settings form class. Please let me know if I missed something.

    • Please register or sign in to reply
    Please register or sign in to reply
    Loading