PageRenderTime 31ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/README.md

https://gitlab.com/diegonobre/basic-symfony28-interview-test
Markdown | 127 lines | 87 code | 40 blank | 0 comment | 0 complexity | 29a8558f07b3d5061fc7c7b85c8063cd MD5 | raw file
  1. # Basic PHP and Symfony 2.8 interview
  2. ## Worked hours
  3. - 11am to 12pm
  4. - 12:50pm to 2:30pm
  5. - 9pm to 11pm
  6. Dear candidate, please follow this readme and solve all questions.
  7. > Before you can start, you should prepare your development environment.
  8. **Using Symfony with Homestead/Vagrant**
  9. In order to develop a Symfony application, you might want to use a virtual development environment instead of the built-in server or WAMP/LAMP. Homestead is an easy-to-use Vagrant box to get a virtual environment up and running quickly.
  10. Before you can use Homestead, you need to install and configure Vagrant and Homestead as explained in the Homestead documentation.
  11. Resources:
  12. - [Using Symfony with Homestead/Vagrant](http://symfony.com/doc/current/cookbook/workflow/homestead.html)
  13. - [Homestead documentation](http://laravel.com/docs/homestead#installation-and-setup)
  14. **This test requires:**
  15. - access to the internet
  16. - an php capable IDE (we suggest PhpStorm with symfony, yaml, twig and php annotations plugin)
  17. - working setup of PHP 5.6+ *(http://symfony.com/doc/current/reference/requirements.html)*
  18. - composer *(https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)*
  19. - mongoDB *(https://docs.mongodb.com/manual/installation/)*
  20. - nginx or alternative simple web server
  21. *Tip: Install Robomongo on your OS*
  22. *Tip: Clone the test repository and make sure its working.*
  23. Access the project with your favourite browser. You should see similar welcome screen. **Dont forget to run composer install.**
  24. ![Symfony welcome screen](https://raw.githubusercontent.com/OskHa/php_interview_test/master/symfony_screenshot.png)
  25. *Help: PHP 5.6+ (debian/ubuntu)*
  26. > sudo apt-get install -qq php5-cli php5-fpm php5-mysqlnd php5-curl php5-gd php5-json php5-redis php5-imap php5-intl php5-imagick php5-mcrypt php5-xdebug php5-xmlrpc php5-xsl php5-twig php5-mongo php5-dev
  27. *Help: (optional) PECL MongoDB library (debian/ubuntu)*
  28. > sudo apt-get install pkg-config libssl-dev && sudo pecl update-channels && sudo pecl install mongodb
  29. **Good luck!**
  30. --------
  31. ## Test tasks:
  32. 1. Change the text on symfony homepage from "Welcome to Symfony 2.8.8" to "This is a test"
  33. 1. Run the PhpUnit test. Check if there are any errors, if so fix them.
  34. 1. Create a new Bundle "InterviewBundle" within the namespace "Test"
  35. 1. Create a method helloAction under AppBundle\Controller\DefaultController
  36. * for route `/hello`
  37. * with a proper json return `{"hello":"world!"}`
  38. 1. Create a "Bios" collection and load the example data into your MongoDB server
  39. * copy the json string from mongodb website ([link](https://docs.mongodb.com/manual/reference/bios-example-collection/))
  40. * or download and load the archive dump ([link](https://raw.githubusercontent.com/OskHa/php_interview_test/master/symfony_mongodb_example.archive))
  41. 1. Define ODM "Bios" document under namespace Test/InterviewBundle/Documents
  42. 1. Define ODM "Bios" repository under namespace Test/InterviewBundle/Repositories
  43. 1. Implement following repository methods
  44. * findByFirstName($firstName)
  45. * findByContribution($contributionName)
  46. * findByDeadBefore($year)
  47. 1. Define and create a service "BiosService" under namespace Test/InterviewBundle/Services and implement following methods
  48. * getAllAwards()
  49. * Use the logger to log operations (error, warning, debug)
  50. 1. Create ContributionsController under namespace Test/InterviewBundle/Controller
  51. 1. Add a contributionsAction method to your ContributionsController
  52. * for route `/contributions`
  53. * make a use of your BiosService
  54. * avoid logic under controller
  55. * method should list all contributions
  56. * with a proper json return `["contrib", ...]`
  57. 1. Add a biosByContributionAction method to your ContributionsController
  58. * for route `/contributions/{contributionName}`
  59. * make a use of your BiosService
  60. * avoid logic under controller
  61. * method should list all bios documents with provided contribution
  62. * with a proper json return `[{...}]`
  63. 1. make a unit test for the controller
  64. * check if route `/hello` has response code 200
  65. * check if route `/hello` response is a json
  66. * check if route `/contributions` has response code 200
  67. * check if route `/contributions/fake` has response code 404
  68. * check if route `/contributions/OOP` has response code 200
  69. 1. make a unit test for the BiosService
  70. * at least 1 method of your choice
  71. 1. write a command called `test:command` that should accept 1 argument called id under namespace Test/InterviewBundle/Command
  72. * The command should check if a Bios document with an id of the argument exists
  73. * if document exists, return info "document exists"
  74. * if document doesnt exist, return error "document doesnt exist"
  75. ## Bonus tasks
  76. 1. Go to app/config/config.yml and add the following yaml structure. **(NOTICE: ping is as child-key of test)**
  77. ```
  78. test:
  79. ping: pong
  80. ```
  81. 1. Check the symfony application for errors and fix them if any.
  82. 1. write a prompt for the command `test:command`
  83. * Prompt text is "This is a test. Do you want to continue (y/N) ?"
  84. * If you decline, return error "Nothing done. Exiting..."
  85. * If you accept, run the command
  86. # That's it!
  87. ## Thank you for your participation! Good luck submitting your results!