1. Go to this page and download the library: Download genesis/behat-sql-extension 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/ */
genesis / behat-sql-extension example snippets
use Genesis\SQLExtension\Context;
$databaseParams = [
'engine' => 'mssql', // The database engine to use, mysql, mssql, pgsql.
'schema' => 'dbo', // The database schema. Optional.
'dbname' => 'MyDB', // The database name.
'prefix' => 'dev_', // You can provide a database prefix which could be different based on the environment.
'host' => '192.168.0.1', // The database host.
'port' => '9876', // The database port.
'username' => 'db_username', // The username for the database.
'password' => 'db_password' // The password for the database.
];
$this->sqlContext = new Context\API(
new Context\DBManager(
new Context\DatabaseProviders\Factory(),
$databaseParams
),
new Context\SQLBuilder(),
new Context\LocalKeyStore(),
new Context\SQLHistory()
);
class FeatureContext
{
public function __construct()
{
$this->sqlContext = ...;
$this->sqlContext->get('dbManager')->getProviderFactory()->registerProvider(
string $engine,
string $providerClass
);
}
}
$this
->select(string $table, array $where) # select a record, essentially perform a iHaveAnExistingWhere.
->insert(string $table, array $where) # Insert a new record if it does not exist, same as iHaveAWith
->update(string $table, array $update, array $where) # Update an existing record, same as iHaveAnExistingWithWhere
->delete(string $table, array $where) # Delete a record, same as iDontHaveAWhere
;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.