- 🇮🇳India ranjith_kumar_k_u Kerala
Added tests please review
Steps to reproduce
- create a link field on a content type(Link text should be enabled)
- create content with following link "/exampleview?param[89]=89" (Link text should have a value)
- Status changed to Needs review
over 1 year ago 2:07pm 31 March 2023 - Status changed to Needs work
over 1 year ago 7:12pm 31 March 2023 - 🇺🇸United States smustgrave
Thanks for working on the tests.
Making a new function means a new bootstrap. Since majority of the code is used already in LinkFieldTest think we should be able to add those assertions into an existing tests.
#2 still cleanly applied to 10.1 so removing credit for #16.
- Status changed to Needs review
over 1 year ago 2:33pm 3 April 2023 - Status changed to RTBC
over 1 year ago 2:51pm 3 April 2023 - 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
This looks great, test coverage is comprehensive.
+++ b/core/lib/Drupal/Core/Render/Element/Link.php @@ -89,7 +89,7 @@ public static function preRenderLink($element) { - $options = NestedArray::mergeDeep($element['#url']->getOptions(), $element['#options']);
I first thought this might have performance implications, and it does , but not because mergeDeep is replaced with mergeDeepArray, that is the same code. This introduces recursion and because of that it can be slower, but this is correct so I don't think we have to do performance testing there?
The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- Status changed to Needs review
over 1 year ago 12:17am 4 April 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
+++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -856,6 +856,20 @@ public function testNoLinkUri() { + $expected_link = (string) $this->container->get('link_generator')->generate('Test link', Url::fromUserInput('/example?parameter[89]=89')); + $this->assertStringContainsString($expected_link, $output);
Should we be explicit here and hard code the expected link? I don't think we'd need to allow for the basepath because this isn't a routed link.
My concern is that by using the link generator, we're assuming there's no similar bug in the link generator. Whereas if we hard code the expected URL, we can be sure that the SUT is working as expected.
- Status changed to Needs work
over 1 year ago 12:27pm 4 April 2023 - Status changed to Needs review
over 1 year ago 2:01pm 5 April 2023 - Status changed to Needs work
over 1 year ago 2:22pm 5 April 2023 - 🇺🇸United States smustgrave
The failure is legit though so can't be merged.
- 🇺🇸United States smustgrave
Take into account core tests run in subdirectory.
So this probably needs to be different
$expected_link = ' Test link → ';
- Status changed to Needs review
over 1 year ago 12:09pm 12 April 2023 - Status changed to Needs work
over 1 year ago 4:34pm 12 April 2023 - 🇺🇸United States smustgrave
Not quiet what I meant. This is being setup to only pass here. If ran anywhere else it will fail with that subdirectory line.
Instead of hard checking a URL should build a URL object.
- 🇮🇳India ranjith_kumar_k_u Kerala
Instead of hard checking a URL should build a URL object
is it like this?
$expected_url = Url::fromUserInput('/example?parameter[89]=89')->toString(); $expected_link = '<a href="' . $expected_url . '">Test link</a>'; $this->assertStringContainsString($expected_link, $output);
- 🇮🇳India ranjith_kumar_k_u Kerala
I hope this is the correct way to hardcode the internal link
$base_path = parse_url($this->baseUrl, PHP_URL_PATH) ?? ''; $expected_link = '<a href="' . $base_path . '/example?parameter%5B89%5D=89">Test link</a>'; $this->assertStringContainsString($expected_link, $output);
- last update
over 1 year ago 29,281 pass, 1 fail - last update
over 1 year ago 29,283 pass - Status changed to Needs review
over 1 year ago 9:52am 18 April 2023 - Status changed to RTBC
over 1 year ago 2:47pm 18 April 2023 - 🇺🇸United States smustgrave
Definitely better. Lets see what the committer says.
Thanks for keeping with it!
- last update
over 1 year ago 29,281 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,290 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,300 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,302 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,341 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,364 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,364 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,369 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,376 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,377 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,378 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,381 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,386 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,386 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,385 pass, 3 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,385 pass, 3 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,393 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,397 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,397 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,398 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,407 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,407 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,413 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,418 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,418 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,423 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,427 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,428 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,428 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,428 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,434 pass, 1 fail The last submitted patch, 20: 2974555-20-test-only.patch, failed testing. View results →
- last update
over 1 year ago 29,436 pass - last update
over 1 year ago 29,436 pass - last update
over 1 year ago 29,441 pass - last update
over 1 year ago 29,442 pass - last update
over 1 year ago 29,443 pass - last update
over 1 year ago 29,443 pass - last update
over 1 year ago 29,443 pass - last update
over 1 year ago 29,439 pass - last update
over 1 year ago 29,439 pass - last update
over 1 year ago 29,443 pass - last update
over 1 year ago 29,444 pass - last update
over 1 year ago 29,446 pass - last update
over 1 year ago 29,446 pass - last update
over 1 year ago 29,446 pass - last update
over 1 year ago 29,446 pass - last update
over 1 year ago 29,450 pass - last update
over 1 year ago 29,453 pass - last update
over 1 year ago 29,454 pass - last update
over 1 year ago 29,455 pass - last update
over 1 year ago 29,456 pass - last update
over 1 year ago 29,457 pass - last update
over 1 year ago 29,458 pass - last update
over 1 year ago 29,458 pass - last update
over 1 year ago 29,459 pass - Status changed to Needs work
over 1 year ago 1:54am 9 August 2023 - 🇳🇿New Zealand quietone
The IS is brief but easy to understand what is happening here. I've added the standard template so remaining steps can be added.
All questions in the comments have been addressed.
I applied the patch and read the code. What caught my eye is that the test is added to
testNoLinkUri
which is for testing no links, as described in the doc block for that function. So can we move this test to a different existing method? I see thatdoTestLinkFormatter
tests a variety of valid and invalid links. Maybe that would work, or is there a better option.Setting NW to investigate putting the test elsewhere.