-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for OPTIONS method (#19)
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Firehed\API\Traits\Request; | ||
|
||
use Firehed\API\Enums\HTTPMethod; | ||
|
||
trait Options | ||
{ | ||
|
||
public function getMethod(): HTTPMethod | ||
{ | ||
return HTTPMethod::OPTIONS(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\Options | ||
* @covers ::<protected> | ||
* @covers ::<private> | ||
*/ | ||
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' | ||
); | ||
} | ||
} |