I have a method like this:
public function xy()
{
die('script was terminated.')
}
If it possible to test this method with phpUnit?
I have a method like this:
public function xy()
{
die('script was terminated.')
}
If it possible to test this method with phpUnit?
This is possible by overloading the die() function. How you do this is described here: Intercepting the Exit Statement
Simply calling it is not possible as there is only one PHPUnit process and you will kill it by calling die() or exit().
Also have look at the answers to this question: How do you use PHPUnit to test a function if that function is supposed to kill PHP?