Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:tests:adminlocalescatalogtest

tests/unit/AdminLocalesCatalogTest.php

Source: tests/unit/AdminLocalesCatalogTest.php · 228 lines, ~855 statements · namespace: (global) · `declare(strict_types=1)`: no


AdminLocalesCatalogTest

Unit tests for the DB-driven admin locale catalog helpers in lib/utility/sanitize-locale.php:

\ - admin_locales_catalog() — single source of truth for the supported

  admin content locales. Falls back to the 7 supported languages when no
  database connection is available, and is overridden by the active
  languages in tbl_languages when it is.

\ - admin_locale_select() — renders the <select> with native labels,

  escapes every attribute and label, and preserves a legacy stored locale
  that is not part of the catalog (BC safety).

The fallback path and the DB-override + XSS-escaping path are exercised in isolated PHP subprocesses (same pattern as ThemeSearchUrlTest) so the tests stay deterministic even though the PHPUnit process may hold a live Registry 'dbc' connection from an integration test.

Imports

Alias Fully-qualified name
TestCase PHPUnit\Framework\TestCase

Includes

Mode Target Line
require require_once DIR . '/../../lib/utility/dropdown.php'; 29
require require_once DIR . '/../../lib/utility/sanitize-locale.php'; 30

Types declared here


Generated by 'tools/gendoc'.

scriptlog/tests/adminlocalescatalogtest.txt · Last modified: by admin