For security purposes you do not want to give your application the power to create or destroy databases, all you want is that the application can have read and write access to a single database.
For this reason, you often have to create the database either manually, or through a separate script that has database administration rights.
In the case of unit tests I suppose there is no risk in configuring database admin credentials as long as you have a separate database server for tests, so there is no risk of affecting other databases outside of the test environment. In this case you can add functions that create and destroy your database using SQL.
CLICK HERE to find out more related problems solutions.