Giter Site home page Giter Site logo

http-client-server-test's Introduction

http-client-server-test

By Pillr Inc.

A small test which challenges our candidates to set-up a basic php environment, implement PSR-7 Interfaces and pass the unit tests. The master code will contain enough to get you started.

PSR-7 "describes common interfaces for representing HTTP messages as described in RFC 7230 and RFC 7231, and URIs for use with HTTP messages as described in RFC 3986." See PSR-7: HTTP message interfaces - PHP-FIG

PSR-7 Interface specifications are located at library/http/interfaces.

PSR-7 class implementations are located at library/http/classes. These classes are intentionally left as shell classes that are not complete.

####Technology

This small test aims to provide a basic utilization of:

  • HTTP Protocol
  • Domain-driven design
  • Test-driven development
  • RFC Specification implementation
  • Client-Server architecture
  • Package Management and autoloading
  • PHP Object-Oriented Programming
  • URI Syntax Parsing

###Requirements

This is all that is required to be submitted.

  1. Branch this project (name it with '<your name>-submission').
  2. Serve the project locally as a web service. This means the index.php script can be requested via HTTP. At Pillr, we use NGINX w/ PHP-FPM for PHP applications. However, PHP has it's own web server; which could be used, as well as, Apache w/ mod-php. However you prefer your local setup is up to you and of no consequence other than the HTTP header Server which should reflect your HTTP server choice during your development.
  3. Pass the PHP-UNIT tests in the tests folder.
  4. index.php - The application root script. This root script must respond to a HTTP Client (ex. web browser or curl) Request to the application using the URI http://<HOST-NAME>/index.php . All functionality should be performed by some combination of the implementation classes. This script must finally return a HTTP Response of:
HTTP/1.1 200 OK
Date: <NOW-DATE-TIME-STRING>
Server: <SERVER-PROVIDING-THE-RESPONSE>
Last-Modified: <LAST-TIME-CONTENT-MODIFIED-DATE-TIME-STRING>
Content-Length: <MESSAGE-BODY-STRING-LENGTH>
Content-Type: application/json
{
    "@id": "<URI-THAT-WAS-REQUESTED>",
    "to": "Pillr",
    "subject": "Hello Pillr",
    "message": "Here is my submission.",
    "from": "<YOUR-NAME>",
    "timeSent": "<TIMESTAMP>"
}

Note: tagged strings like "<TAG-HERE>" are variables placeholders for values you provide.

Tip: 'Date' and 'Last-Modified' use the date format string is 'D, d M Y H:i:s T'.

We don't discourage any approach to this problem. For example, one can show efficiency and decisiveness in doing the bare minimum to accomplish the Requirements; In contrast, one could decide to show that they are capable of going beyond the mean and delivering a more robust solution. There is an exemplary example in many approaches.

####Install PHPUnit on your system to complement your php command-line utilities See: Installing PHPUnit

####OR

####Install PHPUnit only for this project via Composer Install packages via Composer.

Add "phpunit/phpunit": "5.3.*" to the "require-dev" property

{
 ...
    "require-dev": {
        ...
        "phpunit/phpunit": "5.3.*"
        ...
    }
  ...
}

Any questions or review requests can be directed to [email protected]

###Reference Material

http-client-server-test's People

Contributors

jason-reinert avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.