Problem/Motivation

The test cases on \Drupal\Tests\Core\Render\Element\HtmlTagTest have just a numeric key, which makes it hard to find which data set fails.

Follow up from #2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs (#74)

Proposed resolution

Let's add a descriptive key to each one, so that this shows in the fail message making it easier to identify the failing data set.

Remaining tasks

Provide a patch, after #2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs gets in

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Manuel Garcia created an issue. See original summary.

Manuel Garcia’s picture

Status: Active » Postponed
FileSize
5.72 KB

Here's a start. Attached patch depends on the changes from https://www.drupal.org/files/issues/2694535-71.patch, so it wont apply properly til that gets in.

Manuel Garcia’s picture

Status: Postponed » Needs review
WidgetsBurritos’s picture

Assigned: Unassigned » WidgetsBurritos
Status: Needs review » Needs work

The patch in #2 is missing names for providerPreRenderConditionalComments() . I'll update the patch.

WidgetsBurritos’s picture

Assigned: WidgetsBurritos » Unassigned
Status: Needs work » Needs review
FileSize
8.25 KB
2.41 KB
Manuel Garcia’s picture

Ah, good call @WidgetsBurritos, changes on #5 look good to me. I applied the patch and had a read of HtmlTagTest, all are covered now.

Manuel Garcia’s picture

Status: Needs review » Reviewed & tested by the community

boldly RTBCing as this is simple enough...

Gábor Hojtsy’s picture

I see that @larowlan asked for naming these in #2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs and @catch agreed. Can we clarify here why is naming these an improvement? Are we getting better fail messages?

Manuel Garcia’s picture

@Gábor Hojtsy yes that's indeed the motivation here. With this patch its a lot easier to identify the data set that failed (you get the key in the $tags array):

With this patch:

There was 1 failure:

1) Drupal\Tests\Core\Render\Element\HtmlTagTest::testPreRenderHtmlTag with data set "no-value" (array('p', null), '<p><p>\n')

Without it:

There was 1 failure:

1) Drupal\Tests\Core\Render\Element\HtmlTagTest::testPreRenderHtmlTag with data set #1 (array('p', null), '<p><p>\n')
Manuel Garcia’s picture

Issue summary: View changes

  • Gábor Hojtsy committed 3344093 on 8.4.x
    Issue #2889378 by WidgetsBurritos, Manuel Garcia: Name test cases on...
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

All right, makes sense. Looks like those are the only changes made. Thanks!

#2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs was 8.4 only, so not backported to 8.3 and it should not be.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.