So I have integrated Omnipay Paypal and it redirects successfully but I wanted to write some PHPUnit code to check that a redirect happens but I seem to be having problems working out a way to test it.
My code that I'm trying to test is as follows:
$paypal = new PayPal;
$response = $paypal->purchase(request()->all(), Cart::total());
if ($response->isRedirect()) {
$response->redirect();
}
So I'm trying to check for a redirect in PHPUnit but it doesn't seem to be doing one?
Is there a way for me to test that my code is actually redirecting users?
The code in the file AbstractResponse.php for Omnipay calls the following:
public function redirect()
{
$this->getRedirectResponse()->send();
}
If I do dd($this->getRedirectResponse()->send()); then I can see that there is a redirect there and can see the #targetURL etc but if I do dd($response->redirect()) in my code, it returns null. Tres confused!
Hi,
So I have integrated Omnipay Paypal and it redirects successfully but I wanted to write some PHPUnit code to check that a redirect happens but I seem to be having problems working out a way to test it.
My code that I'm trying to test is as follows:
So I'm trying to check for a redirect in PHPUnit but it doesn't seem to be doing one?
And the redirect text just gets dumped in to the unit test as follows:
Is there a way for me to test that my code is actually redirecting users?
The code in the file AbstractResponse.php for Omnipay calls the following:
If I do
dd($this->getRedirectResponse()->send());
then I can see that there is a redirect there and can see the #targetURL etc but if I dodd($response->redirect())
in my code, it returns null. Tres confused!