From c0877986c34c800d0abe256b3b67541284e74412 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Fri, 23 Feb 2018 11:08:28 -0800 Subject: [PATCH] Add support for OPTIONS method (#19) --- src/Enums/HTTPMethod.php | 1 + src/Traits/Request/Options.php | 15 +++++++++++++++ tests/Traits/Request/OptionsTest.php | 28 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 src/Traits/Request/Options.php create mode 100644 tests/Traits/Request/OptionsTest.php diff --git a/src/Enums/HTTPMethod.php b/src/Enums/HTTPMethod.php index 2dbacbf..c7a5b52 100644 --- a/src/Enums/HTTPMethod.php +++ b/src/Enums/HTTPMethod.php @@ -15,6 +15,7 @@ class HTTPMethod extends Enum const POST = 'POST'; const PUT = 'PUT'; const DELETE = 'DELETE'; + const OPTIONS = 'OPTIONS'; public function __toString() { diff --git a/src/Traits/Request/Options.php b/src/Traits/Request/Options.php new file mode 100644 index 0000000..580f44d --- /dev/null +++ b/src/Traits/Request/Options.php @@ -0,0 +1,15 @@ + + * @covers :: + */ +class OptionsTest extends \PHPUnit\Framework\TestCase +{ + + /** + * @covers ::getMethod + */ + public function testGetMethod() + { + $obj = new class { + use Options; + }; + $this->assertEquals( + \Firehed\API\Enums\HTTPMethod::OPTIONS(), + $obj->getMethod(), + 'getMethod did not return HTTP OPTIONS' + ); + } +}