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

Refactored the switcher extension to get all deps via injection #201

Closed
wants to merge 2 commits into from
Closed

Refactored the switcher extension to get all deps via injection #201

wants to merge 2 commits into from

Conversation

thanosp
Copy link

@thanosp thanosp commented Dec 6, 2017

The main problem that remains is that I don't see any real functional test to check the integration with symfony.
So basically apart from the unit test nothing else broke from the change. Configuration defaults are untested. I can remove an argument from the service definitions and all tests still pass. So that should probably be a new issue.

Copy link
Collaborator

@dbu dbu left a comment

Choose a reason for hiding this comment

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

thanks a lot!

agreed that we need some functional tests, and agreed that should be a separate pull request. i have some small cleanup feedback, otherwise looks good to me. (did you manually test this in a real application that uses the twig extension?)

@@ -137,7 +137,9 @@ private function getRequestWithoutLocaleQuery()
*/
private function getGuesserMock()
{
$mock = $this->getMockBuilder('Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface')->disableOriginalConstructor()->getMock();
$mock = $this->getMockBuilder('Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface')
Copy link
Collaborator

Choose a reason for hiding this comment

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

just createMock would be enough, it disables the constructor automatically

return $this->container->get('lunetics_locale.switcher_helper')->renderSwitch($infos, $template);
$showCurrentLocale = $this->showCurrentLocaleParam;
$useController = $this->useControllerParam;
$allowedLocales = $this->allowedLocalesProvider->getAllowedLocales();
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should inline these assignments into the code below directly, i think

Copy link
Author

Choose a reason for hiding this comment

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

Yeah indeed. Can I also use short hand array notation yet btw?

Replaced class strings with ::class calls where appropriate
Replaced mockBuilder calls with createMock
@thanosp
Copy link
Author

thanosp commented Dec 6, 2017

Replaced class strings with ::class calls where appropriate.
Replaced mockBuilder calls with createMock.
I've tested this with symfony 3.4 only manually.

Copy link
Collaborator

@dbu dbu left a comment

Choose a reason for hiding this comment

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

great, thanks!

looks good to me. @lunetics do you agree?

RE short array notation: i think it would be best if @lunetics can enable styleci for this repo. then we can make styleci fix those automatically, and in general ensure a consistent code style.

@marcoreni
Copy link

Any update about this?

@dbu
Copy link
Collaborator

dbu commented Jan 22, 2018

i hope @lunetics can look at this sometimes. i follow this repository but am not a maintainer of the bundle...

@fschaeffer
Copy link

Any news about this one? I am also at rewriting an application and try to fix as many deprecations as possible. Only these two are left in my profiler ...

@marcoreni
Copy link

I think this is a duplicate of #195 that has been merged & released in 2.6.0

@dbu
Copy link
Collaborator

dbu commented Apr 3, 2018

Its not exactly a duplicate. #195 did the minimum to see this bundle run in symfony 4. This one is a proper refactoring to be better at following best practices. It also includes a cleanup of the tests.

Its currently in conflict with master and needs a rebase.

And it should probably bump the version to 3, there are changes in the constructor of non-final twig extension, so if somebody extended any of the classes or defined their own services with them, things would break. (in version 3, this class should be marked as both @internal and be final, then we can BC break as much as we want to).

Somebody up to rebase this?

@thanosp
Copy link
Author

thanosp commented Apr 23, 2018

Seems fixed in master now

@thanosp thanosp closed this Apr 23, 2018
@thanosp thanosp deleted the symfony-4-visibility-deprecation branch April 23, 2018 07:24
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.

Symfony 4 compatibility: Service visibility deprecation
4 participants