"All new business logic should have corresponding unit tests."
Description
This PR addresses issue #XYZ, which pointed out the lack of unit tests for the new business logic introduced in the README.md file. The new logic checks if the $names array is not empty before proceeding to get the first name object from the array and outputting the individual's ID, surname, and given name.
To resolve this issue, we have added a new test file tests/ParserTest.php that contains unit tests for the Parser class. The tests cover scenarios where the $names array is empty and where it contains one or more elements, ensuring that the logic behaves as expected in both cases.
Additionally, we have updated the CONTRIBUTE.md file to include instructions about running tests. This ensures that future contributors are aware of the testing requirements and promotes a culture of testing within the project.
Summary of Changes
Created a new test file tests/ParserTest.php with unit tests for the Parser class.
Updated CONTRIBUTE.md to include instructions for running tests.
Please review the changes and provide any feedback. Thank you.
PR Feedback (click)
I created this PR to address this rule:
"All new business logic should have corresponding unit tests."
Description
This PR addresses issue #XYZ, which pointed out the lack of unit tests for the new business logic introduced in the README.md file. The new logic checks if the
$names
array is not empty before proceeding to get the first name object from the array and outputting the individual's ID, surname, and given name.To resolve this issue, we have added a new test file
tests/ParserTest.php
that contains unit tests for theParser
class. The tests cover scenarios where the$names
array is empty and where it contains one or more elements, ensuring that the logic behaves as expected in both cases.Additionally, we have updated the
CONTRIBUTE.md
file to include instructions about running tests. This ensures that future contributors are aware of the testing requirements and promotes a culture of testing within the project.Summary of Changes
tests/ParserTest.php
with unit tests for theParser
class.CONTRIBUTE.md
to include instructions for running tests.Please review the changes and provide any feedback. Thank you.