Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.
/ noriko Public archive

One file Lumen app for HTTP client testing

License

Notifications You must be signed in to change notification settings

matical/noriko

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noriko

** incomplete doc **

A super basic httpbin-like, one file lumen app that spits back whatever you send. Usually used for HTTP Client library testing.

Usage

You should think of this more as a template/skeleton instead of a library. This repo is meant to be cloned into the test directory of whatever project you have.

Setup

  • Clone this repo into your test directory of your project
  • Put laravel/lumen-framework in your require-dev.
    • This was written with lumen ^5.6 but you should be good with any 5.x if you're using an older version of lumen (because conflicts)
  • Edit the following
    • Server.php - Replace namespace with whatever your test suite is using.
    • public/lumen.php - Appropriate path to your project's vendor/autoload.php
  • Boot the server with Server::boot(). You would call this from whatever fixture method you have.

So for something like PHPUnit, you would place this call in setUpBeforeClass(). You don't need to worry about tearing down the process as a register_shutdown_function() is registered that automatically cleans up when the test has ended.

You should also add the directory to your exclude list (in phpunit.xml).

public static function setUpBeforeClass()
{
    Server::boot(getenv('TEST_LUMEN_PORT'));
}

Endpoints

/{HTTP Verb}

e.g. /get, /post

{
    "method": "GET",
    "headers": {},
    "query_strings": [],
    "form_params": [],
    "json_payload": []
}

About

One file Lumen app for HTTP client testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages