Skip to content

refactor: emit integration diagnostics via STDERR#13

Merged
rbcorrales merged 1 commit into
mainfrom
refactor/route-test-error-log
May 27, 2026
Merged

refactor: emit integration diagnostics via STDERR#13
rbcorrales merged 1 commit into
mainfrom
refactor/route-test-error-log

Conversation

@rbcorrales
Copy link
Copy Markdown
Member

@rbcorrales rbcorrales commented May 27, 2026

Summary

Replaces the two raw error_log() calls in tests/integration/DatabaseIntegrationTest.php with fwrite( STDERR, ... ).

Background

Closes out the long-running error_log() -> Logger cleanup. Production includes/ already routes through WPVDB\Logger (the only sanctioned raw error_log() is the centralized, phpcs-ignored sink at class-wpvdb-logger.php:174). The last raw calls were these two integration-test diagnostics.

fwrite( STDERR, ... ) is the right fit here rather than Logger:

  • They are deliberate test diagnostics (vector-support and insert/query timing) that should always print during a test run. Logger::debug() is gated behind wpvdb_should_log_to_error_log() and would silence them.
  • fwrite( STDERR, ... ) is the PHPUnit-idiomatic way to emit a diagnostic and avoids the WordPress.PHP.DevelopmentFunctions.error_log_error_log smell.

After this, no raw error_log() calls remain anywhere except the sanctioned sink.

Testing

php -l clean. Behavior preserved (diagnostics still print, now to STDERR). Note: this test file is integration-only (self-skips without a real DB) and is outside the phpcs scan surface, so this is a focused 3-line change.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors integration-test diagnostics by replacing raw error_log() calls with fwrite( STDERR, ... ), aligning the test suite with the codebase’s logging cleanup while preserving always-on diagnostic output during PHPUnit runs.

Changes:

  • Replace two error_log() diagnostics with fwrite( STDERR, ... ) in the integration test suite.
  • Add/adjust diagnostic comment text and ensure diagnostics include trailing newlines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rbcorrales rbcorrales changed the title refactor(tests): emit integration diagnostics via STDERR refactor: emit integration diagnostics via STDERR May 27, 2026
@rbcorrales rbcorrales merged commit d4fe812 into main May 27, 2026
1 check passed
@rbcorrales rbcorrales deleted the refactor/route-test-error-log branch May 27, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants