@@ -41,9 +41,9 @@ private function skipIfNeo4jNotAvailable(): void
4141 // In Docker environments, this is typically 'neo4j'
4242 $ host = $ _ENV ['NEO4J_HOST ' ] ?? 'neo4j ' ;
4343 $ port = $ _ENV ['NEO4J_PORT ' ] ?? '7687 ' ;
44-
44+
4545 // Create a simple TCP connection test
46- $ socket = @fsockopen ($ host , (int )$ port , $ errno , $ errstr , 5 );
46+ $ socket = @fsockopen ($ host , (int ) $ port , $ errno , $ errstr , 5 );
4747 if (!$ socket ) {
4848 $ this ->markTestSkipped (
4949 'Neo4j server is not available for testing. ' .
@@ -52,34 +52,34 @@ private function skipIfNeo4jNotAvailable(): void
5252 );
5353 }
5454 fclose ($ socket );
55-
55+
5656 // Additional check: Try to make a simple HTTP request to Neo4j's web interface
5757 $ httpPort = $ _ENV ['NEO4J_HTTP_PORT ' ] ?? '7474 ' ;
5858 $ context = stream_context_create ([
5959 'http ' => [
6060 'timeout ' => 5 ,
61- 'method ' => 'GET '
62- ]
61+ 'method ' => 'GET ' ,
62+ ],
6363 ]);
64-
64+
6565 $ httpResponse = @file_get_contents ("http:// $ host: $ httpPort " , false , $ context );
66- if ($ httpResponse === false ) {
66+ if (false === $ httpResponse ) {
6767 $ this ->markTestSkipped (
6868 'Neo4j server is not fully available for testing. ' .
6969 'Please start a Neo4j server to run profiler tests. ' .
7070 "Error: Cannot connect to Neo4j HTTP interface at $ host: $ httpPort "
7171 );
7272 }
73-
73+
7474 // Final check: Try to create a minimal Neo4j client connection
7575 try {
7676 $ user = $ _ENV ['NEO4J_USER ' ] ?? 'neo4j ' ;
7777 $ password = $ _ENV ['NEO4J_PASSWORD ' ] ?? 'testtest ' ;
78-
78+
7979 $ client = \Laudis \Neo4j \ClientBuilder::create ()
8080 ->withDriver ('default ' , "bolt:// $ user: $ password@ $ host: $ port " )
8181 ->build ();
82-
82+
8383 // Try a simple query to verify the connection works
8484 $ result = $ client ->run ('RETURN 1 as test ' );
8585 } catch (\Exception $ e ) {
0 commit comments