Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertMethodWiredToAction switched params #41

Open
lfnincao opened this issue Oct 28, 2024 · 7 comments
Open

assertMethodWiredToAction switched params #41

lfnincao opened this issue Oct 28, 2024 · 7 comments

Comments

@lfnincao
Copy link
Contributor

At least these two methods have their params switched up (methodName, action) should be (action, methodName)
assertMethodWiredToAction() and assertMethodNotWiredToAction()

@christophrumpel
Copy link
Owner

Hey, why should they be switched? 🤔

@lfnincao
Copy link
Contributor Author

Hey, because the $action is in place of $methodName and vice-versa. It should be wire:$action=$methodName

public function assertMethodWiredToAction(): Closure
    {
        return function (string $methodName, string $action) {
            PHPUnit::assertMatchesRegularExpression(
                '/wire:' . $methodName . '?=(?<q>"|\')'.preg_quote($action).'(\s*\(.+\)\s*)?\s*(\k\'q\')/',
                $this->html()
            );

            return $this;
        };
    }

   public function assertMethodNotWiredToAction(): Closure
    {
        return function (string $methodName, string $action) {
            PHPUnit::assertDoesNotMatchRegularExpression(
                '/wire:' . $methodName . '?=(?<q>"|\')'.preg_quote($action).'(\s*\(.+\)\s*)?\s*(\k\'q\')/',
                $this->html()
            );

            return $this;
        };
    }

@christophrumpel
Copy link
Owner

Oh I see, you are absolutely right 🙀 Would you be willing to make a PR to fix it?

@lfnincao
Copy link
Contributor Author

Definitely, will do. Thank you!

@christophrumpel
Copy link
Owner

Thank you 🙏

@lfnincao
Copy link
Contributor Author

lfnincao commented Oct 29, 2024

I don't have the permissions

ERROR: Permission to christophrumpel/missing-livewire-assertions.git denied to lfnincao.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

@christophrumpel
Copy link
Owner

Hey, did you fork the project? Then you can do a Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants