-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing a method in a Custom Extension class #5829
Comments
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, |
Are you sure this line is correct? Shouldn't it be 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.
The text was updated successfully, but these errors were encountered: