Skip to content

Commit a338610

Browse files
committed
feat: add CLIRequest::is()
We need the same method in CLIRequest because Controller can be run via CLI.
1 parent 08e9377 commit a338610

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

system/HTTP/CLIRequest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,4 +304,15 @@ public function getLocale(): string
304304
{
305305
return Locale::getDefault();
306306
}
307+
308+
/**
309+
* Checks this request type.
310+
*
311+
* @param string $type HTTP verb or 'json' or 'ajax'
312+
* @phpstan-param string|'get'|'post'|'put'|'delete'|'head'|'patch'|'options'|'json'|'ajax' $type
313+
*/
314+
public function is(string $type): bool
315+
{
316+
return false;
317+
}
307318
}

tests/system/HTTP/CLIRequestTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,4 +625,9 @@ public function testGetCookie()
625625

626626
$this->assertSame($this->request->getCookie(), []);
627627
}
628+
629+
public function testIs()
630+
{
631+
$this->assertFalse($this->request->is('get'));
632+
}
628633
}

0 commit comments

Comments
 (0)