"All new business logic should have corresponding unit tests."
Description
This PR introduces a new test file, GedcomExporterHelpersTest.php, which contains comprehensive unit tests for each method in the GedcomExporterHelpers class. These tests cover normal operation, edge cases, and error conditions to ensure the robustness of the code. Mock objects are used to isolate the methods being tested from external dependencies like the database or the file system.
Summary of Changes
Created tests/Unit/GedcomExporterHelpersTest.php.
Wrote unit tests for the following methods in the GedcomExporterHelpers class:
createDirectory
fetchDatabaseData
prepareDataForView
createGedcomDocumentString
writeToFile
Utilized mock objects to simulate database and file system interactions.
Used data providers for efficient testing of methods with various inputs.
These changes significantly improve the test coverage of the GedcomExporterHelpers class, ensuring that its methods function as expected under a variety of conditions.
PR Feedback (click)
I created this PR to address this rule:
"All new business logic should have corresponding unit tests."
Description
This PR introduces a new test file,
GedcomExporterHelpersTest.php
, which contains comprehensive unit tests for each method in theGedcomExporterHelpers
class. These tests cover normal operation, edge cases, and error conditions to ensure the robustness of the code. Mock objects are used to isolate the methods being tested from external dependencies like the database or the file system.Summary of Changes
tests/Unit/GedcomExporterHelpersTest.php
.GedcomExporterHelpers
class:createDirectory
fetchDatabaseData
prepareDataForView
createGedcomDocumentString
writeToFile
These changes significantly improve the test coverage of the
GedcomExporterHelpers
class, ensuring that its methods function as expected under a variety of conditions.