- Issue created by @tim-diels
- π§πͺBelgium tim-diels Belgium π§πͺ
This should be done for the 2.1.x branch. I know the default was 2.0.x but I don't have the correct right to change. I'll ask the maintainer to change this.
Hi @tim-diels,
I have fixed one of the test's error, working on the other one.
I'm getting warnings that MaskKernelTest and MaskUnitTest are abstract, but they're being used directly. I'm currently extending MaskUnitTest in FieldWidgetPluginTest, (and many more places) which works fine, but the warnings persist.Should I:
1. Ensure these abstract classes are only extended and not instantiated directly (seems most likely)?
2. Remove the abstract keyword if it's unnecessary?
Which approach would you recommend to resolve this issue?Thanks for your help!
Hey,
I have resolved the issues and warnings stated above, but there is a warning stating that : No tests found in some classes.
There were 2 PHPUnit test runner warnings: 1) No tests found in class "Drupal\Tests\mask\Kernel\MaskKernelTest". 2) No tests found in class "Drupal\Tests\mask\Unit\MaskUnitTest". WARNINGS! Tests: 8, Assertions: 21, Warnings: 2.
I think we need to add some tests in these classes.
Thank you !- π§πͺBelgium tim-diels Belgium π§πͺ
The change of just removing the abstract is not correct. Please see https://www.drupal.org/project/drupal/issues/2973127 β for more info on this.
So I would suggest changing the base tests to include *Base and change the other files extending these base classes.- MaskKernelTestBase.php
- MaskUnitTestBase.php
And then start from there to fix the tests. So maybe revert the changes or start fresh?
Because I'm not sure what you changed to get everything working... - π§πͺBelgium tim-diels Belgium π§πͺ
Ok the changes done in
tests/src/Unit/ElementHelperTest.php
seems correct so you can keep those. Very good work!Need to review the others.
- π§πͺBelgium tim-diels Belgium π§πͺ
Other changes are indeed ok. So only the changes for the abstract needs to be looked at. Great work!
Hey @tim-diels,
I have implemented the suggestion you have made, please have a look. There are no pipeline issues and it is fixed too.
I have refactored the MaskUnitTest by creating a MaskUnitTestBase class for shared setup logic and moved the concrete test cases to MaskUnitTest. This follows the same structure as MaskKernelTest.
Please let me know if any changes are needed!
- π§πͺBelgium tim-diels Belgium π§πͺ
Hi @anish.ir, Thanks for the follow up.
But why are you creating tests that do nothing like the examples? I do understand it shows it works, but is not needed.
I'm also not getting the extra
MaskKernelTest.php
that only has the exampled and whyLibraryInfoAlterTest.php
is extending this instead of theMaskKernelTestBase.php
. And the same forMaskUnitTest.php
. Can you elaborate on why you did this? Thank you for the feedback!
The initial tests were placeholders to verify the test setup, Iβll remove the example tests and the MaskKernelTest.php too, and have tests extend MaskKernelTestBase.php directly. I created this as a concrete test class to provide a base for tests, but I now realize itβs redundant.
I mistakenly had LibraryInfoAlterTest.php extend MaskKernelTest.php. It should extend MaskKernelTestBase.php directly, and Iβll correct this.
Iβll restructure the tests. Thanks again for pointing this out!
- π§πͺBelgium tim-diels Belgium π§πͺ
I'm glad you continue to help. For me everything is ok now. Test seems to pass correctly also.
So thank you for the work here as this is very helpful for the other issues to get accepted or work on! -
tim-diels β
committed b25155eb on 2.1.x authored by
anish.ir β
Issue #3491425 by anish.ir, tim-diels: Fix tests
-
tim-diels β
committed b25155eb on 2.1.x authored by
anish.ir β