diff --git a/tests/integration/issues/1334.phpt b/tests/integration/issues/1334.phpt new file mode 100644 index 000000000..33e785080 --- /dev/null +++ b/tests/integration/issues/1334.phpt @@ -0,0 +1,46 @@ +--FILE-- +iterableType()->each( + v::key('street', v::stringType()->notEmpty()) + ->key('region', v::stringType()->notEmpty()) + ->key('country', v::stringType()->notEmpty()) + ->keyOptional('other', v::nullOr(v::notEmpty()->stringType())) + )->assert( + [ + ['region' => 'Oregon', 'country' => 'USA', 'other' => 123], + ['street' => '', 'region' => 'Oregon', 'country' => 'USA'], + ['street' => 123, 'region' => 'Oregon', 'country' => 'USA'], + ] + ); +}); + +?> +--EXPECT-- +https://github.com/Respect/Validation/issues/1334 +⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺ +street must be present +- Each item in `[["region": "Oregon", "country": "USA", "other": 123], ["street": "", "region": "Oregon", "country": "USA"], ["s ... ]` must be valid + - These rules must pass for `["region": "Oregon", "country": "USA", "other": 123]` + - street must be present + - These rules must pass for other + - other must be a string or must be null + - These rules must pass for `["street": "", "region": "Oregon", "country": "USA"]` + - street must not be empty + - These rules must pass for `["street": 123, "region": "Oregon", "country": "USA"]` + - street must be a string +[ + 'each' => [ + '__root__' => 'Each item in `[["region": "Oregon", "country": "USA", "other": 123], ["street": "", "region": "Oregon", "country": "USA"], ["s ... ]` must be valid', + 'allOf.1' => [ + '__root__' => 'These rules must pass for `["region": "Oregon", "country": "USA", "other": 123]`', + 'street' => 'street must be present', + 'other' => 'other must be a string or must be null', + ], + 'allOf.2' => 'street must not be empty', + 'allOf.3' => 'street must be a string', + ], +] diff --git a/tests/integration/issues/1469.phpt b/tests/integration/issues/1469.phpt new file mode 100644 index 000000000..fb0798bf8 --- /dev/null +++ b/tests/integration/issues/1469.phpt @@ -0,0 +1,50 @@ +--FILE-- + [ + [ + 'product_title' => 'test', + 'quantity' => 'test', + ], + [ + 'product_title2' => 'test', + ], + ], + ]; + + v::arrayVal()->keySet( + v::key('order_items', v::arrayVal()->each(v::keySet( + v::key('product_title', v::stringVal()->notEmpty()), + v::key('quantity', v::intVal()->notEmpty()), + ))->notEmpty()), + )->assert($data); +}); + +?> +--EXPECT-- +https://github.com/Respect/Validation/issues/1469 +⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺ +quantity must be an integer value +- Each item in order_items must be valid + - order_items validation failed + - quantity must be an integer value + - order_items contains both missing and extra keys + - product_title must be present + - quantity must be present + - product_title2 must not be present +[ + 'keySet' => [ + '__root__' => 'Each item in order_items must be valid', + 'keySet.1' => 'quantity must be an integer value', + 'keySet.2' => [ + '__root__' => 'order_items contains both missing and extra keys', + 'product_title' => 'product_title must be present', + 'quantity' => 'quantity must be present', + 'product_title2' => 'product_title2 must not be present', + ], + ], +] diff --git a/tests/integration/issues/1477.phpt b/tests/integration/issues/1477.phpt new file mode 100644 index 000000000..b4865256d --- /dev/null +++ b/tests/integration/issues/1477.phpt @@ -0,0 +1,28 @@ +--FILE-- +setTemplate('{{name}} is not good!') + )->assert(['Address' => 'cvejvn']); +}); + +?> +--EXPECT-- +https://github.com/Respect/Validation/issues/1477 +⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺ +Address is not good! +- Address is not good! +[ + 'Address' => 'Address is not good!', +]