@@ -135,18 +135,29 @@ public function testRollbackWithoutBeginTransaction()
135135 $ this ->_conn ->rollBack ();
136136 }
137137
138- public function testGetServerVersion ()
138+ public function testGetServerVersionNativeConnection ()
139139 {
140140 // Retrieve server version.
141141 $ serverVersion = $ this ->_conn ->getNativeConnection ()->getServerVersion ();
142+ $ this ->assertNotNull ($ serverVersion , 'Server version should not be null ' );
143+ $ this ->assertNotEquals ('0.0.0 ' , $ serverVersion , 'Server version should not be 0.0.0 ' );
144+ $ this ->assertMatchesRegularExpression (
145+ '/^\d+\.\d+\.\d+/ ' ,
146+ $ serverVersion ,
147+ 'Server version should follow semantic versioning '
148+ );
149+ }
142150
143- // Assume tests are running against CrateDB 5.x or higher, which is likely,
144- // because it will mostly be running on CrateDB nightly.
145- // Otherwise, we will need to populate this value from an external source,
146- // for example an environment variable populated by a CI build matrix.
147- $ this ->assertTrue (
148- version_compare ($ serverVersion , '5.0.0 ' , '>= ' ),
149- 'Server version should be at least 5.0.0 ' ,
151+ public function testGetServerVersionWrappedConnection ()
152+ {
153+ // Retrieve server version.
154+ $ serverVersion = $ this ->_conn ->getWrappedConnection ()->getServerVersion ();
155+ $ this ->assertNotNull ($ serverVersion , 'Server version should not be null ' );
156+ $ this ->assertNotEquals ('0.0.0 ' , $ serverVersion , 'Server version should not be 0.0.0 ' );
157+ $ this ->assertMatchesRegularExpression (
158+ '/^\d+\.\d+\.\d+/ ' ,
159+ $ serverVersion ,
160+ 'Server version should follow semantic versioning '
150161 );
151162 }
152163
0 commit comments