Skip to content

Testing

phil/redirects-bundle
AreaWhat is covered
Sources and targetsEvery kind, the normalization of a path, every bound and refusal, the placeholders
The table and the resolverThe order of the kinds and hosts, the longest prefix, the locales, the cache in memory and in a pool
LocationsThe captures encoded, a prefix's rest, the query policy, the routes, a location that would leave the site
Loops and chainsLoops, chains allowed and bounded, the redirects leading to a new source, hosts and locales kept apart
RedirectsEvery save through its checks, the import line by line, the dry run, the check
The 404 logWhat is kept and what is not, the filters, the capacity, the purge
The storesSQLite in memory, and the statements as a driver may answer them
The listenersA redirect, a 410, the writes after the response, the reset, a failed write, an old domain
The administrationEach page and form on Twig with the bundle's templates and translations, the role, the token
The commands, the bundleEach command; the wiring and every bound of the configuration; a kernel on SQLite

Infection holds the bundle at 100 % of mutants killed; the casts that cannot be observed are named in phil-dev.php.

vendor/bin/phpunit packages/redirects-bundle/tests

Fuzzing

tests/Fuzz/pattern.php reads a source of each kind and a path from inputs nobody wrote: a source is accepted or refused with InvalidRedirect, nothing else, and a location built from what it captured never leaves the site.

composer fuzz -- pattern

Benchmark

tests/Benchmark/NotFoundResolverBench.php resolves requests not found on a table of 10,000 redirects — 7,000 exact, 2,000 prefixes, 1,000 wildcards, half for one host. On a recent laptop:

SubjectTime
An exact sourceabout 3 µs
A prefix, a wildcardabout 7 µs
A path nothing matchesabout 8 µs
Building the tableabout 7 ms
composer bench -- packages/redirects-bundle/tests/Benchmark