Download the PHP package dknx01/data-fixtures-phpunit without Composer

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

Data Fixture For PHPUnit Bundle

This is a Symfony Bundle to use Symfony DoctrineFixturesBundle in PHPUnit test directly.

Requirements

Install

  1. Create a config file (see Minimal Configuration)
  2. run composer require --dev dknx01/data-fixtures-phpunit

Usage

If you want to use data fixtures in you tests you can do it in multiple ways. You can write a method to fill data in the database. or you can use a fixture and reuse it in multiple tests.

Configuration

Ensure you have the following file: localeandproviders` are optional and only needed if you want to change the default behavior.

Minimal Configuration

The minimal setup would look like: `

Fixtures registration

You should have all your Fixture classes registered as a services - at leat inside the test container.

All Fixtures that are in the namespace App\Tests\Fixtures\ and inside the folder '%kernel.project_dir%/tests/Fixtures' are automatically registered.

Example registration:

Writing a fixture

Each fixture must implement the Doctrine\Common\DataFixtures\FixtureInterface;. Example:

As you can see the fixture can have constructor arguments for individual data in different tests.

Data Fixture on method level

Data fixtures can be used on class level (see above) and on method level.

Dependent Fixtures

Fixtures can depend on other fixtures. You can use the way Doctrine data fixtures is suggesting, or you can use an attribute.

Faker

As you can see it is possible to use PHPFaker inside a fixture class.

If you implement the FakerAware interface a Faker instance is automatically injected into the data fixture.

Limitations


All versions of data-fixtures-phpunit with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
doctrine/doctrine-fixtures-bundle Version ^4.3
symfony/framework-bundle Version 7.4.*||8.*
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 dknx01/data-fixtures-phpunit contains the following files

Loading the files please wait ...