Download the PHP package genesis/sql-data-mods without Composer

On this page you can find all versions of the php package genesis/sql-data-mods. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sql-data-mods

SQL Data Mods (Behat Extension) Codeship Status for forceedge01/sql-api-wrapper

Need fixture data but seed causing headaches? Create fixture seed data on the fly, keep them visible in your scenarios, auto generate data and deal with complex data relationships.

Find example usage in the features folder.

Release details:

Major: Allow multiple data sources to be defined.

Minor:

Patch:

Tools provided by this package:

CLI Commands:

Debug sql only:

Debug all:

Generate data mod:

DataModSQLContext

The last value in the list above uses an external reference to fetch the value to be inserted. You can find out more about this by reading the 'Referencing foreign table values' topic in the behat-sql-extension extension. We do need to escape the pipe character in this call so it doesn't result in a syntax error when using table nodes.

The createFixture call will attempt to delete the existing record before it creates another one so you always end up with a fresh copy. As easy as it sounds, foreign key constraints may not let that happen. In cases like these you can disable foreign key checks on the test database (most of the time you won't need to do this).

Installation

Sample configurating in the behat.yml file:

debug - Turns debugging on off. userUniqueRef: Appends the string onto first column of data provided to the fixture step definitions if its a string. This is so every user has its own unique data if multiple users are targeting a single database. connections: Your database connection details. dataModMapping: The autoloading namespace reference to your dataMods. (Optional) domainModMapping: The autoloading namespace reference of your domainMods. (Optional)

Please note: The extension expects you to have your dataMods located in the features/bootstrap/DataMod folder. If you have a different mapping to this, you will have to define your autoload strategy in the composer.json file or manually require the files in. You can set the mapping in php like so:

You can register the context file through php as well.

BaseProvide Class

The wrapper provides with powerful tools around the behat-sql-extension API class. Methods provided:

Note: All methods provided by the wrapper are static, because they have a global state - we don't need to instantiate this wrapper.

Example usage

Creating a DataMod to use in your context files. This is as easy as just extending the BaseProvider class from your dataMods.

Using DataMods in PHP Code

You can now use your data mods as above or directly using PHP code in step definitions. Using your UserDataMod in your context file.

Advanced DataModding

You can further extend your DataMod with other methods like so:

The getInsertDefaults() method is special, it will be called automatically if it exists. It allows you to set default values for any column. An example could be a boolean flag of some sort that you don't want to keep defining or want to override optionally. Another example could be setting foreign keys correctly or imposing requirements for certain operations. You have this method for each operator type i.e select, update, insert and delete.

Combining Data mods (Domain Mod)

Sometimes our data is fragmented between several tables, but we don't want that fragmentation to bleed into our test files. To facilitate such a scenario, we've got domain mods.

The step definitions to support this feature are:

You can inject data mod defaults through domain mods which take precedence over data mod defaults but lower than the supplied data through the step definition:

Build dynamic URLs

You can use the getKeyword call provided by the BaseProvider class to get a reference for a key defined on a dataMod. For example

Just keep on using your standard visit page step definition using the genesis/test-routing

Advanced Integrations

To use a different version of the Api, you will have to make good use of polymorphism. Extend the BaseProvider in your project and implement the abstract method getAPI(). This method needs to return an object that implements Genesis\SQLExtension\Context\Interfaces\APIInterface.

Then extend your data mods from the above class instead.

Data Retriever Class

The data retriever class makes it easy to work with test data sets and provide enough context around parameters passed around. We all know using array's are a pain. To ease the pain ever so slightly we have the following calls:

To ease the pain of working with TableNodes, here are some calls:

Data conversion built in for most common data types:

Using a Bridge

You can also set a bridge between your framework data modules and the wrapper. Your bridge must implement the Genesis\SQLExtensionWrapper\Contract\BridgeInterface to work. You can register your bridge like so:

Development

To get started with development of this project:

Deployer https://github.com/forceedge01/deployer

When in the root of the project run

Then run

The above will init and download the vagrant box as the submodule, get the box running, and perform a composer install within.

Running unit tests:

This will run the unit tests within the vagrant box.


All versions of sql-data-mods with dependencies

PHP Build Version
Package Version
Requires php Version ~5.5|~7.0
genesis/behat-sql-extension Version ~8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package genesis/sql-data-mods contains the following files

Loading the files please wait ....