testedClass; if ($exp instanceof \Throwable) { $this->expectException(get_class($exp)); $this->expectExceptionCode($exp->getCode()); } else { $exp = strtolower(str_replace(" ", "", $exp)); } $out = $class::encode($input, $fatal); $this->assertSame($exp, bin2hex($out)); } }