How can I link tests to GitHub issues?

I don’t know of a library, but you could probably build one using TracTickets as a guide and using GitHub’s API.

I’m actually answering to say don’t do this. WordPress actually no longer uses this method of skipping tests. See ticket #30284. I quote from there:

Our previous convention was to write unit tests to demonstrate bugs, annotate those tests with a @ticket flag, and commit them to the repo. Then, when running the suite, WP_UnitTestCase::knownWPBug() would get a list of open tickets from Trac, and skip tests against open tickets, allowing the build to pass.

But:

The new convention is to commit tests only when fixing the bug.

I recommend you consider the reasons that WordPress has abandoned this method (which are outlined in that ticket), and I think you’ll probably conclude that you don’t want to do this. Instead, the tests should committed along with the fix. You don’t want failing tests, what you want is fixed bugs.

But this leaves dozens of failed tests in the repo. These tests should be pulled out, converted to patches, and uploaded to their relevant Trac ticket with a note indicating what’s just happened. Once all the failed tests are out of the repo, we can remove the knownWPBug behavior from the test runner.

This has been done, all but removing knownWPBug(). It was probably decided to leave it in for backward compatibility.

The reason you are still seeing a lot of skipped tests is that some tests require multisite to be on (or off), and other require PHP to be compiled with certain extensions disabled. There are other reasons that tests are skipped too.

tech