-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[4.0] Fix pathway tests to match old behaviour #19672
Conversation
Seems fair to me. I'd suggest checking against an empty string though so we don't hit that "who knows what's gonna happen" thing. |
Honestly I'm more in favor of having a pathway object per application than having the SiteApplication holding the pathway object for the Admin (I know this is not possible atm). |
I understand but if we do that then we need to remove the name param outright because your code doesn’t stop the siteapp loading the admin pathway. But just means if that is loaded first then the site pathway is never loaded :/ I decided to stick closer to the original with the $name parameter than to try and muck around with it all |
IMO having a store of different pathway objects should not be done in the application. Having for that JPathway::getInstance is fine. But you are right, the name attribute is not needed anymore in the actual case. |
There is already a test - but I just don't like the concept so I've appending a hardcoded pathway string afterwards.
As long as we can get multiple applications out (I've not tried it yet - because there's might well be cases where we might want to get the SitePathway in the Admin) |
Just tested it in the article view in the back end. When you do
$p is the SitePathway object. Loading the different applications trough the container does work on a first glance. If Michael can detach the session from the global application then we should be on the safe side. |
And I would love if we can prepare the core that it will be possible to work with different applications than the default one from the factory. |
My point is if you do
You are going to end up with |
That's why...
|
I'm not too fussed. I preferred to keep compatibility with the old way. I don't feel strongly tho. @mbabker want to make a decision as the "independent" |
For now because the name argument is there in the application and just acts as a proxy to the existing getInstance method, let's not do the hard B/C break on not-yet deprecated functionality and take this PR. To remove the name argument (which is IMO a good idea, you should have one pathway for the application instance you're working with), let's first deprecate that functionality in 3.x. |
Lets be honest here, we are talking about an artificial BC break as there is only one Pathway class anyway, the SitePathway. |
It's still a B/C break. I have no issue making it, but without at least deprecating the logic that seems pretty unfair even if it is a massive edge case. |
(FWIW I've done a lot of work in the Framework repos where I do make B/C breaks, but more often than not before that PR is merged the corresponding PR marking deprecations gets created and merged first, mainly because I don't know what's getting deprecated/replaced until I reach a feature complete state; so all I'm suggesting is to do the same here) |
Here we go #19700. |
And here it will be removed, #19703. Hope all is fine now. |
Closing in favor of #19703. |
A slightly different approach to #19669 that stays a bit truer to the original 3.x code. @laoneo and @mbabker thoughts? I'm not so keen on the creating container for tests - I guess we should really inject a mock container and check it's
has
andget
methods are called with the correct params. On the positive side much lessFactory::getContainer();
stuff...This also allows you to use the
$name
param because with thepathway
var in the application we were only going to use whatever it's first value was. Now we can have multiple pathways (although quite what an empty string array key does idk but it doesn't break the tests so i guess it's ok??)