Problem/Motivation
There are no tests for core block configuration settings like the "Who's online" block's "User list length" setting. There are 8 such settings (see the BlockSettings process plugin for a full list).
Proposed resolution
Add the tests.
Remaining tasks
Add the tests.
User interface changes
None.
API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #66 | 2422229-66.patch | 91.21 KB | jofitz |
| #63 | interdiff.txt | 3.39 KB | quietone |
| #63 | 2422229-63.patch | 91.22 KB | quietone |
| #59 | interdiff-57-59.txt | 421 bytes | quietone |
| #59 | 2422229-59.patch | 90.35 KB | quietone |
Comments
Comment #1
ultimikePhew, this was a bit more involved than I first thought, but attached is a patch that adds test for the eight block settings migrated with the help of the BlockSettings process plugin.
Some notes:
-mike
Comment #3
ultimikeWhoops - forgot to update MigrateNodeBundleSettingsTest with the new "forum" content type.
-mike
Comment #4
ultimikeRats - I just noticed I forgot to add a couple of new files that were a result of enabling forum and statistics module. I need to re-roll...
-mike
Comment #5
ultimikeOk - the patch has been re-rolled. The details:
-mike
Comment #6
ultimikeRe-roll due to #2416111: Migrate Dump export needs to have a consistent order and #2413759: Move D6 dumps to avoid collisions with D7 dumps.
-mike
Comment #7
ultimikeWaiting on #2469623: Process for creating migration source DBs for automated tests.
-mike
Comment #8
quietone commentedSince the issue this was postponed on was fixed I decided to reroll the patch. There is no interdiff because it fails on the d6 table file, MenuLinks.php
Comment #10
quietone commentedComment #12
mikeryanComment #13
quietone commentedHere is the reroll. I didn't add an interdiff because it is much larger than the patch itself, due to moving from the dump Tables to the test fixture, drupal6.php
All the tests pass except for the aggregator and the book block tests. And they fail because those blocks are not migrated. Not sure why that is happening.
Comment #15
vprocessor commentedComment #16
vprocessor commentedreroll
Comment #18
vprocessor commentedComment #19
vprocessor commentedFixed: \Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest
Test had been checked on local
Comment #21
vprocessor commentedFixed: Drupal\Tests\book\Kernel\Migrate\d6\MigrateBookConfigsTest
Comment #22
quietone commented@vprocessor, thanks for picking up on this. I notice that the patch in 21 is much larger that the one in #13. It looks like #21is a reroll of a patch before #13 and is a patch for 8.0.x. It is easy to tell because it contains Table files for the test fixture. These have been replaced with a full dump of the d6 database, core/modules/migrate_drupal/test/fixtures/drupal6.php. Also, WebAssert isn't related to this issue. I suggest starting from the patch in #13, which contains an updated test fixture that has the changes to the D6 database for this issue.
Comment #24
vprocessor commentedalmost tests fixed
Comment #25
vprocessor commented@quietone, ups, ok, will use patch from #13
Comment #27
vprocessor commentedFixed:
Migrate_drupal.Drupal\Tests\migrate_drupal\Kernel\dependencies\MigrateDependenciesTest
Comment #31
imiksuStill needs reroll. Assuming vprocessor isn't working on this anymore.
Comment #32
imiksuComment #33
anish.a commentedRerolled the patch
Comment #35
anish.a commentedWrong branch. Rerolled according to 8.2.x branch.
Comment #37
imiksuWe'll be watching this today if we can get this patch working.
Comment #38
imiksuLet me try to get this through.
Comment #39
imiksuHmm, I got lots of
Did you accidentally posted same patch twice? According to patch size it looks like that?
Comment #40
anish.a commentedReroll Try #3
Comment #42
anish.a commentedComment #43
mikeryanComment #44
jofitzComment #45
jofitzI've resolved many of the test failures, but I cannot sort out 5 of the failing assertions in MigrateUpgrade6Test.
Comment #46
jofitzComment #48
quietone commentedThe aggregator, book, forum and statistics modules need to be enabled in MigrateUpgradeTestBase so those migrations run. That required the entities counts to changes in the d6 and d7 tests.
Changed d6_statistics_settings to statistics_settings in MigrateUpgradeForm. But, that likely means this will need a reroll when #2569805: For Drupal migration, identify the source module is committed.
Removed changes to KernelTestBase.php that appeared in patch #24.
Comment #49
phenaproximaSelf-assigning for review.
Comment #51
phenaproximaWhy was this line removed? I seem to recall putting that there, and for a specific reason. Which, now that I'm looking at it here, should have been documented. Because I can't remember the issue where it was introduced. (Time to dig up the ol' git blame.)
assertCount() is preferable here.
I'd rather not use simple config to do this assertion -- I'd prefer to load the block entity and check the settings from there.
Ditto.
Nit: $visibility is never used. Why not just pass an empty array as the second argument to assertEntity()?
Rather than do stuff like this, could we change assertEntity() to accept another parameter, which is an array of block settings to assert? It doesn't have to be *all* the block settings, just the ones we want to check.
Comment #52
quietone commentedNeeds a reroll.
Comment #54
quietone commented1. Restored. You added it ages ago #2408165: Migration Files for Drupal 7 Blocks.
2. Fixed.
5. Fixed.
3, 4 and 6. All the occurrences of config->get are gone. A full settings array is built and passed to assertEntity for testings. A side effect is that it now easy to see that several of the blocks have an 'id' of 'broken'. That needs a bit of investigation.
Another thing is that arrays are built with two different styles and it is not pretty to read. I'd like to tidy that up, after all so much has changed because of items 3, 4, and 6. I hope that won't be out of of scope.
But first, lets make sure all the tests pass.
Comment #56
quietone commentedAnd the patch.
Comment #57
quietone commentedRemoved duplicate tests and tidy up to make it easier to read.
Comment #58
joelpittetThere is a change in MigrateUpgradeForm.php, it may be correct, but could that be split with it's related tests (if that is possible) into a follow-up? Edit: mentioned in #48, may already have a follow-up
This patch is big and should only include adding tests of "everything's ok alarms". If we find a bug that's great but probably deserves it's own issue.
Comment #59
quietone commentedFair enough. I have removed the fix in MigrateUpgradeForm. Created a new issue for the wee bug #2855611: statistics_settings migration not run in MigrateUpgrade tests.
Comment #61
quietone commentedAh, of course, the patch in #57 is correct. That fix needs to be done here.
So, the statistics module need to be enabled for the MigrationBlockTest, which needs the statistics block and the statistics settings. That also means that statistics module must be enabled for MigrateUpgrade6Test. Now, once it is enabled, MigrateUpgrade test expects to find all the migrations that are listed in the big array in MigrateUpgradeForm. That array has d6_statistics_settings, which does not exist. Thus the failure seen in the results in #59.
To fix that the name must be changed in the big array.
I hope all that makes sense. I am a bit over tired.
Setting back to NR. Reviewers - review the patch in #57.
Comment #62
phenaproximaI found nothing remotely serious. Exceedingly close to being RTBC-ready. I think, however, we need to carefully explain (in the next comment) why we have Statistics-related changes in this patch, because that will look like noise, or patch pollution, to the committers.
It looks like Seven is no longer set as anything, so we should probably remove the mention. Kind of a nitpick, though, and certainly fixable on commit.
$settings should be type hinted as array and defaulted as NULL so that asserting the settings can be optional. The description for $settings should then be prefixed with (optional).
To wit, this should be wrapped in
if (isset($settings)).A lighter-weight alternative would be
\Drupal::entityQuery($entity_type)->count()->execute(). Just an observation, no particular need to change this (unless you want to).Comment #63
quietone commentedIn order to add the settings tests back into the MigrateBlockTest some modules, aggregator, block, forum and statistics, needed to be enabled so the relevant migrations would be run. That works fine for MigrateBlockTest.
And they need to be enabled in MigrateUpgradeTestBase or we get the errors in#45. Adding those modules exposed an error in the list of migrations in MigrateUpgradeForm, where the statistic setting migration was listed as d6_statistics_settings instead of the statistics_setting. Without the correct id the statistics_settings migration was not running and the tests would fail.
edit: Made all changes from #62.
Comment #64
phenaproximaC'est fantastique.
Comment #66
jofitzRe-rolled.
Comment #67
phenaproximaAnd back to green we go!
Comment #68
phenaproximaComment #70
jofitzRetests passed, back to RTBC.
Comment #72
jofitzRetests passed, back to RTBC.
Comment #74
jofitzComment #75
alexpottCommitted and pushed 133dccc to 8.4.x and 59798d6 to 8.3.x. Thanks!
This makes this a bug fix. And it's great that we have UI test coverage here too.
Backported to 8.3.x because migrate is still experimental.