From 01420e9b905137dc67b5f501de9fcc42f8e944c8 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 19 Sep 2018 14:21:20 -0700 Subject: [PATCH] Add PATCH support --- CHANGELOG.md | 7 +++++++ src/Enums/HTTPMethod.php | 2 ++ src/Traits/Request/Patch.php | 14 ++++++++++++++ tests/Traits/Request/PatchTest.php | 28 ++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 src/Traits/Request/Patch.php create mode 100644 tests/Traits/Request/PatchTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 55082dc..05f0f39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - `Traits\PostRequest` - `Traits\PutRequest` +## [3.2.0] - 2018-09-19 +### Summary +- Added support for `PATCH` HTTP method + +### Added +- `Traits\Request\Patch` + ## [3.1.0] - 2018-07-01 ### Summary - Overhauled authentication (#43) diff --git a/src/Enums/HTTPMethod.php b/src/Enums/HTTPMethod.php index 66464ed..3f13b77 100644 --- a/src/Enums/HTTPMethod.php +++ b/src/Enums/HTTPMethod.php @@ -10,6 +10,7 @@ * @method static HTTPMethod DELETE() * @method static HTTPMethod GET() * @method static HTTPMethod OPTIONS() + * @method static HTTPMethod PATCH() * @method static HTTPMethod POST() * @method static HTTPMethod PUT() */ @@ -19,6 +20,7 @@ class HTTPMethod extends Enum // Other methods exist, but these are the only relevant ones for RESTful // APIs const GET = 'GET'; + const PATCH = 'PATCH'; const POST = 'POST'; const PUT = 'PUT'; const DELETE = 'DELETE'; diff --git a/src/Traits/Request/Patch.php b/src/Traits/Request/Patch.php new file mode 100644 index 0000000..c0db3fc --- /dev/null +++ b/src/Traits/Request/Patch.php @@ -0,0 +1,14 @@ + + * @covers :: + */ +class PatchTest extends \PHPUnit\Framework\TestCase +{ + + /** + * @covers ::getMethod + */ + public function testGetMethod() + { + $obj = new class { + use Patch; + }; + $this->assertEquals( + \Firehed\API\Enums\HTTPMethod::PATCH(), + $obj->getMethod(), + 'getMethod did not return HTTP PATCH' + ); + } +}