Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/Enums/HTTPMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
*/
Expand All @@ -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';
Expand Down
14 changes: 14 additions & 0 deletions src/Traits/Request/Patch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);

namespace Firehed\API\Traits\Request;

use Firehed\API\Enums\HTTPMethod;

trait Patch
{
public function getMethod(): HTTPMethod
{
return HTTPMethod::PATCH();
}
}
28 changes: 28 additions & 0 deletions tests/Traits/Request/PatchTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);

namespace Firehed\API\Traits\Request;

/**
* @coversDefaultClass Firehed\API\Traits\Request\Patch
* @covers ::<protected>
* @covers ::<private>
*/
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'
);
}
}