? ? Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
2 Jul 2022

Summary of Changes

Reverts the translate function in the CMSPlugin class and uses the translate function from the application language object.

Testing Instructions

Create a GET request task and run it manually in the back end from the web interface.

Actual result BEFORE applying this Pull Request

An output is displayed with the string "Response Code: 200".

Expected result AFTER applying this Pull Request

An output is displayed with the string "Response Code: 200".

avatar laoneo laoneo - open - 2 Jul 2022
avatar laoneo laoneo - change - 2 Jul 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Jul 2022
Category Libraries Front End Plugins
avatar laoneo laoneo - change - 2 Jul 2022
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 2 Jul 2022
Category Libraries Front End Plugins Libraries Front End Plugins Unit Tests
avatar brianteeman
brianteeman - comment - 2 Jul 2022

Why not revert fully to $this->logTask(Text::sprintf( ?

or maybe a better commit message?

avatar laoneo
laoneo - comment - 2 Jul 2022

Why using static function when we have everything from the local application object?

Another reason is, because Text uses the application from the Factory class and then we can't do correct unit testing. Because code should be autonomic. As soon as the testable class loads it's dependency by it's own, then it violates the inversion of control principle which leads to a dependency chain hell. And no, this is not super theoretic high school stuff, it is a basic principle of software development which we started with the development of Joomla 4.

In this case it would be simple to just set the application on the Factory class but there are places where we have much more complex dependency chains which we want to avoid (this is the reason why so many "unit test" got removed in Joomla 4). When we start to go the way that classes do define their dependencies and not load them by themself, then the code will become simpler, more predictable and easily unit testable. When we start doing excuses, here and there, then it will become messy again over time.

avatar brianteeman
brianteeman - comment - 2 Jul 2022

Thank you for the explanation. Please consider a better commit message then please

avatar laoneo
laoneo - comment - 2 Jul 2022

As the pr will be squashed it uses the pr title. Any suggestion?

avatar brianteeman
brianteeman - comment - 2 Jul 2022

It was the title I referred to as that is the commit message.

It is not a revert - that is confusing - perhaps "update"?

avatar laoneo laoneo - change - 2 Jul 2022
Title
Revert the translate function in the CMSPlugin class
[4.2] Use the app language translate function in plugins
avatar laoneo laoneo - edited - 2 Jul 2022
avatar brianteeman
brianteeman - comment - 2 Jul 2022

Thank you

avatar roland-d roland-d - change - 3 Jul 2022
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-07-03 07:56:58
Closed_By roland-d
Labels Added: ?
avatar roland-d roland-d - close - 3 Jul 2022
avatar roland-d roland-d - merge - 3 Jul 2022
avatar roland-d
roland-d - comment - 3 Jul 2022

Thank you

Add a Comment

Login with GitHub to post a comment