Skip to content

test(admin): cover every line and condition of folder sites, both ways - #45

Open
xiregroup wants to merge 1 commit into
mainfrom
alexei/folder-sites-c37944
Open

xiregroup wants to merge 1 commit into
mainfrom
alexei/folder-sites-c37944

Conversation

@xiregroup

Copy link
Copy Markdown
Contributor

Sites in folders (`example.com/site2/`) are already in main (225dcca). This adds the tests the new rule asks for: every changed line covered, every condition both ways, and a test that goes red when the line is broken.

  • Unit tests with named data providers: folder normalization, the paths a folder holds (`/site2` vs `/site22`), the root URL without the folder.
  • Feature tests: the folder's shape (Latin letters, digits, dashes, underscores; length limits; Unicode, HTML and emoji refused), reserved panel prefixes (admin, api, mcp, also when configured elsewhere), the default site at the root, one address per site, a request into a folder leaves nothing behind, assets keep their own origin.
  • Bitrix: the default site is moved and listed first, whatever its sort order.
  • Small simplifications so no mutant is left that no test can tell apart (redundant casts and checks).

Checked with `bin/ci`: lint, PHPStan, PHPUnit on SQLite, MySQL and PostgreSQL, coverage (changed lines 100%) and mutation (MSI 100% on the changed lines of admin and bitrix), Dusk. The only red leg here is PostgreSQL for the backup package: this machine has no `pg_dump`; the package is untouched.

Data providers for folder normalization, the paths a folder holds, the root
URL without the folder, the folder's shape and the reserved panel prefixes;
tests for the one address per site rule, the default site at the root, and
that a request into a folder leaves nothing behind. Bitrix: the default site
is moved and listed first. Mutation score of the changed lines is 100%.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant