-
Notifications
You must be signed in to change notification settings - Fork 7
Use data objects that are documented for the transaction object. #45
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
base: master
Are you sure you want to change the base?
Conversation
@m50 sorry for getting back to you late on this and I really appreciate your contribution! I haven't had a chance to look into why the build is failing. I won't have time to dig into that until Friday but I will be reviewing this soon. Making the experience of writing hooks easier through enhanced static analyzability is awesome, so I'm open to accepting this change. I just want to spend some time fixing the build before I do a more thorough review. |
@m50 please rebase on master now that I've fixed the majority of the issues with the test suite. The build still won't pass but I'll be able to do any additional verification now that master is in a much better state. More details on #46. Once your change is rebased I'll be able to quickly review this. |
This allows for in-IDE documentation and static analysis of the transaction objects on the hooks.
013e7b6
to
8732efc
Compare
@ddelnano sorry for the delay, been taking a break from the computer on the first week of my vacation, so just got to it now. I rebased and re-pushed. Cucumber checks are still failing, as you said, but it's now matching master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor comments. However, I would like to have a Cucumber test that uses the new function signature. You can find an example here. Let me know if you have any questions about implementing that. Running a single Cucumber test case with `npx cucumber-js features/name-of-your-feature-file.feature --require features/support/ --tags 'not @Skip'`` from inside the project's Docker container would be the easiest way to run the test interactively.
Ok, I'm out of town atm, so I'll make some cucumber tests when I get back. 👍 |
This allows for easier ability to work with it. Cast the headers to an array in the construct, and define the type hint as a string=>string array.
This is necessary, or else cucumber tests will fail.
@ddelnano I added a phpunit test as well as a cucumber test. Oddly, the cucumber test fails in the docker container, but not locally or in Travis. It complains about port already in use. Unsure what could be causing that, but figured I'd let you know. Additionally, the docker container didn't have dredd installed in it, so to get the tests to run, I had to install dredd inside of it. |
Any update on this? |
Mostly just waiting for a response from @ddelnano. Dunno why it says that all checks have failed, considering last time I looked at this back in June, it was passing. |
When writing hooks, I noticed it was hard to figure out what I could modify and what I had access to, without digging through the Dredd docs.
While you can't get everything (you don't know what the body looks like, or what headers exist, for example), it helps a lot to have some static analyzability and documentation in editor.
This doesn't change any behaviour in the hooks, it just allows hooks to be read as documented objects.
This will mean, if you do
$transaction->
in PHPStorm or VSCode, you can see what values (and types) exist on the transaction object from in your editor.This should be backwards compatible as well, since, the internal data structure hasn't changed.
All values are public properties, so that json_serialize can still read them, and so that they are accessed the same way.
Now, when writing hooks, if you write:
You will now have full readability.