Download the PHP package rdx/behat-variables without Composer

On this page you can find all versions of the php package rdx/behat-variables. 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 behat-variables

Behat Variables

Build Status Scrutinizer Code Quality

Stores your custom variables across Scenarios during Feature testing.

The idea

You're making users and profiles to test, and you want to use those creations further in the same Feature. You can't, because: 1) Behat arguments are literals, and 2) FeatureContext lives only for every Scenario, not for the entire Feature.

With behat-variables, you can save & use those variables: user ids, passwords, activation tokens, etc.

Given a new user "Fred"           # Your custom step, with a return value
And I save it into "UID"          # A provided step that saves that return value
When I go to "/users/<<UID>>"     # Custom step, with dynamic argument
Then I should see "Hello, Fred!"  # Custom step, with predictable content

The <<UID>> part is the magic. Works for any argument, not just URIs.

Set up

In order to use variables in your Behat feature, you must do 2 things:

See the Behat docs for where they fit in behat.yml, or see this repo's behat.yml:

default:
  suites:
    default:
      contexts:
        - rdx\behatvars\BehatVariablesContext
        - FeatureContext
  extensions:
      rdx\behatvars\BehatVariablesExtension: ~

And make sure your custom steps have a scalar return value, or an array of scalars:

/**
 * @Given a value :value
 */
public function aValue($value) {
  return $value;
}

/**
 * @Given values :value1 and :value2
 */
public function valuesAnd($value1, $value2) {
  return [$value1, $value2];
}

Examples

See features/simple.feature for very simple examples (with only 3 custom steps). It's the test used to test this package.

Features

This package provides 1 step, in several formats:

(I|we) save (it|that|those|them) into "VARIABLE_NAME"

So you can make several custom step combinations:

Given "4" cars in the same shop                   # Custom
And we save those into "CAR1,CAR2,CAR3,CAR4"      # Provided

Given a user "Fred" in organization "McDonald's"  # Custom
And we save those into "USER,ORGANIZATION"        # Provided

All versions of behat-variables with dependencies

PHP Build Version
Package Version
Requires behat/behat Version ^3.0
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 rdx/behat-variables contains the following files

Loading the files please wait ....