diff --git a/features/php/support/db.rb b/features/php/support/db.rb
index <HASH>..<HASH> 100644
--- a/features/php/support/db.rb
+++ b/features/php/support/db.rb
@@ -1,15 +1,8 @@
-client = Mysql2::Client.new(:host => "localhost", :username => "renalware", :password => "password")
-
-client.query("CREATE DATABASE IF NOT EXISTS renalware_test")
-
-# Load legacy schema
-`cat db/schema.sql | mysql renalware_test -u renalware --password=password`
-
 $client = Mysql2::Client.new(:host => "localhost", :username => "renalware",
   :database => "renalware_test", :password => "password", :init_command => "SET UNIQUE_CHECKS = 0")
 
 at_exit do
-  $client.query("DROP DATABASE renalware_test")
+  reset_database
   $client.close
 end
 
@@ -20,4 +13,12 @@ end
 
 After do
   $client.query 'ROLLBACK'
+end
+
+def reset_database
+  $client.query("DROP DATABASE renalware_test")
+  $client.query("CREATE DATABASE IF NOT EXISTS renalware_test")
+
+  # Load legacy schema
+  `cat db/schema.sql | mysql renalware_test -u renalware --password=password`
 end
\ No newline at end of file
Ensured that php test doesn't drop the database