From e73a960244d31f83ea7cb60c84ad39fc40c37b60 Mon Sep 17 00:00:00 2001 From: Lucas Nincao Date: Mon, 4 Nov 2024 01:02:48 -0800 Subject: [PATCH] fix params order for assertMethodNotWiredToAction and assertMethodWiredToAction (#42) --- .stubs.php | 6 +++--- src/CustomLivewireAssertionsMixin.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.stubs.php b/.stubs.php index 71e6213..7e392cb 100644 --- a/.stubs.php +++ b/.stubs.php @@ -15,9 +15,9 @@ public function assertMethodWired(string $method): self {} public function assertMethodNotWired(string $method): self {} - public function assertMethodWiredToAction(string $methodName, string $action): self {} + public function assertMethodWiredToAction(string $action, string $methodName): self {} - public function assertMethodNotWiredToAction(string $methodName, string $action): self {} + public function assertMethodNotWiredToAction(string $action, string $methodName): self {} public function assertMethodWiredToForm(string $method): self {} @@ -44,7 +44,7 @@ public function assertSeeBefore($valueBefore, $valueAfter): self {} public function assertDoNotSeeBefore($valueBefore, $valueAfter): self {} public function assertFileDownloadedContains($content): self {} - + public function assertFileDownloadedNotContains($content): self {} } } diff --git a/src/CustomLivewireAssertionsMixin.php b/src/CustomLivewireAssertionsMixin.php index 17ef990..48f2b8a 100644 --- a/src/CustomLivewireAssertionsMixin.php +++ b/src/CustomLivewireAssertionsMixin.php @@ -123,9 +123,9 @@ public function assertMethodNotWired(): Closure */ public function assertMethodWiredToAction(): Closure { - return function (string $methodName, string $action) { + return function (string $action, string $methodName) { PHPUnit::assertMatchesRegularExpression( - '/wire:' . $methodName . '?=(?"|\')'.preg_quote($action).'(\s*\(.+\)\s*)?\s*(\k\'q\')/', + '/wire:' . $action . '?=(?"|\')'.preg_quote($methodName).'(\s*\(.+\)\s*)?\s*(\k\'q\')/', $this->html() ); @@ -138,9 +138,9 @@ public function assertMethodWiredToAction(): Closure */ public function assertMethodNotWiredToAction(): Closure { - return function (string $methodName, string $action) { + return function (string $action, string $methodName) { PHPUnit::assertDoesNotMatchRegularExpression( - '/wire:' . $methodName . '?=(?"|\')'.preg_quote($action).'(\s*\(.+\)\s*)?\s*(\k\'q\')/', + '/wire:' . $action . '?=(?"|\')'.preg_quote($methodName).'(\s*\(.+\)\s*)?\s*(\k\'q\')/', $this->html() );