Skip to content

Conversation

@jaysomani
Copy link

Test Enhancement 🚀

Test Invalid API Call

Added a PHPUnit test case to ensure proper validation of an invalid API call. This test checks if the isValid method in the Documents class correctly handles the scenario where the provided queries are not an array. The expected behavior is that the method returns false and sets an error message indicating that "Queries must be an array."

Code Improvement 🛠️

Enhance isArray Method

Improved the isArray method in the same class (Documents) by fixing a parameter mismatch. The method now correctly checks if the provided value is an array using the is_array function, enhancing the reliability of the isArray function.

These changes aim to strengthen the validation logic and improve the overall robustness of the codebase.

public function isArray(): bool
{
return true;
return is_array($value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used, but it still shouldn't be changed so that it's consistent with others.

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, looking at the code, it looks like the Queries validator has already been updated to fix the problem so no more changes are needed.

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