This is a test for senior PHP backend developers.
Estimated time: 2 hours.
Once you finnish the exercise you should send the full Git repository by email. You may use a Git bundle.
Install all dependencies
composer install
- PHP 7.0 or higher
- composer
- Docker (optional)
Create a CLI application to generate lists to play Secret Santa.
- Using TDD is a plus
- A nice Git history is a plus
Secret Santa is a Western Christmas tradition in which members of a group or community are randomly assigned a player to whom they give a gift. The identity of the gift giver is a secret not to be revealed.
- The application must read the list of players from a text file.
- Each player must be in one line.
- The text file can't have repeated players.
- The file with players is located at /players.txt
- Each player must have one player to give the gift.
- Each player must receive a gift.
- You can not be assigned to yourself.
- The assignation must be random.
If any of this restrictions can not be satisfied the application should throw an Exception.
The application will need to interact with other systems. This means that some components of the application need to adhere some already existing contracts (see /src/Contracts).
- Input: Reads the file with the players
- Output: Prints the output on screen (standard output)
- Random: Generates random numbers
- Game: The game itself
This contracts can not be modified.
Alpha
Charlie
Bravo
Foxtrot
Alpha -> Bravo
Charlie -> Alpha
Foxtrot -> Charlie
Bravo -> Foxtrot