Hello, this is a simple challenge to test your skills on Symfony, PHPUnit and Cache.
You will see that we have a Controller\CustomerController. It basically gives you the following capabilities:
- Create multiple customers by sending an json to /customers/ endpoint
- Delete all customers
- Consult all customers
So what do you have to do?
- We want you to obtain the reponse of GET customers method from a Cache Server.
- Since you know that this information is immutable until someone hits POST/DELETE customer methods, you shall not hit the Database if cache information is available.
- Make Unit and Functional tests to ensure everything is working fine.* To let the things a little bit interesting you will have to implement an failover: If Cache Server goes down, you have to hit the Database and this needs to be transparent to our end user, not an Error page!
- You will recieve a thumbs up for good Commit Messages and SOLID knowledge.
- PHP 5.4
- MongoDB driver
- Mongo 2.6
- Redis 3
- $ git clone [email protected]:easytaxi/interview-cache-failover.git
- $ cd interview-cache-failover/
- $ composer install
- $ php app/console server:run
- Open http://127.0.0.1:8000/customers in your browser (check if everything is fine)
- You can test your database operation by doing a POST into /customers/
- $ curl http://127.0.0.1:8000/customers/ -X POST -d '[{"name":"leandro", "age":26}, {"name":"marcio", "age":30}]'
- Then check your MongoDB collection to see if customers were created or just call the action
- $ curl http://127.0.0.1:8000/customers/
- Install PHPUnit
- In projects root run: phpunit