In a piece of legacy code I was tasked to test a static function in a trait like that:
namespace App\Model\SomeLogic;
trait WhyDecidedToUseTrait
{
public static function aMethodThatDoesSomeFancyStuff()
{
//Method Logic
}
}
And from this piece of documentation using the getMockForTrait
method. But in my case making a dummy object in order to test a static function where object instants are useless to begin with has no value.
Also testing the method in objects that use this trait seems pretty much time consuming, also tdoing a larger scale refactoring is time consuming as well.
So how I can test the trait in order to gradually refactor any class that uses it?
Aucun commentaire:
Enregistrer un commentaire