fix(tests): add wp_salt + wp_generate_uuid4 stubs + PublisherTest fixture
Adds missing wp_salt() and wp_generate_uuid4() stubs to BaseTestCase::setUp() so tests that call PRAutoBlogger_Encryption (for API key decryption) don't fail. Fixes PublisherTest::test_publish_links_generation_logs_by_run_id() which was capturing the wrong database query (SELECT from SourceCollector) due to test fixture including source_ids. Now creates a fixture override without source_ids to isolate the run_id linking assertion. Related: Failures #1 and #2 from PR #109.
This commit is contained in:
@@ -42,6 +42,14 @@ abstract class BaseTestCase extends TestCase {
|
||||
// Stub returns false to simulate when PR Core is not installed.
|
||||
Functions\when( 'post_type_exists' )->justReturn( false );
|
||||
|
||||
// wp_salt is used by PRAutoBlogger_Encryption to derive encryption keys.
|
||||
// Used when decrypting stored API keys. Stub returns a deterministic value.
|
||||
Functions\when( 'wp_salt' )->justReturn( 'test-salt-deterministic-value' );
|
||||
|
||||
// wp_generate_uuid4 is used by CostTracker, ImageSideloader, and Runware provider.
|
||||
// Stub returns a deterministic UUID so tests are reproducible.
|
||||
Functions\when( 'wp_generate_uuid4' )->justReturn( '00000000-0000-0000-0000-000000000000' );
|
||||
|
||||
// current_time is called by Logger on every log write. Stub returns a
|
||||
// deterministic timestamp so tests are reproducible.
|
||||
Functions\when( 'current_time' )->alias( static function ( $type = 'mysql', $gmt = 0 ) {
|
||||
|
||||
Reference in New Issue
Block a user