Verified Commit edf79f67 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3376572 by Lendude, fnalb2, cilefen, longwave: SortPluginBase.php /...

Issue #3376572 by Lendude, fnalb2, cilefen, longwave: SortPluginBase.php / validateExposeForm: spelling mistake in character class
parent d55e9171
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ public function validateExposeForm($form, FormStateInterface $form_state) {
      'expose',
      'field_identifier',
    ]);
    if (!preg_match('/^[a-zA-z][a-zA-Z0-9_~.\-]*$/', $field_identifier)) {
    if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_~.\-]*$/', $field_identifier)) {
      $form_state->setErrorByName('expose][field_identifier', $this->t('This identifier has illegal characters.'));
      return;
    }
+4 −1
Original line number Diff line number Diff line
@@ -150,10 +150,13 @@ public function testExposedAdminUi() {
    $this->submitForm($edit, 'Apply');
    $this->assertSession()->pageTextContains('Sort field identifier field is required.');

    // Try with an invalid identifier.
    // Try with an invalid identifiers.
    $edit['options[expose][field_identifier]'] = 'abc&! ###08.';
    $this->submitForm($edit, 'Apply');
    $this->assertSession()->pageTextContains('This identifier has illegal characters.');
    $edit['options[expose][field_identifier]'] = '^abcde';
    $this->submitForm($edit, 'Apply');
    $this->assertSession()->pageTextContains('This identifier has illegal characters.');

    // Use a valid identifier.
    $edit['options[expose][field_identifier]'] = $this->randomMachineName() . '_-~.';