@@ -96,18 +96,29 @@ public function testConnect()
9696 $ this ->assertEquals ('crate ' , $ row ['name ' ]);
9797 }
9898
99- public function testGetServerVersion ()
99+ public function testGetServerVersionNativeConnection ()
100100 {
101101 // Retrieve server version.
102102 $ serverVersion = $ this ->_conn ->getNativeConnection ()->getServerVersion ();
103+ $ this ->assertNotNull ($ serverVersion , 'Server version should not be null ' );
104+ $ this ->assertNotEquals ('0.0.0 ' , $ serverVersion , 'Server version should not be 0.0.0 ' );
105+ $ this ->assertMatchesRegularExpression (
106+ '/^\d+\.\d+\.\d+/ ' ,
107+ $ serverVersion ,
108+ 'Server version should follow semantic versioning '
109+ );
110+ }
103111
104- // Assume tests are running against CrateDB 5.x or higher, which is likely,
105- // because it will mostly be running on CrateDB nightly.
106- // Otherwise, we will need to populate this value from an external source,
107- // for example an environment variable populated by a CI build matrix.
108- $ this ->assertTrue (
109- version_compare ($ serverVersion , '5.0.0 ' , '>= ' ),
110- 'Server version should be at least 5.0.0 ' ,
112+ public function testGetServerVersionWrappedConnection ()
113+ {
114+ // Retrieve server version.
115+ $ serverVersion = $ this ->_conn ->getWrappedConnection ()->getServerVersion ();
116+ $ this ->assertNotNull ($ serverVersion , 'Server version should not be null ' );
117+ $ this ->assertNotEquals ('0.0.0 ' , $ serverVersion , 'Server version should not be 0.0.0 ' );
118+ $ this ->assertMatchesRegularExpression (
119+ '/^\d+\.\d+\.\d+/ ' ,
120+ $ serverVersion ,
121+ 'Server version should follow semantic versioning '
111122 );
112123 }
113124
0 commit comments