The new KernelTestBase is a really good idea....
However it is proving too easy to shake the tree and let problems fall out
#2553245: KernelTestBase uses a disallowed constant in calls to trigger_error
#2553533: KernelTestBaseTNG™ is not cleaning up after itself
So I want to make the smallest change that has be potential to expose the most problems... so we can deal with them early.
from https://www.drupal.org/node/2456477#comment-10235565
If we convert core/modules/views/src/Tests/ViewUnitTestBase.php then as it is extended 65 times - it is the pebble that when thrown might make the biggest waves.
The patch is just that from
https://www.drupal.org/node/2553533#comment-10235547
extended to include the conversion of ViewUnitTestBase with :-
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
Comment | File | Size | Author |
---|---|---|---|
#35 | 2553655-35.patch | 119.17 KB | dawehner |
#28 | 2553655-28-interdiff.txt | 9.99 KB | Berdir |
#28 | 2553655-28.patch | 119.27 KB | Berdir |
#26 | interdiff.txt | 9.29 KB | dawehner |
#26 | 2553655-26.patch | 126.12 KB | dawehner |
Comments
Comment #2
dawehnerI doubt this will work with the changes we made to the test location ... It would be though great to see whether the views tests are passing.
Comment #3
martin107 CreditAttribution: martin107 commentedWow prompt reply...
This is an itch I have to scratch.
Please note converting ViewKernelTestBase and it has 69 extensions.
Comment #4
dawehnerDid you tried running them?
Comment #6
martin107 CreditAttribution: martin107 commentedSorry for the noise ....
So just some notes.
As was predictable there are lots of the following messages.
1) Required prefix configuration is missing type errors
2) Method XYZ::setUp() should be compatible with .....
As I read the parent issue, it is an unanswered question as to how to approach the conversions... and when - so I will leave that question alone here.
I just wanted to identify unexpected errors.
like Drupal\migrate_drupal\Tests\d6\MigrateDrupal6Test which might need further investigation.....
I am going to postpone this issue ... I was looking for major upsets and I don't see any....
It is time to stop being the bull in the china shop ... and get back to doing things in order....
I think the more community orientated approach is to first resolve #2553533: KernelTestBaseTNG™ is not cleaning up after itself
Comment #7
claudiu.cristea@martin107, Check #2553661-6: KernelTestBase fails to set up FileCache. I'm getting too the
Required prefix configuration is missing
apparently for no reason. Or I'm missing something from the picture. I only found the docs from \Drupal\KernelTests\KernelTestBase.Comment #8
jibranComment #9
mgiffordI think this can be unpostponed now.
Comment #10
BerdirThere is a new base class now, now we have to move all tests that extend the old one.
Most are passing, not sure yet about some remaining fails:
Some weird thing with none in some URL's, order of views doesn't match, one test trying to mess with $this->assertions, and RenderedEntityTest fatals. Note that some errors/fails are missing that weren't related to this.
Comment #12
BerdirComment #14
dawehnerComment #15
BerdirComment #18
BerdirNote: the fixes in #2679096: Convert Kernel Tests in Drupal\system\Tests\Entity to phpunit should fix some of the current test fails.
Comment #19
dawehnerHere are some fix for the other test failures. Review is coming as well.
Comment #20
dawehnerI'm confused by this one, maybe git is just tricking us, but note, this one also fails
Should we keep that around for a bit and deprecate it for 8.2.x?
Note: This applies to multiple examples: It is sad that we loose the Handler namespace in those tests.
Why is that no longer needed?
That is pretty phenomenal, indeed
Comment #21
Berdir1. Yes, I'm confused too, will check again. I think something is indeed wrong there.
2. Fine with me.
3. That was an accident, I'll check and fix them.
4. Because the new base class adds that table already.
Comment #22
Berdirfairly certain this wouldn't be needed with the safe casting, it didn't fail for me locally, but I'm also fine with making it more explicit.
Interesting, why was this not necessary before? should the base class do it maybe?
oops.
I guess that's why I messed that up, should we really keep entity_reference as a group?
I was wondering about adding that, but I'm not sure why it is different. Maybe some unstable sort thing? But I think the order doesn't matter here for us.
will this then even call what's below?
(setting to review for testbot)
Comment #23
dawehnerYeah this is the reason I went with that.
I don't care, well it should be in views IMHO, the entity reference module is super deprecated already.
I was experimenting a bit, at the end indeed just the
destination->set()
is actually needed.Yeah, I beleive the order in which we install modules changes from the different kernel tests.
Good question! Ideally we should split this up into its own test method anyway.
Comment #26
dawehnerThere we go, some work on that.
Comment #28
BerdirI think I messed up a few things while creating the initial patch. No idea where RenderedEntityTest comes from, there's no such thing anyway. Removed. Also cleaned up a few wrong changes.
Comment #29
jibranSeems ready to me. Just minor observation can be fixed on commit.
Where are we using it?
Comment #30
alexpottNeeds a reroll
Comment #31
alexpottGiven #29 Is this necessary then? Or does this change just make life easier?
Comment #32
Berdir@alexpott: It's not necessary when the tests are passing. But without it, phpunit dies *very* badly if it's trying to display the error, which makes writting/debugging tests extremely painful.
We could open a separate issue but now that we've converted many tests to phpunit and more are in the pipeline, it's pretty important to have this fixed.
If you want to try it for yourself, try one of the earlier patches that had fails and didn't have this part.
Comment #33
alexpott@Berdir yep I think I've seen the error - I'm happy for this to happen here... you are right it is painful.
Comment #34
dawehnerWell, it breaks when you store an entity for example on the test class. Once there, it will be serialized and then unserialized when the error is rendered, which is in the phpunit parent process, which doesn't have a container. Yes, it makes our life easier, but by easier this is actually the difference between hunting and living in a modern society.
Comment #35
dawehnerRerolled
Comment #36
jibranBack to RTBC.
Comment #37
alexpottCommitted aebd0a8 and pushed to 8.1.x and 8.2.x. Thanks!
Fixing some unused uses on commit.
Comment #39
alexpottHad to roll this back because contrib tests are broken :( see https://dispatcher.drupalci.org/job/default/98960/consoleerr noComment #40
alexpott