jeudi 6 juin 2019

PHPUnit: testing parameter types

I want to test a method that can take, as a parameter, either an instance of class Foo or a string. If anything else is passed it throws an Exception.

How do I test that if I don't pass one of the valid types the exception is thrown? How can I make sure that anything other than one of those types will yield an exception?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire