Call to undefined function t() in an Unit test
You should not be using t() inside classes. The string translation trait should be included instead (if it is not already part of a parent class). Then you will use:

$this-&gt;t()


Then you can use the answer I provided here as to how to do unit tests with string translation trait: How to unit test a class which uses a trait?