fix: stub get_option/update_option in ImageModelRegistryTest for catalog delegation
get_models() now delegates to PRAutoBlogger_Runware_Model_Catalog which calls get_option() to check WP cache. Brain\Monkey threw MissingFunction Expectations on all registry tests. Added setUp() stub: get_option returns false (no cache) so catalog falls back to hardcoded list; update_option stubbed to prevent side-effect errors.
This commit is contained in:
@@ -16,6 +16,18 @@ use PRAutoBlogger\Tests\BaseTestCase;
|
|||||||
|
|
||||||
class ImageModelRegistryTest extends BaseTestCase {
|
class ImageModelRegistryTest extends BaseTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stub WP cache functions so the catalog class falls back to the
|
||||||
|
* hardcoded model list without hitting get_option or update_option.
|
||||||
|
*/
|
||||||
|
protected function setUp(): void {
|
||||||
|
parent::setUp();
|
||||||
|
// Catalog checks for cached data; return false → falls back to hardcoded list.
|
||||||
|
\Brain\Monkey\Functions\when( 'get_option' )->justReturn( false );
|
||||||
|
// Catalog writes cache on sync; stub so it doesn't throw in tests.
|
||||||
|
\Brain\Monkey\Functions\when( 'update_option' )->justReturn( true );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Every entry returned by get_models() must carry a non-empty id and
|
* Every entry returned by get_models() must carry a non-empty id and
|
||||||
* a provider of 'runware' or 'openrouter' (Cloudflare Workers AI was
|
* a provider of 'runware' or 'openrouter' (Cloudflare Workers AI was
|
||||||
|
|||||||
Reference in New Issue
Block a user