WordPress Developer Ukraine, Kyiv
PHP Pest Testing Framework for WordPress Plugins

PHP Pest Testing Framework for WordPress Plugins

Pest for WordPress plugin tests Pest is a testing framework on top of PHPUnit with a shorter syntax: tests are closures with a description instead of methods in classes, and expectations read like sentences. For WordPress plugins, it runs on the same WordPress test suite and bootstrap as PHPUnit, so an existing setup can switch…
WordPress Development Workflow: Using wp-env with Xdebug and PhpStorm

WordPress Development Workflow: Using wp-env with Xdebug and PhpStorm

Debug WordPress with wp-env, Xdebug and PhpStorm @wordpress/env (wp-env) starts a complete WordPress development environment in Docker with one command, with the current plugin or theme mounted inside. It also has Xdebug built in: one flag enables it, and PhpStorm (or VS Code) can then stop at breakpoints in your plugin, step through the code…
Git Hooks with Husky and lint-staged for WordPress Projects

Git Hooks with Husky and lint-staged for WordPress Projects

Git hooks with Husky and lint-staged in a WordPress project A coding standards check in CI catches problems after the push, and the developer has to fix and push again. A pre-commit hook catches them before the commit exists. Husky installs git hooks from the repository for everybody who runs npm install, and lint-staged runs…
WordPress Plugin Security Audit: Static Analysis with RIPS and Semgrep

WordPress Plugin Security Audit: Static Analysis with RIPS and Semgrep

A security review of a WordPress plugin with PHPCS and Semgrep Most vulnerabilities in WordPress plugins belong to a few patterns: output without escaping, input without sanitizing, a missing nonce or capability check, SQL built from variables, a file path from a request. Static analysis tools find many of them in minutes, before a human…
Write Unit Tests for WordPress Plugins with PHPUnit and WP-CLI Scaffold

Write Unit Tests for WordPress Plugins with PHPUnit and WP-CLI Scaffold

Write unit tests for WordPress plugins with PHPUnit and WP-CLI scaffolding WordPress unit tests run against a real WordPress loaded with a separate test database. Every test runs inside a database transaction that is rolled back afterwards, so each test starts from a clean state. WP-CLI generates the whole setup, and the base class WP_UnitTestCase…