Contribute to WordPress core – Test Trac Ticket and GitHub Pull Requests.

NB! Needs an update!

Contribute to WordPress by testing Trac ticket patches and Github Pull Requests (PR’s).

How to test a Trac ticket and Github PR.

Further down this page are instructions for testing a default WordPress theme from 2019, 2020 and 2021.

In Part 1 of our series, we showed you how to setup your local environment for contributing to the WordPress core codebase. In this tutorial, we will walk you through how to test Trac tickets and Github issues.

Trac is our project management tool at WordPress. Community members use this software to submit changes to the WordPress core files in the form of tickets. Since we use subversion (SVN) and Git at WordPress, we can track our changes using patch files. A path is simply a text document that helps our version control software to identify the changes to the WordPress core files.

Testing proposed codebase changes is a great way to help the WordPress community. To do this, you will need a patch number from the Trac system. For this tutorial we will test Ticket 43890 at https://core.trac.wordpress.org/ticket/43890 . As you follow along, you many also find it helpful to reference the Trac Ticket Overview infographic.

Mac, Linux and Windows

1. Install patch (Trac)

In your Trac ticket, find the Ticket ID Number in the top left corner of the page. For the ticket we are testing, the ticker number is 43890. We will use this number to identify the patch we want to test.

In your terminal, type:

npm run grunt patch:43890


After inserting the command, an option will show up to select which patch (diff) to test. Use the up and down arrows on your keyboard to select the newest diff (patch).

2. Test patch

Login to your local WordPress site: http://localhost:8889/ with the standard credentials
username: admin
password: password
or the ones you created. Then, review the ticket carefully to see what needs to be tested and add comments to the ticket with your results.

Test a GitHub pull request (PR)

Sometimes you might be asked to test a WordPress Develop GitHub pull request (PR), similar to testing a Trac ticket. The pull request number is oftentimes mentioned in the Trac Ticket. It can also be found in the WordPress Develop repository. For example, pull request #957 is found at https://github.com/WordPress/wordpress-develop/pull/957 . The pull request number is found at the end of the URL. After you have found the pull request number, type:

npm run grunt patch:https://github.com/WordPress/wordpress-develop/pull/957

This will merge the proposed changes into your local development environment. Login to WordPress at http://localhost:8889/ to test the pull request (patch). Do remember to submit comments to the Trac ticket.

Reset local environment

When you are done testing, discard the patch/PR’s code changes to restore your local WordPress environment by typing:

git reset --hard

How to test Twenty Nineteen (2019), Twenty Twenty (2020) and Twenty Twenty One(2021) themes.

These themes have their own build process which needs to be run before core development is run. Here is an example for testing the Twenty Twenty One theme.

First, go to your local environment’s root folder. Type:

cd wordpress-develop

Navigate to the Twenty Twenty One directory:

cd src/wp-content/themes/twentytwentyone

In this directory are several dependencies that need to be installed in order for the code to work properly. Install your dependencies with:

npm install

Build the structure of your theme codebase:

npm run build

The theme also needs to have the CSS/Sass styles compiled before running the wordpress-develop build.

Go back to the wordpress-develop directory with:

cd ~/wordpress-develop

Inside wordpress-develop, add:

npm run build

Go back to testing a Trac ticket or a Github PR above.

Troubleshooting

Testing code can be tricky. Here are some common solutions if you get stuck.

Perform a hard refresh.
Close and reopen terminal. Then test again. When you open
http://localhost:8889/ be sure to log out and do a hard refresh of the browser you are using and then log back in again.

Patches with JavaScript changes
When a patch includes JavaScript files, we need to update the development build after the patch has been applied. Run one of the following commands:

npm run build

Or

npm run build:dev

If the JavaScript is still not working, then run this command.

npm run dev

Log out of the dev site and do a hard refresh in the browser and log back in again.

Reset testing environment
Something might happen so that you need to apply the patch again. If you encounter errors, try reseting the testing environment with:

git reset --hard

Restart the development environment
If you are not able to open http://localhost:8889/ , you may need to restart the local environment settings. Run this command:

npm run env:start

Uninstall instructions (Mac and Linux)

1. Uninstall Homebrew.
In your terminal, add:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Type y to confirm.
Type your password.

2A. Uninstall Docker.
Open the Docker application and go to the Dashboard.
Click the bug icon button seen in the top blue bar.
Click the Uninstall button.
Then drag the Docker app to your trash can.

2B. Skip uninstall of Docker.
If you only want to reset your WordPress Docker image and all the virtual discs it creates, uninstall the WordPress developer environment:

npm run env:reset

Make sure you are in your wordpress-develop directory before you run the command above!

3. Delete local wordpress-develop directory.
Open the user folder in the root and locate the wordpress-develop folder and delete it.

Resource:
https://github.com/Homebrew/install

Uninstall instructions (Windows)

1. Uninstall Docker.
Go to the “Uninstall Program” screen and select to uninstall the Docker application.

2. Delete the wordpress-develop directory.
Locate the wordpress-develop folder and delete it.

Resources

Share the article:

Leave a Reply

Your email address will not be published.

sixteen − ten =