@@ -137,6 +137,51 @@ public static function bannerConditionProvider(): array
137137 ];
138138 }
139139
140+ public function testBannerShownWhenDefaultIdpIsInPreferredConfigButDroppedBySpitter (): void
141+ {
142+ $ defaultId = 'https://default.example.org ' ;
143+ $ otherId = 'https://other.example.org ' ;
144+
145+ // Default IdP is unconnected (splitter will drop it); other preferred IdP is connected.
146+ $ idpList = [
147+ new WayfIdp (name: null , logo: '' , keywords: [], accessible: false , id: md5 ($ defaultId ), entityId: $ defaultId , isDefaultIdp: true , discoveryHash: null ),
148+ new WayfIdp (name: null , logo: '' , keywords: [], accessible: true , id: md5 ($ otherId ), entityId: $ otherId , isDefaultIdp: false , discoveryHash: null ),
149+ ];
150+
151+ $ capturedShowIdPBanner = null ;
152+
153+ $ this ->factory ->expects ($ this ->once ())
154+ ->method ('create ' )
155+ ->willReturnCallback (function () use (&$ capturedShowIdPBanner ): WayfViewModel {
156+ $ namedArgs = func_get_args ();
157+ $ capturedShowIdPBanner = $ namedArgs [9 ];
158+ return $ this ->buildViewModel ($ namedArgs [9 ]);
159+ });
160+
161+ $ this ->twig ->method ('render ' )->willReturn ('<html> ' );
162+
163+ $ sp = $ this ->createStub (ServiceProvider::class);
164+ $ sp ->method ('getDisplayName ' )->willReturn ('Test SP ' );
165+
166+ $ this ->renderer ()->render (
167+ idpList: $ idpList ,
168+ preferredIdpEntityIds: [$ defaultId , $ otherId ],
169+ action: '/sso ' ,
170+ currentLocale: 'en ' ,
171+ defaultIdpEntityId: $ defaultId ,
172+ shouldDisplayBanner: true ,
173+ backLink: false ,
174+ cutoffPoint: 100 ,
175+ rememberChoice: false ,
176+ showRequestAccess: false ,
177+ requestId: 'req-1 ' ,
178+ serviceProvider: $ sp ,
179+ );
180+
181+ $ this ->assertTrue ($ capturedShowIdPBanner , 'Banner should show: default IdP was in preferred config but dropped by splitter, so it is not visible anywhere ' );
182+ }
183+
184+
140185 public function testSplitsIdpListBeforePassingToFactory (): void
141186 {
142187 $ preferredId = 'https://preferred.example.org ' ;
0 commit comments