Verified Commit 90431904 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3029782 by wengerk, knyshuk.vova, yogeshmpawar, karishmaamin, longwave,...

Issue #3029782 by wengerk, knyshuk.vova, yogeshmpawar, karishmaamin, longwave, claudiu.cristea: UniqueFieldValueValidator lowercasing Label of field on violation message

(cherry picked from commit ac84424e)
parent 4cdc1a6e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public function validate($items, Constraint $constraint) {
      $this->context->addViolation($constraint->message, [
        '%value' => $item->value,
        '@entity_type' => $entity->getEntityType()->getSingularLabel(),
        '@field_name' => mb_strtolower($items->getFieldDefinition()->getLabel()),
        '@field_name' => $items->getFieldDefinition()->getLabel(),
      ]);
    }
  }
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public function testValidation() {
    // Make sure the violation is on the info property
    $this->assertEquals('info', $violations[0]->getPropertyPath());
    // Make sure the message is correct.
    $this->assertEquals(new FormattableMarkup('A custom block with block description %value already exists.', ['%value' => $block->label()]), $violations[0]->getMessage());
    $this->assertEquals(new FormattableMarkup('A custom block with Block description %value already exists.', ['%value' => $block->label()]), $violations[0]->getMessage());
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public function testEntityWithStringIdWithViolation($id) {
    $message = new FormattableMarkup('A @entity_type with @field_name %value already exists.', [
      '%value' => $value,
      '@entity_type' => $entity->getEntityType()->getSingularLabel(),
      '@field_name' => 'name',
      '@field_name' => 'Name',
    ]);

    // Check that the validation has created the appropriate violation.