christophrumpel / missing-livewire-assertions

Adding the missing Livewire assertions to your Laravel project
MIT License
136 stars 25 forks source link

assertMethodWiredToAction switched params #41

Open lfnincao opened 1 month ago

lfnincao commented 1 month ago

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

christophrumpel commented 1 month ago

Hey, why should they be switched? 🤔

lfnincao commented 1 month ago

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 commented 1 month ago

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

lfnincao commented 1 month ago

Definitely, will do. Thank you!

christophrumpel commented 1 month ago

Thank you 🙏

lfnincao commented 1 month ago

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 commented 1 month ago

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