Problem/Motivation

The tags tests are overly complicated because they use magic method names to identify what strings, etc to look for, rather than pushing that responsibility onto the tag plugins. This makes maintenance cumbersome due to the layers needed. It also makes it take an awful lot longer than otherwise necessary because each tag has a series of steps executed against them sequentially, rather than each step checking each available tag.

Proposed resolution

Rewrite MetatagTagsTestBase so it looks for test methods for various portions of logic.
Also leverage APIs to get a list of all available meta tags and checking them all at once instead of using @dataProvider.

Remaining tasks

User interface changes

n/a

API changes

TBD

Data model changes

n/a

CommentFileSizeAuthor
#48 metatag-n3164404-48.patch105.81 KBdamienmckenna
#44 metatag-n3164404-44.patch105.62 KBdamienmckenna
#39 metatag-n3164404-39.patch117.54 KBdamienmckenna
#34 metatag-n3164404-34.interdiff.txt911 bytesdamienmckenna
#34 metatag-n3164404-34.patch124.39 KBdamienmckenna
#31 metatag-n3164404-31.patch123.5 KBdamienmckenna
#31 metatag-n3164404-31.interdiff.txt1.28 KBdamienmckenna
#25 metatag-n3164404-25.patch129.6 KBdamienmckenna
#25 metatag-n3164404-25.interdiff.txt1.65 KBdamienmckenna
#22 metatag-n3164404-22.patch129.55 KBdamienmckenna
#22 metatag-n3164404-22.interdiff.txt1.48 KBdamienmckenna
#20 metatag-n3164404-19.interdiff.txt1.06 KBdamienmckenna
#20 metatag-n3164404-19.patch129.13 KBdamienmckenna
#17 metatag-n3164404-17.patch138.43 KBdamienmckenna
#17 metatag-n3164404-17.interdiff.txt1.38 KBdamienmckenna
#15 metatag-n3164404-15.interdiff.txt5.06 KBdamienmckenna
#15 metatag-n3164404-15.patch137.97 KBdamienmckenna
#14 metatag-n3164404-14.patch129.6 KBdamienmckenna
#14 metatag-n3164404-14.interdiff.txt14.56 KBdamienmckenna
#12 metatag-n3164404-12.interdiff.txt4.12 KBdamienmckenna
#12 metatag-n3164404-12.patch122.08 KBdamienmckenna
#10 metatag-n3164404-10.patch123.67 KBdamienmckenna
#9 metatag-n3164404-9.patch48.2 KBdamienmckenna
#8 metatag-n3164404-8.patch18.3 KBdamienmckenna
#6 metatag-n3164404-6.patch18.16 KBdamienmckenna
#6 metatag-n3164404-6.interdiff.txt3.93 KBdamienmckenna
#5 metatag-n3164404-5.patch17.24 KBdamienmckenna
#5 metatag-n3164404-5.interdiff.txt14.07 KBdamienmckenna
#4 metatag-n3164404-4.patch6.22 KBdamienmckenna

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Title: Rewrite tags tests to use test methods on the tag plugin itself » Rewrite tags testing architecture
Issue summary: View changes
damienmckenna’s picture

Assigned: Unassigned » damienmckenna

Working on this.

damienmckenna’s picture

StatusFileSize
new6.22 KB

WIP, just so I don't loose it.

damienmckenna’s picture

StatusFileSize
new14.07 KB
new17.24 KB

Further WIP.

damienmckenna’s picture

StatusFileSize
new3.93 KB
new18.16 KB

The first part now works - form submission.

Next up: form field validation, output validation, then update all the submodules.

damienmckenna’s picture

damienmckenna’s picture

StatusFileSize
new18.3 KB

Rerolled.

damienmckenna’s picture

Issue tags: +Needs change record
StatusFileSize
new48.2 KB

This includes a complete rewrite of the main module's tag tests. Next off I'll finish updating the submodule tests.

This will definitely require a few change notices as there are a lot of API changes going on. Will also need to look at how to much of the API changes can be added to 1.x so they're properly deprecated, rather than just dropping a large pile of surprises on 2.x.

damienmckenna’s picture

Status: Active » Needs review
Related issues: +#3298081: Deprecate Google Plus meta tags
StatusFileSize
new123.67 KB

This includes quite an extensive amount of work and will need a bunch of change notices for what's included.

Along the way I realized that we need to deprecate the GooglePlus tags so that they can be removed in 2.0, so I created a new issue for that: #3298081: Deprecate Google Plus meta tags

Let's see how well the tests run on drupalci.

Status: Needs review » Needs work

The last submitted patch, 10: metatag-n3164404-10.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new122.08 KB
new4.12 KB

The separate testMaskIconCurrent test method is no longer necessary because of the refactored test.

damienmckenna’s picture

Status: Needs review » Needs work

Some of this needs to be split out into a separate issue so we can properly deprecate some APIs, there are several @todo items that need new issues, and it needs some refinement. But the tests now finally pass correctly! Woot!

I also noticed that it drops from 377 test instantiations that take 12 minutes to run, to 121 and just under 7 minutes. This is a massive improvement and I can't wait to commit it!

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new14.56 KB
new129.6 KB

Some improvements.

damienmckenna’s picture

StatusFileSize
new137.97 KB
new5.06 KB

General improvements to the tests, some of which will need to be split out into separate issues.

Status: Needs review » Needs work

The last submitted patch, 15: metatag-n3164404-15.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.38 KB
new138.43 KB

This should fix the two regressions.

damienmckenna’s picture

Status: Needs review » Needs work

Back to needing work on the change records and splitting out some of the changes to other issues.

damienmckenna’s picture

(wrong issue)

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new129.13 KB
new1.06 KB

Out of interest, what happens if all of the submodules are enabled in the main module?

Status: Needs review » Needs work

The last submitted patch, 20: metatag-n3164404-19.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.48 KB
new129.55 KB

This should resolve the test failure.

The last submitted patch, 20: metatag-n3164404-19.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 22: metatag-n3164404-22.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.65 KB
new129.6 KB

Forgot the 'use' statement.

damienmckenna’s picture

Note: I'm not specifically intending to do all submodule testing from the main module, I just wanted to see how it performed.

damienmckenna’s picture

Status: Needs review » Needs work

Interestingly enough, running all of the submodule tests in one go took eight minutes, a whole minute slower than running each submodule separately. I think that's a good indicator that we should stick with patch #17.

Now, back to splitting out pieces.

damienmckenna’s picture

I opened #3299222 for the bugs identified in metatag_mobile.

damienmckenna’s picture

I opened #3299225 to fix the title tag's test coverage.

damienmckenna’s picture

I opened #3299228 to refactor the favicon meta tag plugins.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.28 KB
new123.5 KB

Rerolled after some other changes were committed. Also, a minor change to metatag.services.yml to make it easier to work with.

Status: Needs review » Needs work

The last submitted patch, 31: metatag-n3164404-31.patch, failed testing. View results

damienmckenna’s picture

In the interest of properly handling backwards compatibility, I think we need another issue that creates the new class files and deprecates the old ones, then commit this one to the 2.0.0 branch and remove the old classes. And add a change notice.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new124.39 KB
new911 bytes

Fixed the favicon tests.

damienmckenna’s picture

Status: Needs review » Needs work

Back to needing further work.

damienmckenna’s picture

Changes that need to go into 8.x-1.x first:

* metatag.services.yml
* $modules variables need to be "protected".
* MetaNameBase::$htmlTag
* MetaNameBase::$htmlNameAttribute
* MetaNameBase::$htmlValueAttribute
* MetaNameBase::isImage()
* MetaNameBase::isSecure()
* MetaNameBase::isMultiple()
* MetaNameBase::isUrl()
* MetaNameBase::getTestFormXpath()
* MetaNameBase::getTestFormData()
* MetaNameBase::getTestOutputExistsXpath()
* MetaNameBase::getTestOutputValuesXpath()
* .. and all overrides of the new MetaNameBase attributes and methods.

damienmckenna’s picture

The protected-modules change was committed in #3302675.

damienmckenna’s picture

Some of the additional small changes were committed in #3302685.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new117.54 KB

Rerolled after some of the other commits.

damienmckenna’s picture

Issue summary: View changes

I updated the issue summary to note tasks that are already completed and what's left to do.

damienmckenna’s picture

Status: Needs review » Needs work

Back to needing more work.

damienmckenna’s picture

I added #3302969 for the improvements to MetaNameBase.

damienmckenna’s picture

#3302969 was committed, so this needs to be updated again.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new105.62 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 44: metatag-n3164404-44.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
damienmckenna’s picture

An initial change record is available: https://www.drupal.org/node/3305570

damienmckenna’s picture

StatusFileSize
new105.81 KB

Rerolled.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Woot!

damienmckenna’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Assigned: damienmckenna » Unassigned

Status: Fixed » Closed (fixed)

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