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

KernelBrowser::clickAndValidate() #83

Open
kbond opened this issue Apr 7, 2022 · 0 comments
Open

KernelBrowser::clickAndValidate() #83

kbond opened this issue Apr 7, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kbond
Copy link
Member

kbond commented Apr 7, 2022

The idea is to click a form submit and ensure there are no validation errors. If there are, fail.

public function clickAndValidate(string $locator): self
{
    return $this->clickAndIntercept($locator)
        ->use(function (ValidatorDataCollector $collector) {
            Assert::that($collector->getViolationsCount())
                ->isEmpty('There were {actual} validation violations.')
            ;
        })
    ;
}

Displaying the actual violations (not just the count) would be nice but the ValidatorDataCollector makes this difficult as the violations are inside a Symfony\Component\VarDumper\Cloner\Data object. One possibility is to actually dump this but there is a lot of other data in here that isn't terribly useful and would just clutter your console.

@kbond kbond added the enhancement New feature or request label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant