Quantcast
Channel: DOCU - Foren
Viewing all articles
Browse latest Browse all 6596

ILIAS Developers: Mockery

$
0
0

Hi Richard that is a good idea,


I think the main difference between the PHP mock functionality and mockery is the fact that mockery focus on the creation and validation of mocks in various way were PHP unit has a stronger focus towards a general toolkit.


Focus Mockery:


  • Validation of function calls on mock objects before and after the actual calls.

  • Support to mock hard dependencies (new keyword) which is good to test the old parts of ILIAS.

  • Object spy capability for method call verification with real objects.

  • Alias creation to mock static calls.

Focus PHP Unit:


  • Creation of stubs

  • Creation of mocks for method call verification.

To sum up, the build in mocking solution of PHP Unit has a solid kit which allows to test the newly written code in hardly any case. The kit has also some limitations like no support for mocking static calls and hard dependencies. 


Mockery in contrast provides a more powerful set which enables the developers to intercept the creation of objects or loading of classes to test static method calls. The capabilities are powerful but could also be misused in the future.


Please note that I am more experienced with mockery. Corrections additions and notes from other developers are highly appreciated!


 


Viewing all articles
Browse latest Browse all 6596

Trending Articles