Closed MocioF closed 6 months ago
I do not understand what you are trying to report. You write that you want to test a "custom extension class". An extension for what?
Thank you for your report.
Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.
Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.
Sorry for the typo, I am trying to test methods of a Custom Exception Class
$customException = throw new MYNS\CustomException:( ...$e );
Are you sure this line is correct? Shouldn't it be $customException = new MYNS\CustomException:( ...$e );
?
Anyway, somehow the test doesn't make sense as currently written.
thanks @mfn, the test aims to check that a method in the custom exception class works as expected.
I agree with @mfn: this test does not make any sense to me, sorry.
Summary
I am trying to test a method of a Custom Exception Class. This method writes data on the database (it's a logger), but it seems that after the extension is raised and "catched" by PHPUnit, the following code is not executed. Is there a way to test a custom method of a custom Extension?
First attempt:
Current behavior
Result is: OK (1 test, 1 assertion)
Expected behavior
OK (1 test, 3 assertion)
Second try:
and result is
Current behavior
.E 2 / 2 (100%)
Time: 00:00.059, Memory: 44.50 MB
There was 1 error: TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given
I also tried to use try...catch...finally blocks in the test unit but with no success.