Comments

mariancalinro’s picture

mariancalinro’s picture

Status: Active » Needs review
fago’s picture

Status: Needs review » Needs work

Patch looks good. Some remarks:

  1. +++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
    @@ -0,0 +1,66 @@
    + * Tests validation constrains for AllowedValuesConstraintValidator.
    

    constraints

    also, it doesn't test constraints for the validator, I'd suggest:

    "Tests the AllowedValues validation constraint validator."

  2. +++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
    @@ -0,0 +1,66 @@
    +      'name' => 'Test validation constrains',
    

    Name should describe the constraint it's testing.

  3. +++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
    @@ -0,0 +1,66 @@
    +   * Tests the constraint validation AllowedValuesConstraintValidator.
    

    maybe just use the same description as for the class, or shortly describe how it tests it, e.g. by specifying allowed values for an integer.

mariancalinro’s picture

Status: Needs work » Needs review
StatusFileSize
new2.65 KB

Status: Needs review » Needs work
mariancalinro’s picture

Status: Needs work » Needs review
fago’s picture

Status: Needs review » Needs work

Thanks! The test itself looks great, just a few remarks:

  1. +++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
    @@ -0,0 +1,69 @@
    +      'name' => 'Tests AllowedValues validation constraint',
    

    It's all about testing, so just "Allowed values constraint" should be fine.

  2. +++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
    @@ -0,0 +1,69 @@
    +
    

    unnecsesary empty line

  3. +++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
    @@ -0,0 +1,69 @@
    +   * Tests the AllowedValues validation constraint validator by creating a
    +   * typedData integer definition with some AllowedValues, and then by tring to
    +   * create a typedData object with both an allowed and a dissalowed value.
    

    Summary should be only one line not exceeding 80chars.

    So best split it up into a short summary and a longer explanation.

fago’s picture

Status: Needs work » Needs review
StatusFileSize
new1.97 KB
new2.54 KB

Re-rolled to work again with latest HEAD + addressed the points.

fago’s picture

9: d8_allowed_values.patch queued for re-testing.

yched’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/system/lib/Drupal/system/Tests/Validation/AllowedValuesConstraintValidatorTest.php
@@ -0,0 +1,65 @@
+    $typed_data = $this->typedData->create($definition, 1);

I really wish we would get #2132145: Rename 'typed_data' / Drupal::typedData() to 'typed_data_manager' / Drupal::typedDataManager in :-/

Otherwise no reason not to RTBC this patch, but dear core committers, can we maybe has a commit over there first ?

berdir’s picture

9: d8_allowed_values.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: d8_allowed_values.patch, failed testing.

fago’s picture

Status: Needs work » Needs review
StatusFileSize
new2.55 KB
new691 bytes

Re-rolled to account for the manager service rename.

yched’s picture

Status: Needs review » Reviewed & tested by the community

Same remark as #2142991-10: Test for ComplexDataConstraintValidator about $this->typedData, but otherwise RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

I don't understand yched's comment enough to say one way or the other, but it sounds like we could do that rename as a follow-up for all of these tests to keep them consistent? Or should I roll these back?

fago’s picture

It's just a simple variable re-name, I'll do a quick follow-up for all of those once the last one is in as well.

Created #2169467: Improve typedData manager variable name in ConstaintValidation tests.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.