In my tests, I am forcing Stripe to fail by giving it a bogus API key, so that I can test the error logging etc.
However, when I have Aspect Mock enabled, it seems that due to some internal reflection, Stripe's actual error message is being tampered with. Instead of seeing:
[Stripe\Exception\AuthenticationException] Invalid API Key provided: boguskey
which is what I see when AspectMock is totally removed from my project, instead, I get:
[InvalidArgumentException] Class Stripe\Exception\ExceptionInterface was not found in the /path/to/stripe/vendor/files
You can see it goes straight to /work/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38.
I should say that when using my correct Stripe API key (and no exceptions are thrown), my code connects fine to Stripe and does what it is supposed to on their platform.
I am using PHP-Unit 8.5, Codeception 3.1.2, Aspect Mock 3.1.0. Will upgrading to the latest versions of PHPUnit/CodeCeption make any difference? Suggestions?
In my tests, I am forcing Stripe to fail by giving it a bogus API key, so that I can test the error logging etc.
However, when I have Aspect Mock enabled, it seems that due to some internal reflection, Stripe's actual error message is being tampered with. Instead of seeing:
which is what I see when AspectMock is totally removed from my project, instead, I get:
Here is the trace:
It seems that when Stripe hits my (intentional) error, it gets rerouted into the internals of
AspectMock
and gets lost.This is the trace when AspectMock is disabled:
You can see it goes straight to
/work/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38
.I should say that when using my correct Stripe API key (and no exceptions are thrown), my code connects fine to Stripe and does what it is supposed to on their platform.
I am using PHP-Unit 8.5, Codeception 3.1.2, Aspect Mock 3.1.0. Will upgrading to the latest versions of PHPUnit/CodeCeption make any difference? Suggestions?