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.
As per the parent issue.
./Update/AutomatedCronUpdateWithAutomatedCronTest.php
./Update/AutomatedCronUpdateWithoutAutomatedCronTest.php
./Update/ConfigOverridesUpdateTest.php
./Update/DbUpdatesTrait.php
./Update/DependencyHookInvocationTest.php
./Update/DependencyMissingTest.php
./Update/DependencyOrderingTest.php
./Update/FieldSchemaDataUninstallUpdateTest.php
./Update/FilterHtmlUpdateTest.php
./Update/InstallProfileSystemInstall8300Test.php
./Update/InvalidUpdateHookTest.php
./Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
./Update/MenuTreeSerializationTitleFilledTest.php
./Update/MenuTreeSerializationTitleTest.php
./Update/PageTitleConvertedIntoBlockUpdateTest.php
./Update/RecalculatedDependencyTest.php
./Update/RouterIndexOptimizationFilledTest.php
./Update/RouterIndexOptimizationTest.php
./Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
./Update/SiteBrandingConvertedIntoBlockUpdateTest.php
./Update/StableBaseThemeUpdateTest.php
./Update/UpdateEntityDisplayTest.php
./Update/UpdatePathRC1TestBaseFilledTest.php
./Update/UpdatePathRC1TestBaseTest.php
./Update/UpdatePathTestBase.php
./Update/UpdatePathTestBaseFilledTest.php
./Update/UpdatePathTestBaseTest.php
./Update/UpdatePathTestJavaScriptTest.php
./Update/UpdatePathWithBrokenRoutingFilledTest.php
./Update/UpdatePathWithBrokenRoutingTest.php
./Update/UpdatePostUpdateFailingTest.php
./Update/UpdatePostUpdateTest.php
./Update/UpdateSchemaTest.php
./Update/UpdateScriptTest.php
./Update/UpdatesWith7xTest.php
Comment | File | Size | Author |
---|---|---|---|
#32 | 2870009-32.patch | 80.26 KB | Lendude |
#32 | interdiff-2870009-30-32.txt | 3.61 KB | Lendude |
#30 | 2870009-30.patch | 79.2 KB | Lendude |
#30 | interdiff-2870009-28-30.txt | 2.86 KB | Lendude |
#28 | 2870009-28.patch | 78.39 KB | Lendude |
Comments
Comment #2
dawehnerI tried starting with this ... but yeah it doens't work yet, I believe the batch process doesn't work yet.
Comment #4
naveenvalechaComment #5
dawehnerJust a reroll for now.
Comment #7
savkaviktor16@gmail.com CreditAttribution: savkaviktor16@gmail.com at Skilld commentedI could apply the patch, so no reroll is needed
Comment #8
apadernoThe patch could apply, but it needs to be changed basing on the automated coding standards fixes. Also, the patch failed testing.
Comment #9
Lendude@dawehner really amazing how far you got with this.
Batch is in BrowserTestBase now, so lets see if we can move this. Cleared up some fails, cleaned up some debug code.
\Drupal\FunctionalTests\Update\UpdatePathTestBaseTest
passes locally now, so lets see what is still broken here.Comment #11
LendudeBleh that was rolled against 8.3.x, this is it for 8.4.x
Comment #13
LendudeThese tests pass locally on both SQlite and MySQL :(
Comment #14
dawehnerWow, this is amazing! This is at least one of the really painful conversions we kinda have in front of us.
Comment #15
apadernoSee the changes suggested from PHP_CodeSniffer in #12.
I didn't check the code, but PHP_CodeSniffer is suggesting that two
use
lines are referring a class that is then not used.Comment #16
dawehnerI did a bit of investigation.
Comment #18
dawehnerThis is commenting out
$originalContainer
on theFunctionSetupTrait
. Does someone has a better suggestion?Comment #20
LendudePer the PHP manual:
Note:
Prior to PHP 7.0, defining a property in a class with the same name as in a trait would throw an E_STRICT if the class definition was compatible (same visibility and initial value).
So the best solution would be to move to PHP 7 :-)
Lets see what this does.
Comment #21
dawehnerThat is a good solution for now! Thank you @lendude
In the meantime we could leverage
@property
https://phpdoc.org/docs/latest/references/phpdoc/tags/property.html if we care about it :)Comment #23
Lenduderequire vs require_once ....
This now comes back green locally with APC switched on.
Comment #24
dawehnerI don't understand that, can you elaborate?
Comment #25
LendudeI honestly have no idea why require_once doesn't work here with APC on, but it just returns TRUE, which makes me believe that somehow that file was loaded before (or APC thinks it was) so the _once won't load it again.
Conceptually it just makes more sense to me to just use require anyway, since at that point in the code we don't care if its been loaded before, we want to always load it there.
But as to the exact nature of why that fix works, not a clue :)
Working on converting the other update tests in system. So far it's all coming back green.
Comment #26
LendudeAll tests in system/src/Tests/Update converted or deprecated
Comment #28
LendudeThis should clear up some fails.
stripped the part about unsetting exception messages out of
\Drupal\Tests\system\Functional\Update\UpdatePathWithBrokenRoutingTest
since it's not needed anymore.The rest is pretty straight forward.
Comment #30
LendudeGoing for green....
Comment #31
dawehnerWe need the trigger_error statements, don't we?
Is there a reason you removed this?
We should we do with those?
Comment #32
Lendude@dawehner thanks for the feedback as always
#31.1 yup, and apparently we need a CR for those deprecations now too, so added that, plus a see to the CR
#31.2 It served no purpose in BrowserTestBase. It seems that was needed to get WebTestBase to pass, but BrowserTestBase passes just fine, and that logic doesn't test anything, it just unsets stuff, so we don't lose any coverage I think, just a WebTestBase specific workaround.
#31.3 Well we need to lose the commented line :). That stuff seems to be for making Simpletest UI play nice with the Batch API. We don't have a UI at the moment, so lets get rid of that line.
Comment #33
dawehnerI had a look at the original issue #2498625-12: Write tests that ensure hook_update_N is properly run which introduced the restoreBatch call. Sadly there isn't any real explanation. I send @jhedstrom a message instead.
Comment #34
jibranThanks, @dawehner and @Lendude for working on this. Created #2896755: Convert Update Tests to BTB from WTB for DER and it works great.
Comment #35
dawehnerThank you @jibran. This is really good to know that contrib modules can leverage it properly. Thank you for letting us know
Comment #36
naveenvalechaNice work guys @dawehner and @lendude.
@jibran,
Nice work on converting contributed projects. Really appreciate your efforts.
Sorry, I don't want to become the guy who brings bad news but Drupal ci is not able to able test those b/c Drupal\FunctionalTests\Update\UpdatePathTestBase does not exist in the 8.4.x head yet I don't know why the CI showed its green. If you'll look at the full output at dispatcher.drupalci.org it will show the error https://dispatcher.drupalci.org/job/drupal8_contrib_patches/9770/console...
As you have converted dynamic entity reference tests here #2896755: Convert Update Tests to BTB from WTB and Drupal ci also isn't able to test it properly. Would you apply this patch to your Drupal core on your local and also convert the DER tests and try to run it on your local and verify it.
Steps:
- Git clone 8.4.x Drupal core
- Apply the patch here #2870009: Update: Convert system functional tests to phpunit to Core
- Git clone DER in modules directory
- Apply the patch here #2896755: Convert Update Tests to BTB from WTB to DER
- Run the DER tests locally
P.S.: I'm busy with my exams so don't have much time to convert updates tests for any of my contributed modules and test this patch.
//Naveen
Comment #37
jibran@naveenvalecha of course, I know this is not committed yet. I'm not concerned with CI yet. I tested it locally after applying the patch and it was green that's why I reported it worked.
Comment #39
jhedstromThe addition of the
restoreBatch
method was made in #2498625: Write tests that ensure hook_update_N is properly run because the update test base classes needed to call things that were previously just hardcoded inWebTestBase::setUp()
in a slightly different order (it has been quite some time though, so this is just my best recollection).Comment #40
Lendude@jhedstrom thanks for the feedback!
so that would lead me to the conclusion that we can just lose restoreBatch in BrowserTestBase if the tests pass without it (which they do).
Comment #41
jibranPatch looks good. All the feedback is addressed. Contrib can use new base class as well as shown in #34. This is ready imo.
Comment #42
larowlanCan we get a follow-up to get this in its own method, so we don't have to duplicate it between here and BTB?
nit, should be a space after the -
Comment #44
larowlanCommitted as 7204a00 and pushed to 8.5.x.
Cherry-picked as 4dc3a46 and pushed to 8.4.x.
Published change record.
Great work here...on with the conversions!
Can we get the follow-up as per #42.1?
Comment #45
larowlanComment #46
Lendude@larowlan++++++
Here is the follow up #2904834: Move BROWSERTEST_OUTPUT_FILE logic in BrowserTestBase::setUp to a method and make BrowserTestBase and and \Drupal\FunctionalTests\Update\UpdatePathTestBase use it
Comment #47
jibran#2896755: Convert Update Tests to BTB from WTB came back green after this went in. I think we should update some documentation around this conversion. The namespace/location change is trivial but we have to change the dump location in tests as well.