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
When there is no canonical link template, an exception is thrown.
Proposed resolution
Add a check for the template in path_entity_translation_delete
.
Comments
Comment #1
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedAdded the check.
Comment #2
miro_dietikerBack to work for the missing tests.
Comment #3
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedAdded the test to check the removal of canonical link templates.
Comment #4
Berdirmissing empty line between namespace and use.
I don't think we need any of this, this all doesn't matter for an API test.
We should even be able to make this a fast kernel test.
Also, please provide a failing test-only patch.
Comment #5
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedRemoved the extra code and adding the test only patch (which is supposed to fail).
Comment #7
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedLooks good! Tried switching to a Kernel test, but that doesn't seem so easy (added the language module, added the user module, now it complains about a missing table [entity_test_mul, I also tried added entity_test to the list of modules and installing the schema for it in the setUp, nothing worked]).
Comment #8
BerdirLooks good, but the test shouldn't be named KernelTest if it isn't one ;)
Also, I've recently found: #2539634: PathItem::delete() never runs because the path field type is a computed field in disguise
If I'm not mistaken then we can implement that issue in a way that will fix the problem here, you might want to consider working on that so we know if we can really replace that hook completely.
Comment #9
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedRenamed the test.
Comment #10
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedLooks good to go.
Comment #11
miro_dietikerMind the Berdir statement at #8 and check #2539634: PathItem::delete() never runs because the path field type is a computed field in disguise
I'm postponing this for the other... Please explain the resulting situation if you need to reopen it, or close it as a duplicate if it solves the problem.
Comment #12
BerdirYes, but turns out that what I proposed in that other issue isn't actually how it works for field items at the moment, they are *not* called when a translation is removed. Which very likely is a bug but possibly not easy to fix.
So, let's get this in and then we have the test coverage to make sure this works, even if we end up removing that hook.
Comment #14
olli CreditAttribution: olli commentedLooks like #2552687: Test failures in ConfigFormOverrideTest and ContainerRebuildWebTest on newly spun up testbot instances.
Comment #15
alexpottThere is no need for this to be a WebTestBase test. It could be KernelTestBase afaics.
name italian for a de language? A bit confusing.
Comment #16
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedConverted to a kernel test and changed the translation name.
Comment #17
juanse254 CreditAttribution: juanse254 at MD Systems GmbH commentedPassing tests, tested manually and works. Code seems fine as well setting to RTBC.
Comment #18
BerdirThat comment doesn't make sense to me, what are we rebuilding? We just add a language.
Also, the negotation stuff below very likely isn't needed here.
Comment #19
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedRebased, fixed the comment and removed the "noegotation stuff" below.
Comment #20
dawehnerNote: You could also write a phpunit based kerneltestbase, actually everything should work the same
Comment #21
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedChanged the path for KernelTestBase and moved the test into \Drupal\path\tests\Kernel.
Comment #22
BerdirOk, looks good to me now.
Comment #23
catch'when there is no'?
Comment #24
catchApart from that nitpick looks good.
Also bumping to major.
Comment #25
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedThx, rerolled and fixed the comment now.
Comment #27
miro_dietikerSetting to RTBC since the fix cleanly implements what catch asked.
Comment #28
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!