A new rule meets last month's order
Imagine changing an additional-fee calculation. New orders look correct, but reopening an old document recalculates it using today's rules. The question is not only whether the formula works, but which formula applies to this case.
PHPUnit supports assertions for expected outcomes and data providers for running cases against datasets. The PHPUnit testing guide describes these mechanisms.
Choose examples from the workflow
Collect cases covering an ordinary order, discount, cancellation, correction and reopening a historical operation. Use test data preserving the important relationships without copying customer information. Record the expected result and its rationale for each example.
Decide whether the document stores accepted values, a rule version or the inputs needed to reproduce a calculation. Do not let current code make that choice accidentally. Pay attention to rounding and money representation; a small difference can make totals disagree.
Test responsibility boundaries
A calculation rule can be checked without sending messages or contacting an external service. A separate integration test should verify persistence and retrieval. Avoid replacing the entire business logic with a stub returning the expected number.
When requirements change, identify which existing cases must remain stable and which are intentionally changing. A test failure should prompt discussion of behavior. A high coverage percentage alone does not establish that historical operations remain correct.