Skip to content
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 the url generator available on the events #287

Merged
merged 6 commits into from
Oct 29, 2021

Conversation

kbond
Copy link
Contributor

@kbond kbond commented Oct 22, 2021

Fixes #286. Tests pass still so hopefully that means this is BC. Before I finalize, I'd like to ensure this direction is acceptable.

TODO:

  • Add tests
  • Trigger deprecation warnings
  • Document

Copy link
Member

@yann-eugone yann-eugone left a comment

Choose a reason for hiding this comment

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

Sorry I'm late (long weekend :))

I think this is a very good start, thank you.

Do you planned to update/add tests in the same PR ?

src/Event/SitemapAddUrlEvent.php Show resolved Hide resolved
src/Event/SitemapAddUrlEvent.php Outdated Show resolved Hide resolved
src/Event/SitemapPopulateEvent.php Outdated Show resolved Hide resolved
src/Event/SitemapPopulateEvent.php Outdated Show resolved Hide resolved
src/Service/AbstractGenerator.php Outdated Show resolved Hide resolved
@kbond
Copy link
Contributor Author

kbond commented Oct 27, 2021

Do you planned to update/add tests in the same PR ?

Yes, that was my plan.

@kbond
Copy link
Contributor Author

kbond commented Oct 27, 2021

Ok, addressed the comments. Let me know if you'd like me to change the deprecation/exception messages.

For the tests, I was thinking the following:

  1. Mock/inject the UrlGeneratorInterface in the unit tests to remove the self-deprecations
  2. Adjust the integration test's SitemapListener to use the url generator from the event (instead of injecting)

Let me know if you'd like anything else.

@yann-eugone
Copy link
Member

1. Mock/inject the `UrlGeneratorInterface` in the unit tests to remove the self-deprecations

I know that this bundle has some bad practices in tests, but I'm trying to fix this.
I'm trying to apply the "don't mock what you don't own" approach.
I suggest you inject an implementation of the UrlGeneratorInterface, some actual object from symfony ecosystem, or a test dummy you will create.

2. Adjust the integration test's `SitemapListener` to use the url generator from the event (instead of injecting)

👍, 100% agree with this

src/Event/SitemapAddUrlEvent.php Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
@kbond kbond marked this pull request as ready for review October 28, 2021 13:00
@kbond
Copy link
Contributor Author

kbond commented Oct 28, 2021

Ok, I believe this is ready for a final review. I believe the phpstan errors are unrelated.

Copy link
Member

@yann-eugone yann-eugone left a comment

Choose a reason for hiding this comment

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

Thank you for this work !

@yann-eugone yann-eugone merged commit b7dfd87 into prestaconcept:3.x Oct 29, 2021
@kbond kbond deleted the event-router branch October 29, 2021 07:14
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.

Make url generator available on SitemapPopulateEvent
2 participants