Skip to content

Conversation

@MGatner
Copy link
Member

@MGatner MGatner commented Apr 17, 2019

Description
Per conversation in Slack, there is currently no way to check a precise value (or not), such as confirming a user typed "yes". This adds validation rules for equals and not_equals, along with their language texts, user guide entires, and tests.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@atishhamte
Copy link
Contributor

Please provide the unit test case related to all the datatype and string case sensitive and insensitive comparison.
Also update the user guide as well.

@nowackipawel
Copy link
Contributor

nowackipawel commented Apr 18, 2019

Could not we just use in_list / not_in_list / regex rules ?

@MGatner
Copy link
Member Author

MGatner commented Apr 18, 2019

@nowackipawel While those supply overlapping functionality, they make for weird error messages such as "The confirmation field must be one of: yes." This allows for clearer messages as well as easier to understand code.

@MGatner
Copy link
Member Author

MGatner commented Apr 18, 2019

Please provide the unit test case related to all the datatype and string case sensitive and insensitive comparison.
Also update the user guide as well.

I accidentally sent user guide and tests to my develop branch. I included those and added tests for case sensitivity. Data types are irrelevant because rules "must accept a string as the first parameter" (https://codeigniter4.github.io/CodeIgniter4/libraries/validation.html#creating-custom-rules).

Null gets cast as empty string so is actually true, even though the datatypes are initially different.
@lonnieezell lonnieezell merged commit 9bdfb13 into codeigniter4:develop Apr 19, 2019
@MGatner MGatner deleted the validation-equals-notequals branch April 19, 2019 14:32
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.

4 participants