Closed ostark closed 1 year ago
The full demo to understand the issue better https://github.com/fortrabbit/spoke-and-chain-pestphp/tree/pest/tests/Feature
I'll clone it down and have a look. I have a // @todo
to better handle URL/URI parsing in the request builder so I think I know where Yii is getting tripped up.
So far submit()
creates a new POST request, follows a redirect, and returns a 200 OK, which is a bit unexpected to me.
I'd prefer something like this
# no redirect, but assertions allowed
->submit()
->assertRedirectTo('/checkout/next-step')
# to support further chaining
->submit()
->assertRedirectTo('/checkout/next-step')
->follow()
Well that is surprising. I'm not sure why it's following that redirect. I'll take a look. Agreed that being explicit about following redirects is the right choice.
Yuck, I believe the issue is that Craft's {% redirect %}
tag (and other redirect methods) throw a ->end()
in there which is short circuiting the RequestHandler
's logic. Will look for an override.
It's that ->end()
on line 39 of this compiled Twig template that causes issues.
OverwriteEverything ™
Yup, I have a fix. There's a YII_ENV_TEST
var that skips the exit()
I just need to catch the exception that is thrown instead. Working on the ->follow()
side of things next.
Should be fixed with https://github.com/markhuot/craft-pest/pull/33. Waiting on the test suite to run.
This is merged. I'm going to close this issue. Feel free to reopen if you're still having problems.
This test does not pass
Since there is no action attribute on the form element, I tried to tweak it the submit() method
... but without success.
the
->getFields()
output looks okayAny idea?