Reputation: 6155
In PHPUnit, how can I get info in tearDown() if my test passed or not, and what its name?
I've tried looking into $this->getTestResultObject()->topTestSuite()
, but not luck - tests seem like they are fresh with no ok/failure in them.
As output I want my custom tearDown() to have something like:
TESTCLASSNAME::TESTMETHOD - ok
TESTCLASSNAME::TESTMETHOD2 - failed
Upvotes: 1
Views: 736
Reputation: 6155
Class name = explode('::',$this->toString())[0]
Test name = $this->getName()
Status = $this->hasFailed()
Upvotes: 4