post-smtp
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/develop.tangible.one/htdocs/wp-includes/functions.php on line 6121https://bitbucket.org/tangibleinc/blocks
git clone git@bitbucket.org:tangibleinc/tangible-blocks.git
cd tangible-blocks
npm install && composer install
Build for development - watch files for changes and rebuild
npm run dev
Build for production
npm run build
Format to code standard
npm run format
This plugin comes with a suite of unit and integration tests.
composer install --dev
will install PHPUnit.
To run the tests, we rely on the wp-env tool to quickly spin up a local dev and test environment, optionally switching between multiple PHP versions.
Please note that wp-env
requires Docker to be installed. There are instructions available for installing Docker on Windows, macOS, and Linux.
This repository includes NPM scripts to run the tests with PHP versions 8.2 and 7.4.
Note: We need to maintain compatibility with PHP 7.4, as WordPress itself only has “beta support” for PHP 8.x. See https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ for more information.
If you’re on Windows, you might have to use Windows Subsystem for Linux to run the tests (see this comment).
To run the tests with Docker installed:
npm install
npm run env:test:7.4
npm run env:test:8.2
The version-specific commands take a while to start, but afterwards you can run npm run env:test to re-run tests in the same environment.
To stop the Docker process:
npm run env:stop
To “destroy” and remove cache:
npm run env:destroy
The folder /tests/e2e
contains end-to-end-tests using Playwright and WordPress E2E Testing Utils.
Run the tests. This will start the local WordPress environment with wp-env
as needed. Then Playwright starts a browser engine to interact with the test site.
npm run test:e2e
The first time you run it, it will prompt you to install the browser engine (Chromium).
npx playwright install
There is a "Watch mode", where it will watch the test files for changes and re-run them. This provides a helpful feedback loop when writing tests, as a kind of test-driven development. Press CTRL + C to stop the process.
npm run test:e2e:watch # Shortcut: npm run tdd
A common usage is to have terminal sessions open with npm run dev
(build assets and watch to rebuild) and npm run tdd
(run tests and watch to re-run).
There's also "UI mode" that opens a browser interface to see the tests run.
npm run test:e2e:ui
Here are the common utilities used to write the tests.
test
- https://playwright.dev/docs/api/class-testexpect
- https://playwright.dev/docs/api/class-genericassertionsadmin
- https://github.com/WordPress/gutenberg/tree/trunk/packages/e2e-test-utils-playwright/src/adminpage
- https://playwright.dev/docs/api/class-pagerequest
- https://playwright.dev/docs/api/class-apirequestcontextExamples of how to write end-to-end tests: