Download the PHP package bancer/paratest-databases-factory without Composer

On this page you can find all versions of the php package bancer/paratest-databases-factory. 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 paratest-databases-factory

paratest-databases-factory

This library provides a convinient way to automate the creation of test databases and is supposed to be used when running PHP unit tests in parallel. It is compatible with paratest library - https://github.com/paratestphp/paratest.

How to install

Execute composer require bancer/paratest-databases-factory or composer require bancer/paratest-databases-factory --update-no-dev to install by composer.

How to use

Create test databases in bootstrap.php:

This will create pf_test1, pf_test2 etc. test databases when unit tests are started. The database name and credentials are just an example here. The requirement is that the user has permissions to connect to the database and has been granted the privilege to create databases.

Load the bootstrap file in phpunit.xml file if not already done, f.ex.: <phpunit ... bootstrap="./bootstrap.php"/>.

Create the database user and grant privileges to create databases:

Add the database credentials to phpunit.xml:

Adjust your database configuration by appending TEST_TOKEN environment variable value. Something like this:

There are two ways how to run phpunit tests in parallel:

  1. By using plain phpunit.

    • Pros:
      • No dependencies to third party libraries.
      • Can be implemented with any version of PHP and PHPUnit.
    • Cons:
      • Complex setup.
    • Howto:
      • Split your unit tests into two or more testsuites that take approximately the same time to run. The example below is for two test suites that are named ci-1 and ci-2.
      • Ensure that shell's job control is enabled or execute set -m in the console.
      • Execute TEST_TOKEN=1 Vendor/bin/phpunit --testsuite ci-1 &> /tmp/ci-1.out & TEST_TOKEN=2 Vendor/bin/phpunit --testsuite ci-2 & fg or similar command. This sets TEST_TOKEN environment variable, starts the first test suite in the background process and writes its output to a file in tmp folder, starts the second test suite and brings it output to the foreground. This way two test suites are run in parallel. Run the slowest test suite the last.
      • Execute cat /tmp/ci-1.out to print the results of the first test suite to the console.
      • Execute grep "OK" /tmp/ci-1.out or similar command to check that the first test suite successfully finished.
  2. By using paratest library.
    • Pros:
      • Simple setup.
    • Cons:
      • Dependency to third party library.
      • Paratest is actively supported only for the latest PHP version therefore not all projects can use it.
    • Howto:

All versions of paratest-databases-factory with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
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 bancer/paratest-databases-factory contains the following files

Loading the files please wait ....