[phpMyAdmin Developers] Dependency Injection

MaurĂ­cio Meneghini Fauth mauriciofauth at gmail.com
Sat Jan 20 18:30:18 CET 2018


This week I was researching how to increase code coverage and found a few
things that would make it easier to write unit tests and make the code

The main point is to use dependency injection whenever possible, as this
makes it easier to mock the dependencies. To facilitate this, we can reduce
the use of static methods in favor of instance methods. This would give us
a constructor method, which would make it easier to manage dependencies.

Another point is that we currently use $GLOBALS as a simplified service
locator. We can replace this with the dependency injection container. This
would reduce the 'action at a distance' problems, in addition to decoupling
the classes.

I would like to know what you think about it. Any feedback is welcome.

MaurĂ­cio Meneghini Fauth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.phpmyadmin.net/pipermail/developers/attachments/20180120/afb8f7f0/attachment.html>

More information about the Developers mailing list