-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
[make:webhook] Add new command for Symfony's Webhook Component #1491
[make:webhook] Add new command for Symfony's Webhook Component #1491
Conversation
3c3aead
to
7889de5
Compare
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.
This is looking pretty nifty @maelanleborgne - a few suggestions and I think we'll be in good shape..
src/Maker/MakeWebhook.php
Outdated
$choices = array_diff($availableMatchers, $addedMatchers); | ||
$question = new ChoiceQuestion($questionText, array_values(['<skip>'] + $choices), 0); | ||
$matcherName = $io->askQuestion($question); | ||
if ('<skip>' === $matcherName) { | ||
return null; |
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.
Do the same for other parts of this maker: Let's add so more spacing within the code. grouping multiple single line variable declarations is A-OK. But using that enter button between multi-line declarations, conditionals, etc... improves readability..
$choices = array_diff($availableMatchers, $addedMatchers); | |
$question = new ChoiceQuestion($questionText, array_values(['<skip>'] + $choices), 0); | |
$matcherName = $io->askQuestion($question); | |
if ('<skip>' === $matcherName) { | |
return null; | |
$choices = array_diff($availableMatchers, $addedMatchers); | |
$question = new ChoiceQuestion($questionText, array_values(['<skip>'] + $choices), 0); | |
$matcherName = $io->askQuestion($question); | |
if ('<skip>' === $matcherName) { | |
return null; |
Thank you for the review. I'm at SFlive right now, I'll try to push the changes on my way back. Just curious about the bit on unit testing the regex : testing invalid cases seems pretty hard with the MakerTestCase, should I make the method public? Use reflection method and invoke maybe? |
@maelanleborgne The regex test can be added to: maker-bundle/tests/RegexTest.php Line 17 in 74a8918
I'll have to do some minor refactoring on that class to make it "multi-purpose" (ill get a pr up and merged here shortly) - but you should be able to add another test method & dataProvider to that test class and be all set. As to the regex itself - move the regex string to a constant like:
Then you can call that regex expression from within the class and within the test without too much trouble. Tell the folks at SFLive I said hello! |
22c20d4
to
becc2f9
Compare
9d29dbd
to
64622cf
Compare
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.
Awesome! Thank you @maelanleborgne
This PR was merged into the 6.4 branch. Discussion ---------- [Webhook] show `make:webhook` Since `v1.58.0` (https://github.com/symfony/maker-bundle/releases/tag/v1.58.0) - MakerBundle has a `make:webhook` command (symfony/maker-bundle#1491) that generates a basic `ConsumerInterface` implementation. - Milestone `7.1` is incorrect Commits ------- bf7aca1 [webhook] show `make:webhook`
Add a maker that would help create a webhook :
AbstractRequestParser
and interactively define the RequestMatcher(s) to use.ConsumerInterface
with the#[AsRemoteEventConsumer]
attribute.That is an easy scaffolding command but since Webhook is a quite recent component and the documentation is pretty scarce right now, I think it would make sense to have a maker to help setting things up.
Regex: https://regex101.com/r/S3BWkx/1
Bumps test process timeout from
10
to30
seconds - composer is a bit slow on Windows.maker-bundle/src/Test/MakerTestEnvironment.php
Line 339 in 30cdf17