jeudi 5 octobre 2017

How to test if a helper function was called inside a class method?

Say I am testing the following class in PHPUnit:

class ExampleClass
{
    public function exampleMethod()
    {
        exampleHelperfunction('firstArg', 'secondArg');
    }
}

How can I test if exampleHelperFunction was called with the arguments 'firstArg' and 'secondArg' when exampleMethod was run?

In other words, how can I mock functions that are not class methods?

Aucun commentaire:

Enregistrer un commentaire