PHP code example of bancer / paratest-databases-factory
1. Go to this page and download the library: Download bancer/paratest-databases-factory library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bancer / paratest-databases-factory example snippets
use Bancer\ParatestDatabasesFactory\DatabasesFactory;
...
(new DatabasesFactory())
->setDsn(getenv('pf_dsn'))
->setUsername(getenv('pf_user'))
->setPassword(getenv('pf_pass'))
->createDatabase('pf_test');
if (getenv('TEST_TOKEN') !== false) { // Using paratest
$databaseName .= getenv('TEST_TOKEN');
}
sql
CREATE USER 'pf_user'@'%' IDENTIFIED BY 'your_password';
GRANT CREATE ON *.* TO 'pf_user'@'%';
CREATE DATABASE pf_test;
GRANT SELECT ON `pf_test`.* TO 'pf_user'@'%';
xml
<env name="pf_dsn" value="mysql:dbname=pf_test;host=localhost"/>
<env name="pf_user" value="pf_user"/>
<env name="pf_pass" value="your_password"/>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.