Our company is growing very fast with many new acquisitions. We are trying to cope with all the demand our employees have for food and beverages.
We estimated that it would be too hard to acquire multiple vending machines and suite them to our needs, therefore we decided to build one on our own. We need your help to do some groundwork!
You need to design a machine based on the following requirements:
- An employee can choose from different products: SparklingWater, SparkPasta, SparkSoda. All of them are for free.
- We have an inventory of all available products
- When returning a product, an according item will be removed from the inventory
- When a product in the inventory runs out of stock, it will not be dispensed anymore until it has been restocked
- You are provided with an unfinished project containing the main class of the Spark Vending Machine and a test for one of the required use cases
- Please add all changes to the project to implement the functionality described above, make sure all your tests pass – feel free to change any existing code as well
- We need to ensure that any change we do is working, our employees would be disappointed if we roll out a non-functioning vending machine, and we do value their opinion. Thus, anything we deliver has to be in good shape and quality. Maybe TDD could be a feasible approach.
- The project is set up with composer, requires PHP 7.4+ and doesn't use any third party tools (except PHPUnit)
- We do not need a web or console application, it is enough for us to see testable and clean code
- Keep in mind that you are going to extend this solution in a pair programming session 😇
- To install, run
composer install
in an environment with PHP 7.4+ and composer available - Tu run all tests, execute
composer test
You can choose to send the solution as a ZIP archive (https://git-scm.com/docs/git-archive) or upload it as a private repository to a GIT hoster of your choice, giving us access to it.
We are looking forward to your implementation! 😊