Skip to content

[Notifier] Add MessageMedia Bridge #41375

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

Merged
merged 1 commit into from
Jul 2, 2021

Conversation

vuphuong87
Copy link
Contributor

@vuphuong87 vuphuong87 commented May 21, 2021

Q A
Branch? 5.4
Bug fix? no
New feature? yes
Deprecations? no
License MIT
Doc PR symfony/symfony-docs#15366
Recipe PR symfony/recipes#950

Add MessageMedia bridge to Symfony Notifier

  • submit changes to the documentation
  • submit changes to the recipe
  • finish the code

https://messagemedia.github.io/documentation/#operation/SendMessages

@carsonbot
Copy link

Hey!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@vuphuong87 vuphuong87 marked this pull request as ready for review May 21, 2021 23:05
@vuphuong87 vuphuong87 requested a review from OskarStark as a code owner May 21, 2021 23:05
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot carsonbot changed the title [WIP] [Notifier] Add MessageMedia Bridge [Notifier] [WIP] Add MessageMedia Bridge May 21, 2021
@vuphuong87 vuphuong87 changed the title [Notifier] [WIP] Add MessageMedia Bridge [Notifier] Add MessageMedia Bridge May 21, 2021
@vuphuong87 vuphuong87 changed the title [Notifier] Add MessageMedia Bridge [Notifier] [WIP] Add MessageMedia Bridge May 21, 2021
@vuphuong87 vuphuong87 force-pushed the messagemedia-notifier branch 2 times, most recently from 69fa398 to d36de82 Compare May 22, 2021 05:59
@vuphuong87 vuphuong87 changed the title [Notifier] [WIP] Add MessageMedia Bridge [Notifier] Add MessageMedia Bridge May 22, 2021
@nicolas-grekas nicolas-grekas added this to the 5.4 milestone May 22, 2021
Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Except small things.... almost perfect 🤩

Thank you for your contribution 👍🏻

@vuphuong87 vuphuong87 force-pushed the messagemedia-notifier branch from d09e61a to 8e1eaa9 Compare May 22, 2021 18:26
@vuphuong87
Copy link
Contributor Author

vuphuong87 commented May 22, 2021

@OskarStark I updated all your suggestions. Could you take a look again?

By the way, Travis CI build is always failed in the FrameworkBundle tests because the package hasn't loaded yet. Could you advise what should I do for this case?

Thanks for your quick review!

@vuphuong87 vuphuong87 requested a review from OskarStark May 22, 2021 18:34
@jschaedl
Copy link
Contributor

jschaedl commented May 23, 2021

Hi @vuphuong87

Thanks for providing this new notifier bridge. Code looks perfect already.

By the way, Travis CI build is always failed in the FrameworkBundle tests because the package hasn't loaded yet. Could you advise what should I do for this case?

To fix this issue, you need to add the new bridge as a composer dev requirement in the FrameworkBundle: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Bundle/FrameworkBundle/composer.json#L70
Otherwise the factory service for this bridge will be removed: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L2468

@OskarStark Not sure how it works, but creating the repository for the MessageMedia bridge (symfony/message-media-notifier) before we merge this PR is not possible, is it? Alternatively I could change this test:
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php#L1883
and trigger a warning instead of letting the test fail in case an expected factory service is not found. It could look like this: 468e44b

@StaffNowa
Copy link
Contributor

@jschaedl I think possible merge while we do not have 📦 like additional repository.

@OskarStark know much more than me :)

@vuphuong87
Copy link
Contributor Author

@jschaedl My thought is the tests should be there to make sure the integration is correct or reviewers will always need to remind new contributors like me 😛 Do you know how did it work with the previous bridges?

@OskarStark
Copy link
Contributor

OskarStark commented May 26, 2021

I think we can ignore this error for new bridges, it will be green after merging.

WDYT @chalasr ?

EDIT:
Oh no, it will be green after merge and the release of the package. So I think we should go this way @jschaedl proposed

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Small one

@fabpot
Copy link
Member

fabpot commented Jun 27, 2021

@vuphuong87 Can you check why the tests fail?

@StaffNowa
Copy link
Contributor

PHPUnit 9.5.6 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing /var/www/symfony/symfony/src/Symfony/Component/Notifier/Bridge/MessageMedia
.....SS....R..........                                            22 / 22 (100%)

Time: 00:00.033, Memory: 10.00 MB

There was 1 risky test:

1) Symfony\Component\Notifier\Bridge\MessageMedia\Tests\MessageMediaTransportTest::testExceptionIsThrownWhenHttpSendFailedProvider
This test did not perform any assertions

/var/www/symfony/symfony/src/Symfony/Component/Notifier/Bridge/MessageMedia/Tests/MessageMediaTransportTest.php:75

Hey, are you ready to finish your PR @vuphuong87 ? 👍

@vuphuong87
Copy link
Contributor Author

@fabpot @StaffNowa My bad. I put a bad naming for the data provider which phpunit think it was a test. I fixed it now.

@vuphuong87
Copy link
Contributor Author

Looks like there are flaky tests for 7.2 & 8.0.
For 8.0 (low-deps) I guess it will be good when I rebase with 5.4 branch given #41868 were merged.

@vuphuong87 vuphuong87 force-pushed the messagemedia-notifier branch from ab4075f to 0efe777 Compare June 27, 2021 15:31
@vuphuong87
Copy link
Contributor Author

@OskarStark still get the same errors about Telnyx in the latest build. Look like it is because of the subsplit not being configured yet (as @wouterj commented in the PR).

@StaffNowa
Copy link
Contributor

StaffNowa commented Jul 1, 2021

@vuphuong87 telnyx not yet pushed to packagist. Which error did you get?

symfony/recipes#951

@OskarStark
Copy link
Contributor

Can you please rebase, afterwards I will merge this PR, thanks

@vuphuong87 vuphuong87 force-pushed the messagemedia-notifier branch from 0efe777 to 6dc7304 Compare July 1, 2021 06:31
@vuphuong87
Copy link
Contributor Author

@StaffNowa Yep, I think that is the case. The error is by the way:
Did you forget to add the TransportFactory: "Telnyx" to the $classToServices array in the FrameworkBundleExtension?

@OskarStark I rebased it. Thank you very much!!

@OskarStark
Copy link
Contributor

CleanShot 2021-07-01 at 12 05 57@2x

can you please fix the test?

@vuphuong87
Copy link
Contributor Author

@OskarStark I pushed a new fix for it. Turn out it throws another exception for low-deps so I added another catch: cb524ab

Could you review again. Really it works well for now.

@OskarStark
Copy link
Contributor

Yes lets see, what the tests say.

btw. can you please check, why your commuter e-mails not associated with your Github account:
CleanShot 2021-07-01 at 19 30 23@2x

Thanks

@vuphuong87 vuphuong87 force-pushed the messagemedia-notifier branch from cb524ab to c7f3454 Compare July 2, 2021 02:16
@vuphuong87
Copy link
Contributor Author

@OskarStark I messed up with my work email. Updated the PR again, my face is now shown up :p Thanks.

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Thanks, the following 3 tests will be green after the subtree split:

There were 3 failures:
3503

3504
1) Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\PhpFrameworkExtensionTest::testIfNotifierTransportsAreKnownByFrameworkExtension
3505
Did you forget to add the TransportFactory: "MessageMedia" to the $classToServices array in the FrameworkBundleExtension?
3506
Failed asserting that false is true.
3507

3508
/home/runner/work/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php:1883
3509

3510
2) Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\XmlFrameworkExtensionTest::testIfNotifierTransportsAreKnownByFrameworkExtension
3511
Did you forget to add the TransportFactory: "MessageMedia" to the $classToServices array in the FrameworkBundleExtension?
3512
Failed asserting that false is true.
3513

3514
/home/runner/work/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php:1883
3515

3516
3) Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\YamlFrameworkExtensionTest::testIfNotifierTransportsAreKnownByFrameworkExtension
3517
Did you forget to add the TransportFactory: "MessageMedia" to the $classToServices array in the FrameworkBundleExtension?
3518
Failed asserting that false is true.
3519

3520
/home/runner/work/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php:1883

@OskarStark OskarStark force-pushed the messagemedia-notifier branch from c7f3454 to dd3da8f Compare July 2, 2021 08:31
@OskarStark
Copy link
Contributor

Thanks for your work on this new feature!

@OskarStark OskarStark merged commit d3757a1 into symfony:5.4 Jul 2, 2021
OskarStark added a commit to symfony/symfony-docs that referenced this pull request Jul 2, 2021
This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

[Notifier] [MessageMedia] add docs

MessageMedia Bridge: symfony/symfony#41375

Commits
-------

1b5fd8c [Notifier] [MessageMedia] add docs
@vuphuong87
Copy link
Contributor Author

Thanks a lot for you feedback and handling this PR @OskarStark

@OskarStark
Copy link
Contributor

Very welcome, thanks for your contribution!

@vuphuong87 vuphuong87 deleted the messagemedia-notifier branch July 3, 2021 03:49
This was referenced Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants