Download the PHP package samuelgfeller/test-traits without Composer

On this page you can find all versions of the php package samuelgfeller/test-traits. 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 test-traits

Test traits

This is a clone of selective/test-traits containing additional test traits, including a fixture trait to easily insert fixtures with test-case-relevant custom data and an SQL schema generator to set up the test database for integration test.

Latest Version on Packagist Build Status Total Downloads

Requirements

Installation

Documentation

Test environment setup: Test Setup
Write tests using these traits: Writing Tests

Migration from selective/test-traits

If you have been using the selective/test-traits package and want to migrate to this library, the following functions have to be renamed:

Otherwise, the traits are the same and can be used in the same way. This package will be kept in sync with selective/test-traits.

FixtureTestTrait

A trait designed to create and insert fixtures with data that can be defined in the test function.

Provided method

Usage

Fixture

Each fixture must have a property $table with the table name and an array $records with the default data to insert.

Insert fixture with custom attributes

To define custom data that should override the default values of the fixture class, the insertFixture() function can be used.
The first parameter is the fixture fully qualified class name e.g. UserFixture::class and the second (optional) is an array of attributes.

An array of attributes contains the data for one database row e.g.:
['field_name' => 'value', 'other_field_name' => 'other_value'].

Multiple attribute arrays can be passed to the function to insert multiple rows with different data as shown below.

Not all fields of the table need to be specified in the attribute array. For unspecified fields, the values of the first $records entry from the fixture will be used.

The function returns an array with the inserted data from the fixture including the auto-incremented id or an array for each row that was inserted when multiple rows were passed.

The FixtureTestTrait uses the DatabaseTestTrait for the interaction with the database.

HttpTestTrait

Requirements

Provided methods

Usage

Creating a request with query string parameters:

RouteTestTrait

A Slim 4 framework router test trait.

Requirements

Provided method

Usage

Creating a request with a named route and query string parameters:

MailerTestTrait

Requirements: composer require symfony/mailer

DI container setup example:

Usage

PHPUnit test case:

License

This project is licensed under the MIT Licence — see the LICENCE file for details.


All versions of test-traits with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-pdo Version *
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 samuelgfeller/test-traits contains the following files

Loading the files please wait ....