assertNotEmpty( $models ); foreach ( $models as $model ) { $this->assertArrayHasKey( 'id', $model ); $this->assertNotEmpty( $model['id'] ); $this->assertArrayHasKey( 'provider', $model ); $this->assertContains( $model['provider'], [ 'runware', 'openrouter', 'cloudflare' ], sprintf( 'Unexpected provider %s for model %s', (string) $model['provider'], (string) $model['id'] ) ); } } /** * provider_for() returns the paired provider for a known model id. * This is the core of the v0.8.0 collapsed-dropdown contract. */ public function test_provider_for_returns_paired_provider_for_known_model(): void { $this->assertSame( 'cloudflare', \PRAutoBlogger_Image_Model_Registry::provider_for( 'flux-1-schnell' ) ); $this->assertSame( 'openrouter', \PRAutoBlogger_Image_Model_Registry::provider_for( 'google/gemini-2.5-flash-image' ) ); } /** * Runware model ids (added v0.9.0) resolve to the 'runware' provider. * This test pins the v0.9.0 default flip so a registry regression * that loses the Runware entries fails CI loudly. */ public function test_provider_for_runware_models(): void { $this->assertSame( 'runware', \PRAutoBlogger_Image_Model_Registry::provider_for( 'runware:100@1' ) ); $this->assertSame( 'runware', \PRAutoBlogger_Image_Model_Registry::provider_for( 'runware:101@1' ) ); } /** * Unknown model ids return an empty string so callers can distinguish * "not in registry" from a valid provider and show a settings error. */ public function test_provider_for_returns_empty_for_unknown_model(): void { $this->assertSame( '', \PRAutoBlogger_Image_Model_Registry::provider_for( 'nonexistent/model' ) ); $this->assertSame( '', \PRAutoBlogger_Image_Model_Registry::provider_for( '' ) ); } }