# Test Environment Setup

## `CWC_TEST_BYPASS_HERO_GATE`

The inner-page hero is gated by `isServicesDescendant()` (see `lib/extras.php`).
A page renders the hero only if it is the Services page, a direct child of it,
or a grandchild of it.

The Playwright suite under `tests/` includes fixtures that are **not** Services
descendants (e.g. `sample-page`). When the new gate is enabled, those pages
no longer render the hero, and the existing `inner-page.spec.js` assertions
fail.

To keep the existing test fixtures working without forking the test suite,
the theme exposes a bypass constant:

```php
define( 'CWC_TEST_BYPASS_HERO_GATE', true );
```

When `CWC_TEST_BYPASS_HERO_GATE` is `true`, `isServicesDescendant()` returns
`true` for every post, so the hero is rendered for all pages — matching the
pre-gate behavior expected by the existing tests.

## How to enable on the dev site

Add the following line to `wp-config.php` on the dev site
(`community-works-collaborative.test`), ideally near the other `define()`
calls in that file:

```php
define( 'CWC_TEST_BYPASS_HERO_GATE', true );
```

The constant defaults to `false` in `lib/extras.php`, so production sites are
unaffected unless this define is added.

## Why this is a manual step

This repository does not own the WordPress install — `wp-config.php` is
managed by the operator of the dev site. The theme cannot and should not
modify `wp-config.php` itself.

## Production note

Do **not** define this constant on production. It exists solely to let the
test environment continue to use the same fixtures the suite was originally
written against.
