@@ -107,4 +107,34 @@ public function testBoltFactoryWithSocketTypeOverride(): void
107107 $ factory = BoltFactory::create (null , SocketType::STREAM ());
108108 self ::assertInstanceOf (BoltFactory::class, $ factory );
109109 }
110+
111+ public function testCreateConnectionWithNullServerAgent (): void
112+ {
113+ // This test reproduces issue #285 where authenticateBolt returns null for server
114+ $ auth = $ this ->createMock (AuthenticateInterface::class);
115+ $ auth ->method ('authenticateBolt ' )
116+ ->willReturn (['server ' => null , 'connection_id ' => 'i ' , 'hints ' => []]);
117+
118+ $ connection = $ this ->factory ->createConnection (
119+ new ConnectionRequestData ('' , Uri::create ('' ), $ auth , '' , SslConfiguration::default ()),
120+ SessionConfiguration::default ()
121+ );
122+
123+ self ::assertInstanceOf (BoltConnection::class, $ connection );
124+ }
125+
126+ public function testCreateConnectionWithMissingServerKey (): void
127+ {
128+ // This test reproduces issue #285 where authenticateBolt returns response without server key
129+ $ auth = $ this ->createMock (AuthenticateInterface::class);
130+ $ auth ->method ('authenticateBolt ' )
131+ ->willReturn (['connection_id ' => 'i ' , 'hints ' => []]);
132+
133+ $ connection = $ this ->factory ->createConnection (
134+ new ConnectionRequestData ('' , Uri::create ('' ), $ auth , '' , SslConfiguration::default ()),
135+ SessionConfiguration::default ()
136+ );
137+
138+ self ::assertInstanceOf (BoltConnection::class, $ connection );
139+ }
110140}
0 commit comments