Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
VocabularyCrudTest
inherited from TaxonomyTestBase
that involved in UI testing, but actually it testing CRUD so should be optimized.
Proposed resolution
Re-do on top of KernelTestBase
Remaining tasks
tbd
User interface changes
no
API changes
no
Beta phase evaluation
Issue category | Bug because slows down testing for no reason |
---|---|
Issue priority | Major because affects a whole core testing |
Prioritized changes | The main goal of this issue is performance of core |
Comment | File | Size | Author |
---|---|---|---|
#26 | 2473681-26.patch | 13.17 KB | yogeshmpawar |
#16 | 2473681-16.patch | 13.16 KB | Manuel Garcia |
#16 | interdiff-2473681-14-16.txt | 2.72 KB | Manuel Garcia |
#14 | 2473681-14.patch | 9.04 KB | Manuel Garcia |
#14 | interdiff-2473681-9-14.txt | 8.24 KB | Manuel Garcia |
Comments
Comment #7
Mile23Comment #8
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedHere we go
Comment #9
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedoops
Comment #10
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedI noticed that the tests still pass if we take out field and text from here, should we?
Comment #11
naveenvalechawe can remove the field, but don't have a strong opinion because I found that in the core there are mixed examples available.
The reasons why the tests are passing without field because field_test module has a dependency on the entity_test module which has a dependency on the field module.
Changes look good to me.
Comment #12
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedThanks @naveenvalecha for the feedback. I did notice that we do need
field
andtext
on the list of modules to enable. Its only the configuration installation that seems not to be required for the test. Perhaps its being installed like you said via dependencies.Comment #13
claudiu.cristeas/public/protected
This module is not used.
This vocab is used only in 2 tests. The other tests are deleting the vocab prior running their tets logic. Let's remove it as class property and create it as local var only in the tests that are requiring it. Then we can drop also the vocabs removal from the other tests.
Re #10, #11, #12: It seems that we don't need any config to be installed. Drop the whole
$this->installConfig()
.In simpletest, the assert custom message has described the success. Contrary, the PHPUnit tests are describing the failure. We have to either recreate all messages to describe the failure or to, simply, remove them. I would go with the later. We should do the same for all test occurrences.
I don't understand what this test is testing. All these tests should be covered by generic config entities testing. I would remove the whole test.
The method starts with an empty line.
entity_load_multiple()
is deprecated and should be replaced in the comment.This method is deprecated.
The naming: s/$controller/$storage
Comment #14
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedRe #13:
Thanks so much for the review!
1. Done
2.Nice, removed.
3. We actually use the vocabulary on
testTaxonomyVocabularyDeleteWithTerms
apparently, but I generally like this approach too, so I've moved it out of setUp().4. Brilliant, removed.
5. Done.
6. I honestly don't know but I'd assume so, if they are not covered by generic entity testing, we should move it over there. Removing it here in any case for now.
7. Fixed.
8. Done.
9. Done.
10. Done.
Comment #15
claudiu.cristeaGreat. Thank you. I'm still seeing few issues.
The order was correct before. In PHPUnit first come the expectation and that is 0 (or 5).
It looks that
$vocabulary1->id()
is the expectation here. So it should be the first parameter.What is the reason for this file inclusion? I guess the test doesn't need it.
This docblock needs some love. The words "connected to this" could go one line up and the rest of lines could be reorganized to honour the coding standards rule from https://www.drupal.org/docs/develop/standards/api-documentation-and-comm...
This can be chained as
$vocabulary->enforceIsNew()->save();
Comment #16
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedThanks again @claudiu.cristea for the review!
Re #15:
Some stats on the new kernel test:
Time: 57.26 seconds, Memory: 6.00MB
(on an Intel® Core™ i5-7200U CPU @ 2.50GHz × 4) - I would imagine the savings to be significant on this one, since it was 4 functional tests before, though I haven’t run them locally to measure the difference.Comment #17
claudiu.cristeaThank you!
Comment #19
claudiu.cristeaUnrelated DB server failure.
Comment #21
yogeshmpawarAll looks good so setting back to RTBC! Tests failure is not related (see #3055648: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest).
Comment #23
claudiu.cristeaComment #24
claudiu.cristeaThe patch doesn't apply anymore.
Comment #25
yogeshmpawarComment #26
yogeshmpawarRe-rolled #16 patch.
Comment #27
claudiu.cristeaThank you. Back to RTBC
Comment #28
catchCommitted 202ad58 and pushed to 8.8.x. Thanks!