From 7f8ee1288a10a4defb60b13a58599fba826c4519 Mon Sep 17 00:00:00 2001 From: Kai Dederichs Date: Fri, 25 Feb 2022 13:59:55 +0100 Subject: [PATCH 1/2] Add patch shortcut to browserkit browser --- src/Browser/BrowserKitBrowser.php | 12 ++++++++++++ tests/BrowserKitBrowserTests.php | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/Browser/BrowserKitBrowser.php b/src/Browser/BrowserKitBrowser.php index 53cfd37..e47d9c8 100644 --- a/src/Browser/BrowserKitBrowser.php +++ b/src/Browser/BrowserKitBrowser.php @@ -170,6 +170,18 @@ final public function delete(string $url, $options = []): self return $this->request('DELETE', $url, $options); } + /** + * @see request() + * + * @param HttpOptions|array $options + * + * @return static + */ + final public function patch(string $url, $options = []): self + { + return $this->request('PATCH', $url, $options); + } + /** * @return static */ diff --git a/tests/BrowserKitBrowserTests.php b/tests/BrowserKitBrowserTests.php index 025f699..cefda87 100644 --- a/tests/BrowserKitBrowserTests.php +++ b/tests/BrowserKitBrowserTests.php @@ -180,6 +180,9 @@ public function http_method_actions(): void ->post('/http-method') ->assertSuccessful() ->assertContains('"method":"POST"') + ->patch('/http-method') + ->assertSuccessful() + ->assertContains('"method":"PATCH"') ->delete('/http-method') ->assertSuccessful() ->assertContains('"method":"DELETE"') From 2d0191d235fb794f172fcd97346a13c765951744 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Fri, 25 Feb 2022 08:18:27 -0500 Subject: [PATCH 2/2] fix phpstan --- phpstan-baseline.neon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 401d12e..0b8797e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -65,6 +65,11 @@ parameters: count: 1 path: src/Browser/BrowserKitBrowser.php + - + message: "#^Method Zenstruck\\\\Browser\\\\BrowserKitBrowser\\:\\:patch\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Browser/BrowserKitBrowser.php + - message: "#^Method Zenstruck\\\\Browser\\\\BrowserKitBrowser\\:\\:post\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1