Skip to content

Add additional tests for Rule::array validation scenarios #54844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

alikhosravidev
Copy link
Contributor

This PR adds new test cases for the Rule::array validation to cover a variety of scenarios and ensure correct behavior:

Formatting Tests:

  • Ensures that an empty array ([]) is formatted as 'array'.
  • Verifies that arrays with duplicate keys (e.g., ['key_1', 'key_1']) are correctly formatted with repeated keys.
  • Confirms that arrays with numeric values (e.g., [1, 2, 3]) are formatted as expected.
  • Object Input: Verifies that Rule::array fails validation when an object is provided instead of an array.
  • Nullable Arrays: Ensures that arrays marked as nullable pass validation when given a null value.
  • Empty Arrays: Confirms that empty arrays pass validation with Rule::array.
  • Nested Empty Values: Tests Rule::array with nested empty arrays to ensure correct behavior.

These additions improve the test coverage for Rule::array validation, ensuring it handles different input types and edge cases as expected.

@alikhosravidev
Copy link
Contributor Author

Added a new test case for the getCount method in DatabasePresenceVerifier to verify the behavior with a valid excludeId condition.

This ensures that when a valid excludeId is provided, the appropriate where condition for 'id' is applied correctly.

@taylorotwell taylorotwell merged commit ab0b9b0 into laravel:12.x Feb 28, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants