File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class HTTPMethod extends Enum
1515 const POST = 'POST ' ;
1616 const PUT = 'PUT ' ;
1717 const DELETE = 'DELETE ' ;
18+ const OPTIONS = 'OPTIONS ' ;
1819
1920 public function __toString ()
2021 {
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace Firehed \API \Traits \Request ;
5+
6+ use Firehed \API \Enums \HTTPMethod ;
7+
8+ trait Options
9+ {
10+
11+ public function getMethod (): HTTPMethod
12+ {
13+ return HTTPMethod::OPTIONS ();
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace Firehed \API \Traits \Request ;
5+
6+ /**
7+ * @coversDefaultClass Firehed\API\Traits\Request\Options
8+ * @covers ::<protected>
9+ * @covers ::<private>
10+ */
11+ class OptionsTest extends \PHPUnit \Framework \TestCase
12+ {
13+
14+ /**
15+ * @covers ::getMethod
16+ */
17+ public function testGetMethod ()
18+ {
19+ $ obj = new class {
20+ use Options;
21+ };
22+ $ this ->assertEquals (
23+ \Firehed \API \Enums \HTTPMethod::OPTIONS (),
24+ $ obj ->getMethod (),
25+ 'getMethod did not return HTTP OPTIONS '
26+ );
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments