- PHP version 5.5 and above (this code is intended for php 7.1 but is backwards compatible)
- Composer if you want to run everything locally or Laravel Homestead if you want to run a virtual machine
- Fork this repository to your personal github
- Clone that repository onto your local machine (or Homestead)
- run
composer install
in the repo directory from terminal, this will install all dependencies and the testing framework - Complete the
getProductTotal
function of the App\Services\CashRegister class - Complete the two empty tests in /tests/CashRegisterTest
- Run your tests by running
vendor/bin/phpunit
and returning 'OK (3 tests, x assertions)' - Send a link to your fork to [email protected]
Orders Table
id | name |
---|---|
1 | DRYV Order |
Transactions Table
id | order_id | status | amount | currency |
---|---|---|---|---|
1 | 1 | COMPLETE | 400 | USD |
2 | 1 | FAILED | 600 | USD |
3 | 1 | COMPLETE | 600 | USD |
Products Table
id | order_id | quantity | amount | currency |
---|---|---|---|---|
1 | 1 | 1 | 200 | USD |
2 | 1 | 4 | 100 | USD |
3 | 1 | 2 | 200 | USD |
- We use the Fowler money pattern so all the values you see are in the base currency unit (cents for USD)
- The "total" of each product is its quantity x amount
Good luck!