Quality and Production

9

questions

How do you review a junior's code?

The big picture first, then the details. Separate the must-haves from the nice-to-haves. Explain the reason and give links. Praise good decisions. Big changes — talk them through, not 40 comments.

How do you test logic that lives in hooks?

Move the logic into separate classes with pure methods, and only call them from the hook. Then unit tests cover the logic and integration tests cover the hook registration.

How does PHPCS differ from PHPStan?

PHPCS checks style and patterns (WPCS: escaping, nonce, prepare). PHPStan is static analysis of types and logic: non-existent methods, wrong types, dead code.

What do you automate in a PR?

Style (PHPCS), static analysis (PHPStan), tests, the JS build. The human keeps architecture, business logic and security in context.

What is special about Pantheon for a WordPress developer?

Clear Dev → Test → Live environments, code only through git, a read-only file system on Live and Test (except uploads), built-in Redis and edge-level caching.

What is wp-env?

The @wordpress/env tool that runs WordPress in Docker with the plugins you need, from a .wp-env.json config. Handy for local development and for tests in CI.

What should be excluded from the host cache for WooCommerce?

The cart, checkout, My Account and requests with the woocommerce_items_in_cart, woocommerce_cart_hash, wp_woocommerce_session_* cookies. Managed hosts usually do it themselves, but it has to be checked.

What should E2E tests cover in a store?

The critical money path: add to cart, apply a coupon, place an order with a test payment method, get the thank-you page. For both classic and block checkout if both are used.

Why can't you move the database from staging to a store's production?

Production keeps getting new orders, customers and stock changes. Moving the staging database would overwrite that data. Settings changes are moved by hand, with migration scripts or by exporting specific settings.