Fortify Bible reference interpretation

This commit is contained in:
2026-07-11 20:16:27 -05:00
parent 5835e5a3b2
commit f2bc638509
9 changed files with 284 additions and 326 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ $GeneratedRoot = Join-Path $LabRoot 'generated'
$ResultsRoot = Join-Path $LabRoot 'results'
$PluginSource = Join-Path $WorkspaceRoot 'plugins\bible-reference-tooltips'
$PluginSlug = 'bible-reference-tooltips'
$ExpectedPluginVersion = '1.1.5'
$ExpectedPluginVersion = '1.1.6'
function Get-TestLabEnvironments {
Get-Content -LiteralPath $ConfigPath -Raw | ConvertFrom-Json
+43 -1
View File
@@ -80,6 +80,48 @@ echo $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->prefix . 'brt_v
$tableExists = (Invoke-WpCli $environment 'wp eval-file /tmp/brt-table.php --path=/var/www/html' | Out-String).Trim()
Add-Check 'verse table created' ($tableExists -eq 'wp_brt_verses') $tableExists
$interpretationPhp = @'
<?php
$plugin = new Bible_Reference_Tooltips();
$ref = new ReflectionClass($plugin);
$call = function($method, ...$args) use ($plugin, $ref) {
$m = $ref->getMethod($method);
$m->setAccessible(true);
return $m->invokeArgs($plugin, $args);
};
$checks = [];
foreach ([
['parse_reference', 'James 1:5', 'JAS'],
['parse_reference', 'Jas 1:5', 'JAS'],
['parse_reference', 'Jm 1:5', 'JAS'],
['parse_reference', 'Mark10:45', 'MRK'],
['parse_reference', '2Jn1:6', '2JN'],
['parse_reference', 'Eze 36:26', 'EZK'],
] as $case) {
$parsed = $call($case[0], $case[1]);
if (!$parsed || $parsed['book'] !== $case[2]) $checks[] = $case[1] . '=>' . json_encode($parsed);
}
foreach ([
['EZE 36:26 source', 'EZE', 'EZK'],
['MAR 10:45 source', 'MAR', 'MRK'],
['JOH 3:16 source', 'JOH', 'JHN'],
['JAM 1:5 source', 'JAM', 'JAS'],
['1JO 1:9 source', '1JO', '1JN'],
] as $case) {
$book = $call('normalize_source_book', $case[1], 'ebible_vpl');
if (!$book || $book['abbr'] !== $case[2]) $checks[] = $case[0] . '=>' . json_encode($book);
}
$aliases = $call('frontend_book_alias_patterns');
$alias_keys = array_map('strtolower', $aliases);
foreach (['James', 'Jm', 'Eze', 'Mar', '2\\s*Jn'] as $needle) {
if (!in_array(strtolower($needle), $alias_keys, true)) $checks[] = 'missing frontend alias ' . $needle;
}
echo $checks ? json_encode($checks) : 'ok';
'@
Write-ContainerPhpFile $environment '/tmp/brt-interpretation.php' $interpretationPhp
$interpretation = (Invoke-WpCli $environment 'wp eval-file /tmp/brt-interpretation.php --path=/var/www/html' | Out-String).Trim()
Add-Check 'interpretation registry' ($interpretation -eq 'ok') $interpretation
$translationsToImport = @('WEB', 'KJV', 'ASV', 'YLT')
foreach ($translationCode in $translationsToImport) {
$importPhp = @"
@@ -126,7 +168,7 @@ echo $missing ? json_encode($missing) : 'ok';
$bookCoverage = (Invoke-WpCli $environment 'wp eval-file /tmp/brt-book-coverage.php --path=/var/www/html' | Out-String).Trim()
Add-Check 'canonical book coverage' ($bookCoverage -eq 'ok') $bookCoverage
$refs = @('John 3:16', 'John 3.16', 'Jn3:16', 'Romans 8:28', 'James 1:5', 'Mark 10:45', 'Mark10:45', 'Mk 10:45', 'Ezekiel 36:26', 'Eze 36:26', '2 John 1:6', '2Jn1:6', '2 Jo 1:6')
$refs = @('John 3:16', 'John 3.16', 'Jn3:16', 'Romans 8:28', 'James 1:5', 'Jas 1:5', 'Jm 1:5', 'Mark 10:45', 'Mark10:45', 'Mk 10:45', 'Mar 10:45', 'Ezekiel 36:26', 'Eze 36:26', '2 John 1:6', '2Jn1:6', '2 Jo 1:6')
foreach ($ref in $refs) {
$lookupPhp = @"
<?php