Skip to content

Add test fixtures using rector#282

Merged
j0k3r merged 4 commits intoj0k3r:masterfrom
jtojnar:rector
Jan 24, 2022
Merged

Add test fixtures using rector#282
j0k3r merged 4 commits intoj0k3r:masterfrom
jtojnar:rector

Conversation

@jtojnar
Copy link
Copy Markdown
Collaborator

@jtojnar jtojnar commented Jan 7, 2022

Use composer rector (or composer rector -- --dry-run) to run the automated refactoring.

@j0k3r
Copy link
Copy Markdown
Owner

j0k3r commented Jan 7, 2022

Maybe you can separate the code improvement (fn, ??, etc.) in a separate PR to reduce the noise?

@jtojnar
Copy link
Copy Markdown
Collaborator Author

jtojnar commented Jan 7, 2022

I can separate them out but then CI will not pass. It should still be feasible to review commit by commit.

@jtojnar
Copy link
Copy Markdown
Collaborator Author

jtojnar commented Jan 7, 2022

Or I can move the ci commit to the new PR too.

@jtojnar jtojnar force-pushed the rector branch 8 times, most recently from 9b33a51 to d7a7e9b Compare January 7, 2022 19:25
@jtojnar jtojnar marked this pull request as draft January 7, 2022 19:33
@jtojnar
Copy link
Copy Markdown
Collaborator Author

jtojnar commented Jan 7, 2022

Removed the ci part for now.

Still need to replace file_get_contents with actual fetchContent and capture the resources.

@jtojnar jtojnar marked this pull request as ready for review January 8, 2022 03:39
@jtojnar
Copy link
Copy Markdown
Collaborator Author

jtojnar commented Jan 8, 2022

I got nerd sniped quite hard by this but I had this on to-do list for few other projects. Now running composer rector should automatically add fixtures for fetchContent calls on Graby constructed without a second argument.

Copy link
Copy Markdown
Owner

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get everything about Rector (never used it).
What I understand if I add a new functional test is I'll need to run it once and then the fixture html will be generated and I'll need to update the functional test to use the fixture.
Am I right ?
If so, how do you catch headers you added in the test file?

@jtojnar
Copy link
Copy Markdown
Collaborator Author

jtojnar commented Jan 10, 2022

Rector is a tool for automated code transformation. The transformation rule runs Graby and extract headers using RecordingHttpClient will also update the functional tests – the last commit is fully produced by the transformation rule without any manual changes.

@jtojnar
Copy link
Copy Markdown
Collaborator Author

jtojnar commented Jan 10, 2022

If you check out the PR, you can try it yourself by removing the last commit and running composer rector. (Comment out this line if you do not want the code modernization.)

@jtojnar jtojnar force-pushed the rector branch 2 times, most recently from f5fab22 to d4bffa8 Compare January 11, 2022 19:14
@j0k3r
Copy link
Copy Markdown
Owner

j0k3r commented Jan 24, 2022

Can you rebase against the master?
And it'll be good to merge

@j0k3r j0k3r merged commit f42dc7b into j0k3r:master Jan 24, 2022
@j0k3r
Copy link
Copy Markdown
Owner

j0k3r commented Jan 24, 2022

Good job @jtojnar 👊

@jtojnar jtojnar deleted the rector branch January 24, 2022 14:41
@j0k3r j0k3r added this to the 3.0.0 milestone Jan 31, 2022
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.

2 participants