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

Validation Rule try/catch mismatch causes passed exception #22

Open
thumbtech opened this issue Feb 19, 2024 · 2 comments
Open

Validation Rule try/catch mismatch causes passed exception #22

thumbtech opened this issue Feb 19, 2024 · 2 comments

Comments

@thumbtech
Copy link

In ValueObjects/Url.php __construct you are throwing InvalidArgumentException but your try new Url($value) in Rules/EmbeddableUrl.php is catching ServiceNotFoundException so the exception is thrown.

@thumbtech
Copy link
Author

Also FWIW Illuminate\Contracts\Validation\Rule is being deprecated in favor of Illuminate\Contracts\Validation\ValidationRule

@thumbtech
Copy link
Author

If you update test_it_fails_for_an_invalid_url in EmbeddableUrlTest.php like so, your test will fail

    public function test_it_fails_for_an_invalid_url()
    {
        $this->assertFalse(
            (new EmbeddableUrl)
                ->passes('', '[xyz]')
        );
    }

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

1 participant