PHP interview question

Go back

Using your choice of PHP framework (Laravel, Lumen, Kohana, Silex, etc) or testing suite (phpunit)

create a separate class, called “Database” with a method “getMessage()”
which returns “Cohesion Digital”.

Create an other class, called “Servlet”, which uses this class to print out the return value of Database’s getMessage().

Implement a dependency injection pattern to use Database inside Servlet when Servlet is instantiated. You can instantiate the servlet using an Object Manager or Factory or unit test.

Make sure the code is tidy for review. Push it to a public GitHub (or
Bitbucket) repository and send us the link.

lets create something great

Get in touch and send some basic info for a quick quote.

Start Your Project

cohesion Events

Invite only eCommerce events in in Leeds, Manchester, Liverpool London, Glasgow

Register for an invite