vendredi 6 mars 2015

best way to mock a global static method

my application has a logger library with the signature:



final class Logger {
public static method debug($msg);
public static method warn($msg);
public static method error($msg);
}


the class i want to test, another global static helper, use it as



final class TestMe {
public static method TestThis(){
Logger::debug('TestThis() called');
doThings();
}
}


How to test the TestMe class by mocking the Logger one and waiting for the expected messages?


Aucun commentaire:

Enregistrer un commentaire