Files
opensourcepos/tests/phpunit.xml
Ollama 66b6c99384 Extract reward logic to Reward_lib library and add unit tests
- Create app/Libraries/Reward_lib.php with reward point business logic:
  - calculatePointsEarned(): calculate rewards from purchase amount
  - adjustRewardPoints(): deduct/restore/adjust customer points
  - handleCustomerChange(): handle points when customer changes on sale
  - adjustRewardDelta(): adjust delta for same customer payment changes
  - hasSufficientPoints(): validate customer has enough points
  - getPointsBalance(): get customer points balance
  - calculateRewardPaymentAmount(): sum reward payments from array

- Add tests/Libraries/Reward_libTest.php with 20+ test cases covering:
  - Points calculation edge cases
  - Customer change scenarios
  - Deletion/restore operations
  - Sufficient points validation
  - Payment amount calculation

- Update tests/phpunit.xml to include Libraries testsuite

This extraction centralizes reward logic for better testability and
follows the existing library pattern (Tax_lib, Sale_lib, etc.).
2026-03-17 15:00:57 +00:00

25 lines
652 B
XML

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap = "../vendor/autoload.php"
backupGlobals = "false"
colors = "true"
processIsolation = "false"
stopOnFailure = "false">
<testsuites>
<testsuite name="Helpers">
<directory>helpers</directory>
</testsuite>
<testsuite name="Libraries">
<directory>Libraries</directory>
</testsuite>
<testsuite name="Models">
<directory>Models</directory>
</testsuite>
<testsuite name="Controllers">
<directory>Controllers</directory>
</testsuite>
</testsuites>
</phpunit>