I add the branch 11.x to the fork but now the 4 tests fails with the same error, even the tests elready present which have not been modified.
Drupal\Tests\field\Kernel\KernelString\StringFormatterTest::testStringFormatter
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "string" plugin does not exist. Valid plugin IDs for Drupal\Core\Field\FormatterPluginManager are: text_trimmed, text_summary_or_trimmed, text_default, entity_reference_custom_cache_tag, user_name, author, uri_link, timestamp, timestamp_ago, number_unformatted, email_mailto, language, number_integer, entity_reference_label, entity_reference_entity_id, entity_reference_entity_view, number_decimal, boolean, basic_string
https://git.drupalcode.org/issue/drupal-3269889/-/jobs/1013107
I confirm, tests are ok with phpUnit on my locale.
I'm not sure Reverting core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php works, I read the following error :
fatal: invalid reference: refs/heads/11.x
Yes, the MR is good to review.
@smustgrave the test case to show the issue is testLinkEntitiesWithoutCanonical.
The following lines check render don't contains link when an entity without canonical is displayed with link to entity :
// Test a link is not being generated for entities without canonical URLs
// when link_to_entity is set to TRUE.
$this->renderEntityFields($entity_without_canonical, $display_with_link);
$this->assertNoLink($value);
$this->assertNoLinkByHref($entity_without_canonical->toUrl()->toString());
The 2 asserts failed when we keeping original core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php.
The 2 asserts succeed when we apply patch into core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php.
The testLinkEntitiesWithCanonical which passes with or without the fix can be removed, @mxh proposed to write it (#12).
Say me if we keep or remove it. Thank you in advance.
@Thanks for the review @smustgrave.
The goal of the issue is to replace the check on the entity_type ($entity_type->hasLinkTemplate('canonical')) inside StringFormatter::viewElements by a check on the entity itself ($entity->hasLinkTemplate('canonical')).
The test "testLinkEntitiesWithCanonical" passes because the return of StringFormatter::viewElements stilling to be the same with and without the fix.
Do you think it is necessary to add a new test to illustrate the check replacement on the entity_type by on the entity itself ?
Fix Needs Review Queue Bot
@mxh I tried to follow your recommendations.
Can you take a look and tell me if any adjustments are needed?
Thank you in advance.
Sorry this issue is duplicated : https://www.drupal.org/project/quicktabs/issues/3280637 🐛 Database error produced in QuickBlockContent->accessBlock RTBC
franck_lorancy → created an issue.