Skip to content

Commit 2d836d5

Browse files
committed
Environments: Add support forums environment.
Props clorith, obenland. Closes WordPress#690. git-svn-id: https://meta.svn.wordpress.org/sites/trunk@15218 74240141-8908-4e6f-9713-ba540dce6ec7
1 parent fd4599c commit 2d836d5

22 files changed

Lines changed: 2059 additions & 82 deletions

‎.github/unit-tests-suites.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ suites:
124124
paths:
125125
- 'environments/translate/**'
126126

127+
support-forums:
128+
type: wordpress
129+
name: Support Forums
130+
script: support:test
131+
paths:
132+
- 'environments/support-forums/**'
133+
127134
sso:
128135
type: wordpress
129136
name: WordPress.org SSO

‎environments/README.md‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,78 @@ npm run translate:test
170170

171171
**Translation Events 2024 design:** the events routes render the legacy templates unless the new block theme is enabled. To preview it, add `"config": { "TRANSLATION_EVENTS_NEW_DESIGN": true }` to `translate/.wp-env.override.json` and restart.
172172

173+
### Support Forums
174+
175+
A local instance of the WordPress.org Support Forums with bbPress, the `wporg-support-2024` theme, and the `wporg-bbp-*` supporting plugins. It runs as a multisite network, because the forums read the plugin and theme directories out of sibling sub-sites.
176+
177+
**Start:**
178+
179+
```bash
180+
npm run support:env start
181+
```
182+
183+
**Access:** `http://localhost:8888`
184+
185+
**Re-seed** (clears the seed flag, then re-runs the seed):
186+
187+
```bash
188+
npm run support:refresh
189+
```
190+
191+
**WP CLI:**
192+
193+
```bash
194+
npm run support:env -- run cli -- wp <command>
195+
```
196+
197+
Add `--url=localhost:8888/rosetta` (or `/plugins`, `/themes`) to target a sub-site.
198+
199+
**The network:**
200+
201+
| Blog | Path | Purpose |
202+
|---|---|---|
203+
| 1 | `/` | The global support forums — the site under development |
204+
| 2 | `/plugins` | Plugin Directory, a dependency of the `/plugin/<slug>/` forum views |
205+
| 3 | `/themes` | Theme Directory, a dependency of the `/theme/<slug>/` forum views |
206+
| 4 | `/rosetta` | A locale ("Rosetta") forum, for the locale-only code paths |
207+
208+
The blog IDs are pinned in `.wp-env.json` (`WPORG_PLUGIN_DIRECTORY_BLOGID` and friends), so the seed creates the sub-sites in that order and fails loudly if they come out differently.
209+
210+
**Note that the plugin and theme directories here exist only as forum dependencies. Use the Plugin Directory and Theme Directory environments to work on the directories themselves.**
211+
212+
On production each locale forum is its own network with `IS_ROSETTA_NETWORK` defined, which a single `wp-config.php` cannot express. `mocks/mu-plugins/wporg-support-env.php` defines it for the blog named by `WPORG_LOCAL_ROSETTA_BLOGID` instead.
213+
214+
**Forum IDs:** the `Plugins`, `Themes` and `Reviews` forums are created as the post IDs that `Plugin::PLUGINS_FORUM_ID` and `Support_Compat::HIDDEN_FORUMS` hard-code for production (21261, 21262, 21272, plus two legacy IDs). The directory compat views, the review forum, and the hidden-forum filtering all key off those, so they cannot be left to auto-increment.
215+
216+
**What to try:** `hello-dolly` is seeded on the plugin directory with a committer, a contributor and a support rep; `twentytwentyfour` is seeded on the theme directory with an author. Visit `/plugin/hello-dolly/`, `/theme/twentytwentyfour/`, and either followed by `reviews/`. Ratings submitted through the review form persist in the local `ratings` table, so the star filters and rating edits work.
217+
218+
**Local boundaries.** The environment deliberately does not reach production:
219+
220+
- Badge assignments would otherwise be a live POST to `profiles.wordpress.org`. `Badge_Automation` registers its hooks locally, because `assign_badge()` lives in the mounted `mu-plugins/pub/profile-helpers.php`, and `Profiles\queue()` dispatches synchronously for anything that is not `production` while `api()` only redirects the URL for `staging`. `mocks/mu-plugins/wporg-profiles-local.php` answers those requests and records the associations in local tables.
221+
- Outbound mail is short-circuited; the forums mail on subscriptions, moderation and reports.
222+
- `WPORG_Ratings` is a local stand-in. `Ratings_Compat` guards on `class_exists()` alone, so the stub implements every method it calls rather than a subset.
223+
- SSO, two-factor account management and the rest of the Profiles service are not reproduced.
224+
225+
**User accounts:**
226+
227+
All accounts use the password `password`.
228+
229+
| Username | Role on `/` | Role on `/rosetta` | Notes |
230+
|---|---|---|---|
231+
| `admin` | Network administrator | Network administrator | Full network admin access |
232+
| `keymaster` | `bbp_keymaster` | `bbp_participant` | Top-level forum admin; can manage all forum content |
233+
| `moderator` | `bbp_moderator` | `bbp_participant` | Can moderate topics and replies |
234+
| `rosettakeymaster` | `bbp_participant` | `bbp_keymaster` | Keymaster of the locale forum |
235+
| `rosettamoderator` | `bbp_participant` | `bbp_moderator` | Moderator of the locale forum |
236+
| `pluginauthor` | `bbp_participant` | `bbp_participant` | Committer on the seeded Hello Dolly plugin |
237+
| `plugincontributor` | `bbp_participant` | `bbp_participant` | Contributor on the seeded Hello Dolly plugin |
238+
| `pluginsupport` | `bbp_participant` | `bbp_participant` | Support rep on the seeded Hello Dolly plugin |
239+
| `themeauthor` | `bbp_participant` | `bbp_participant` | Author of the seeded Twenty Twenty-Four theme |
240+
| `themesupport` | `bbp_participant` | `bbp_participant` | Theme support rep; no production equivalent yet |
241+
| `visitor` | `bbp_participant` | `bbp_participant` | Regular forum visitor |
242+
243+
**Block editor:** the forums use the block editor through [Blocks Everywhere](https://github.com/Automattic/blocks-everywhere), which is not installed here — it needs a Gutenberg old enough to break against WordPress trunk until [Automattic/blocks-everywhere#211](https://github.com/Automattic/blocks-everywhere/pull/211) lands. `Plugin::__construct()` loads the block support only when that plugin is present, so the environment runs on bbPress' plain editor until then.
244+
173245
### WordPress.org SSO
174246

175247
A test-only environment for the shared single sign-on code in `common/includes/wporg-sso/`. The SSO is a library rather than a plugin, so it is mounted at `wp-content/wporg-sso` instead of being activated, and its PHPUnit suite runs from there.

0 commit comments

Comments
 (0)