mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-03 14:51:31 -04:00
- 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.).
25 lines
652 B
XML
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>
|