This has been created because of some discussions and requirements needed @
Right now, when we want to modify some language string as part of a PHPUnit or Behat execution we have to, literally, customise the lang pack with the new values. Or, alternatively, import and load another lang pack.
Any of those operations is really, really slow (15 seconds minimum on a super-fast SSD).
A real example (
MDL-73824) is when we want to change decsep or any other important value in the langconfig file, to be able to test how floats are shown, managed...
In that issue, for PHPUnit, we workaround the problem by creating a custom string manager and using it instead of the standard one. Basically it's the standard but with a setter that makes it possible to override lang file contents by custom ones. The values are in memory (in a member) till the unit test ends/restitutes the original manager
For Behat, there is a generator able to customise the lang pack (the following "language customisations" exist step), and it's used in a growing number of scenarios. As said, it's really slow.
So the idea here is to create a couple of string managers, let's call them "phpunit_string_manager" and "behat_string_manager", extending the standard one, and with the following facilities:
- To have a setter (method in PHPUnit, step/generator in Behat), able to override any lang string.
- To persist the overrides over a unit test for PHPUnit.
- To persist the overrides over an scenario for Behat.
- To be automatically reset (overrides emptied/cleaned) after the persistence limit.
- Covered with own tests!
- Make them the default whenever a PHPUnit / Behat run begins.
(Thanks mudrd8mz for all the discussions and ideas around this proposal)