Restore consoleLog helper and remove test stub masking production fatal
The v2 rewrite of processLogEntries() calls consoleLog(...) at two
skip branches (no id, and no deposited/withdrawn). Commit 3ebc5e2 had
removed the project helper from includes/utilities.php, leaving a
production runtime fatal ("Call to undefined function consoleLog()")
the first time a non-vault entry flowed through fetchAndStoreLogPage
-> processLogEntries in real use.
The previous test appeared to pass only because it defined a local
no-op consoleLog stub via function_exists() guard — masking the defect
behind a test fixture that never reached either skip branch.
Fix:
- Restore the original consoleLog() helper to
includes/utilities.php (unchanged from the pre-3ebc5e2 codebase;
spec lists it as unchanged).
- Remove the local consoleLog stub from
tests/process_log_entries_test.php so the test now exercises
the real production code path.
This commit is contained in:
@@ -287,3 +287,16 @@ function fetchAndStoreLogPage($pdo, $user, $url) {
|
||||
|
||||
return $responseData['_metadata']['links']['next'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a variable to the console for debugging purposes.
|
||||
*
|
||||
* @param mixed $data The data to print to the console.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function consoleLog( $data ) {
|
||||
echo '<script>';
|
||||
echo 'console.log(' . json_encode($data) . ')';
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user