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

[8.x] Added assertRedirectContains #39233

Merged
merged 2 commits into from
Oct 18, 2021
Merged

[8.x] Added assertRedirectContains #39233

merged 2 commits into from
Oct 18, 2021

Conversation

Livijn
Copy link
Contributor

@Livijn Livijn commented Oct 17, 2021

This adds the ability to call assertRedirectContains() on the TestResponse. For example when using Cashier, one might use return Auth::user()->redirectToBillingPortal(); which redirects to a url like https://billing.stripe.com/session/_KOsvPyL7ZaTxYiyD8sHhfm4ZK6ewPJ8.

This is continuation from #39189

Before

$response = $this->get(route('checkout']))->assertRedirect();

$this->assertStringContainsString('https://checkout.stripe.com/', $response->headers->get('Location'));

After

$this->get(route('checkout']))
    ->assertRedirectContains('checkout.stripe.com');

@GrahamCampbell GrahamCampbell changed the title Added assertRedirectContains [8.x] Added assertRedirectContains Oct 17, 2021
@taylorotwell taylorotwell merged commit 06ac29b into laravel:8.x Oct 18, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants