Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the 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 6121
Develop

Develop


Template System module

This is the template system shared by Tangible Blocks and Loops & Logic.

Source code

https://github.com/tangibleinc/template-system

Overview

Tests

This modules comes with a suite of unit and integration tests.

Requirements

To run the tests, we use 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.

If you're on Windows, you might have to use Windows Subsystem for Linux to run the tests (see this comment).

Prepare

Install dependencies by running the following in the project directory.

npm install

Install PHPUnit.

composer install --dev

Run tests

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 PHP Compatibility and WordPress versions for more information.

First, run tests using a specific PHP version. This will tell wp-env to install it.

npm run env:test:8.2

The version-specific command takes a while to start, but afterwards you can run the following to re-run tests in the same environment.

npm run env:test

To switch the PHP version, run a different version-specific command.

npm run env:test:7.4

To stop the Docker process:

npm run env:stop

Usually it's enough to run env:start and env:stop. To completely remove the created Docker images and remove cache:

npm run env:destroy