AcmeWidgetCo
Building app
docker-compose up -d --build
Starting app
docker-compose up -d
Running tests
docker-compose run php vendor/bin/phpunit
Documentation
Assumptions
- Basket complexity will change, so it's build with BasketBuilder (now it can take more than three parameters on the constructor).
- Similar Baskets can use same builder or might need other Builder functionality. I'm using trait to add functionality through composition. BasketBuilder is easy to be reused.
- BasketBuilder configuration is encapsulated into factory.
- Products count and data will change so ProductCatalogueDataStructure is holding the data.
- ProductCatalogue is build with ProductCatalogueDataStructure and ProductCatalogueStrategy.
- The way products are handled will change so ProductCatalogueStrategy allows logic to be changed.
- The way offers are build will change so OffersStrategy allows logic to be changed.
- Delivery charge will change so DeliveryChargeRulesStrategy allows logic to be changed as well.
- All classes are connected through abstract level - interfaces.
- Money is stored as integers to avoid missing one cent issue.
- Exercise is using composer to add autoloader and PhpUnit.
- Example of BasketDecorator added, to present how new business logic should be introduced.
- Composite example added to demonstrate working on a group of Baskets.
Using PhpUnit in PhpStorm
- PhpUnit By Remote Interpreter
- Provide full docker path to autoloader.php /opt/project/vendor/autoload.php