Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions phpbb-test-board/feature_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Exit status: 0 if every check passed, 1 if any failed, 2 for bad arguments.
"""
import argparse
import json
import re
import secrets
import shutil
Expand Down Expand Up @@ -138,6 +139,10 @@ def check_documentation(b: Board) -> None:
ok(False, "docs build path is configured")
return
build = b.root / rows[0][0]
# store/ isn't reset between runs the way ext/ is, so start from an
# empty build rather than whatever an earlier run left there.
if build.resolve().is_relative_to(b.root.resolve()):
shutil.rmtree(build, ignore_errors=True)
for sub, marker in (("en", "PROBE-DOCS-HOME"), ("en/userguide", "PROBE-DOCS-SECTION")):
(build / sub).mkdir(parents=True, exist_ok=True)
(build / sub / "index.html").write_text(
Expand All @@ -155,6 +160,18 @@ def check_documentation(b: Board) -> None:
ok(r.status_code == 200 and "PROBE-DOCS-HOME" in r.text, f"guest can read the docs home ({r.status_code})")
r = g.get(f"{b.base}/app.php/documentation/en/userguide")
ok(r.status_code == 200 and "PROBE-DOCS-SECTION" in r.text, f"guest can read a section page ({r.status_code})")
# Versions with a server-side search fallback answer a search without
# JavaScript from <lang>/<section>/search-index.json.
helper = b.root / "ext/phpbbmodders/documentation/controller/documentation_helper.php"
if "SEARCH_INDEX_FILE" in helper.read_text(encoding="utf-8"):
(build / "en/userguide/search-index.json").write_text(json.dumps(
[{"url": "/en/userguide/", "title": "PROBE-SEARCH-TITLE", "text": "probe searchable words"}]))
r = g.get(f"{b.base}/app.php/documentation-search/en", params={"q": "searchable words"})
ok(r.status_code == 200 and "PROBE-SEARCH-TITLE" in r.text and "documentation/en/userguide" in r.text,
f"search without JavaScript returns server results ({r.status_code})")
r = g.get(f"{b.base}/app.php/documentation-search/en", params={"q": "nothing matches this"})
ok(r.status_code == 200 and "PROBE-SEARCH-TITLE" not in r.text and 'role="status"' in r.text,
f"search without JavaScript reports no results ({r.status_code})")
# A guest who loses access gets the login form rather than a bare 403.
b.sql("DELETE FROM phpbb_acl_groups "
"WHERE group_id = (SELECT group_id FROM phpbb_groups WHERE group_name = 'GUESTS') "
Expand Down
Loading