Download the PHP package tarantool/phpunit-extras without Composer

On this page you can find all versions of the php package tarantool/phpunit-extras. 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 phpunit-extras

PHPUnit Extras

Quality Assurance Telegram

A collection of helpers for PHPUnit to ease testing Tarantool libraries. It is based on rybakit/phpunit-extras, please refer to this package for more documentation.

Table of contents

Installation

Annotations

Besides the annotations provided by the package rybakit/phpunit-extras, the library is shipped with annotations specific to Tarantool. The easiest way to enable them is by inheriting your test classes from Tarantool\PhpUnit\TestCase:

Another option is to register an extension called AnnotationExtension:

By default, the extension assumes that the Tarantool server you are going to connect to is available on 127.0.0.1:3301. You can customize the default settings by specifying either a DSN string or an array of options as extension configuration values:

or

On top of that, the configuration values can resolve environment variables, which might be useful if you need to share the same settings with a Tarantool instance file or any other script:

Once the annotations are configured, you can start using them:

Processors

Lua

Allows executing Lua code before running a test.

Example:

Sql

Allows executing SQL statements before running a test (requires Tarantool 2.0+).

Example:

Requirements

Requirements allow skipping tests based on preconditions.

LuaCondition

Format:

where <condition> is an arbitrary lua expression that should be evaluated to a Boolean value.

Example:

TarantoolVersion

Format:

where <version-constraint> is a composer-like version constraint. For details on supported formats, please see the Composer documentation.

Example:

If you're interested in how to create and register your own annotations and requirements, please refer to the rybakit/phpunit-extras README.

Expectations

Requests

To test that your code sends (or does not send) certain requests, the following methods are available:

where <REQUEST_NAME> is the name of the request, for example Call, Insert, etc. These methods are part of the Tarantool\PhpUnit\TestCase class, but they can also be enabled through a trait:

Example:

Prepared statements

In order to assert prepared statement allocations, use the Tarantool\PhpUnit\Expectation\PreparedStatementExpectations trait, which contains the following methods:

where <TYPE> is either Allocated or Deallocated.

Example:

To enable all the above expectation methods in one go, use the Tarantool\PhpUnit\Expectation\Expectations trait, or extend the Tarantool\PhpUnit\TestCase class.

Mocking

The library provides several helper classes to create test doubles for the Tarantool Сlient to avoid sending real requests to the Tarantool server. For the convenience of creating such objects, add the trait TestDoubleClient to your test class:

If your test cases extend the Tarantool\PhpUnit\TestCase class, this step is not needed because the trait is already included in that class.

A dummy client object can be created as follows:

To simulate specific scenarios, such as establishing a connection to a server or returning specific responses in a specific order from the server, use the facilities of the TestDoubleClientBuilder class. For example, to simulate the PING request:

Another example, sending two EVALUATE requests and returning a different response for each:

The above example can be simplified to:

Besides, the builder allows setting custom Connection and Packer instances:

Testing

Before running tests, the development dependencies must be installed:

Then, to run all the tests:

License

The library is released under the MIT License. See the bundled LICENSE file for details.


All versions of phpunit-extras with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5|^8
composer/package-versions-deprecated Version 1.11.99.5
composer/semver Version ^3.3
rybakit/phpunit-extras Version ^0.2.4
symfony/expression-language Version ^3.3|^4|^5|^6
tarantool/client Version ^0.10
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 tarantool/phpunit-extras contains the following files

Loading the files please wait ....