mix php.golden (ElixirPhpEmailValidator v1.0.0)

Copy Markdown View Source

Runs every input in test/fixtures/corpus.exs through the real filter_var(..., FILTER_VALIDATE_EMAIL) of your local php binary and writes a golden verdict file to test/fixtures/golden/php-<version>.tsv.

These golden files are committed and are the oracle the differential tests assert against, so anyone can verify parity with mix test even without PHP installed. Regenerate them (e.g. after adding corpus cases, or to record a new PHP version) with:

mix php.golden

The functions in this module are also used by the live test suite, so the test-time and CLI generation paths are identical.

Summary

Functions

Loads all corpus inputs (binaries), de-duplicated, order preserved.

Absolute path to the php executable, or raises with guidance.

Glob of all committed golden files.

Path to the golden file for a given PHP version string.

Parses golden TSV text (with or without # header/comment lines) into a list of {input_binary, default_valid?, unicode_valid?} tuples.

Invokes the PHP oracle (scripts/gen_golden.php) over the given inputs and returns its raw TSV output: lines of base64_input\tdefault\tunicode.

Returns the PHP version string of the given binary (e.g. "8.5.5").

Functions

corpus_inputs()

Loads all corpus inputs (binaries), de-duplicated, order preserved.

Two sources are merged:

  • test/fixtures/corpus.exs — curated, human-readable cases plus the programmatic length/boundary constructions.
  • test/fixtures/corpus_catalog.b64 — the authoritative byte-exact quirks catalog (base64 per line; fields after a tab are documentation).

find_php!()

Absolute path to the php executable, or raises with guidance.

golden_files()

Glob of all committed golden files.

golden_path(version)

Path to the golden file for a given PHP version string.

parse_golden_tsv(text)

Parses golden TSV text (with or without # header/comment lines) into a list of {input_binary, default_valid?, unicode_valid?} tuples.

php_raw_tsv(php, inputs)

Invokes the PHP oracle (scripts/gen_golden.php) over the given inputs and returns its raw TSV output: lines of base64_input\tdefault\tunicode.

php_version(php)

Returns the PHP version string of the given binary (e.g. "8.5.5").