From 357a8299576e212436e598df5a83c3ff466948c5 Mon Sep 17 00:00:00 2001 From: oscarotero Date: Tue, 22 Nov 2016 22:05:17 +0100 Subject: [PATCH] updated http-middleware interface to 0.3 --- CHANGELOG.md | 6 ++++++ README.md | 4 +--- composer.json | 7 +++---- tests/BasePathTest.php | 7 ++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e13babe..35c86f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 0.2.0 - 2016-11-22 + +### Changed + +* Updated to `http-interop/http-middleware#0.3` + ## 0.1.1 - 2016-10-02 ### Fixed diff --git a/README.md b/README.md index daab0a1..7071cd0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # middlewares/base-path [![Latest Version on Packagist][ico-version]][link-packagist] -[![Software License][ico-license]](LICENSE.md) +[![Software License][ico-license]](LICENSE) [![Build Status][ico-travis]][link-travis] [![Quality Score][ico-scrutinizer]][link-scrutinizer] [![Total Downloads][ico-downloads]][link-downloads] @@ -9,8 +9,6 @@ Middleware to remove the prefix from the uri path of the request. This is useful to combine with routers if the root of the website is in a subdirectory. For example, if the root of your website is `/web/public`, a request with the uri `/web/public/post/34` will be converted to `/post/34`. -**Note:** This middleware is intended for server side only - ## Requirements * PHP >= 5.6 diff --git a/composer.json b/composer.json index 4d7291e..f480cf4 100644 --- a/composer.json +++ b/composer.json @@ -16,15 +16,14 @@ }, "require": { "php": "^5.6 || ^7.0", - "http-interop/http-middleware": "^0.2", - "middlewares/utils": "0.*" + "http-interop/http-middleware": "^0.3", + "middlewares/utils": "~0.5" }, "require-dev": { "phpunit/phpunit": "^5.5", "zendframework/zend-diactoros": "^1.3", "friendsofphp/php-cs-fixer": "^1.12", - "squizlabs/php_codesniffer": "^2.7", - "mindplay/middleman": "^2.0" + "squizlabs/php_codesniffer": "^2.7" }, "autoload": { "psr-4": { diff --git a/tests/BasePathTest.php b/tests/BasePathTest.php index ea9ede8..a2ca2b7 100644 --- a/tests/BasePathTest.php +++ b/tests/BasePathTest.php @@ -3,9 +3,10 @@ namespace Middlewares\Tests; use Middlewares\BasePath; +use Middlewares\Utils\Dispatcher; +use Middlewares\Utils\CallableMiddleware; use Zend\Diactoros\ServerRequest; use Zend\Diactoros\Response; -use mindplay\middleman\Dispatcher; class BasePathTest extends \PHPUnit_Framework_TestCase { @@ -61,12 +62,12 @@ public function testBasePath($basePath, $uri, $result, $location) $response = (new Dispatcher([ (new BasePath($basePath))->fixLocation(), - function ($request) { + new CallableMiddleware(function ($request) { $response = new Response(); $response->getBody()->write((string) $request->getUri()->getPath()); return $response->withHeader('Location', (string) $request->getUri()); - }, + }), ]))->dispatch($request); $this->assertInstanceOf('Psr\\Http\\Message\\ResponseInterface', $response);