Download the PHP package teamneusta/pimcore-testing-framework without Composer

On this page you can find all versions of the php package teamneusta/pimcore-testing-framework. 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 pimcore-testing-framework

Pimcore Testing Framework

Provides tools for Pimcore unit/integration testing with PHPUnit.

Installation

  1. Require the bundle

Usage

Bootstrapping Pimcore

We provide a convenience method to bootstrap Pimcore for running tests. Just call BootstrapPimcore::bootstrap() in your tests/bootstrap.php as seen below, and you're done.

You can also pass any environment variable via named arguments to this method:

Integration Tests For a Bundle

If you want to add integration tests for a Bundle, you need to set up an application with a kernel. Pimcore also expects some configuration (e.g., for the security) to be present.

You can use the \Neusta\Pimcore\TestingFramework\Kernel\TestKernel as a base, which already provides all necessary configurations with default values (see: dist/config and dist/pimcore10/config or dist/pimcore11/config, depending on your Pimcore version).

For a basic setup, you can use the TestKernel directly:

[!IMPORTANT]
Don't forget to create the tests/app directory!

[!NOTE] Since the kernels of Pimcore 10 and 11 are not compatible (the signature of the method configureContainer() differs), we have extended our TestKernel with the ability to load separate configuration files depending on the version. Configuration that is compatible with both Pimcore versions belongs to the config/ folder of the test app as before. Version specific configuration can be placed inside the config/pimcore10/ or config/pimcore11/ folder and will be loaded last.

Switch Common Behavior on/off in Test Cases

We provide traits to switch common behavior on/off in whole test case classes.

Admin Mode

The admin mode is disabled by default when calling BootstrapPimcore::bootstrap().

To enable it again, you can use the WithAdminMode trait.

Cache

Inherited Values of DataObjects

Integration Tests With a Configurable Kernel

The TestKernel can be configured dynamically for each test. This is useful if different configurations or dependent bundles are to be tested. To do this, your test class must inherit from KernelTestCase:

Attributes

An alternative to passing a config closure in the options array to KernelTestCase::bootKernel() is to use attributes for the kernel configuration.

[!TIP] All attributes can be used on class and test method level.

Data Provider

You can also use the RegisterBundle, ConfigureContainer, ConfigureExtension, or RegisterCompilerPass classes to configure the kernel in a data provider.

[!TIP] The kernel configuration objects are not passed as arguments to the test method, which means you can use them anywhere between your provided real test data.

Custom Attributes

You can create your own kernel configuration attributes by implementing the KernelConfiguration interface:

Then you can use the new class as an attribute or inside a data provider.

Integration Tests With a Database

If you write integration tests that use the database, we've got you covered too.

We provide the ResetDatabase trait, which does the heavy lifting: Just use it in one of your test case classes, and it'll install a fresh Pimcore into the configured database before the first test is run. It'll also reset the database between each test, so you don't have to worry about leftovers from previous tests.

Using a Dump

If you already have a database dump that you want to use instead of a fresh Pimcore installation, there's the DATABASE_DUMP_LOCATION environment variable. Point it to the location of your dump, and it'll be used instead.

Faster Database Reset

By default, resetting the database between the tests works by dropping the database, recreating it and reinstalling Pimcore (or reimporting the dump).

This is rather slow, but there are some tricks that can speed it up:

Storing the Database in the RAM

Normally, the database is stored on the disk, so that the data is persisted. But we don't really need this for testing, so if you're using Docker, you can configure it to store it in RAM instead:

Wrapping Each Test in a Transaction

We support the dama/doctrine-test-bundle, which isolates database tests by wrapping them into a transaction. You just have to install the bundle according to its readme, and it'll automatically be used.

Contribution

Feel free to open issues for any bug, feature request, or other ideas.

Please remember to create an issue before creating large pull requests.

Local Development

To develop on local machine, the vendor dependencies are required.

We use composer scripts for our main quality tools. They can be executed via the bin/composer file as well.


All versions of pimcore-testing-framework with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0
doctrine/persistence Version ^2.2 || ^3.0
phpunit/phpunit Version ^9.6.0
pimcore/pimcore Version ^10.5 || ~11.0.0 || ~11.1.0 || ~11.2.2 || ~11.3.0 || ~11.4.0
psr/log Version ^1.1.3 || ^2.0 || ^3.0
symfony/config Version ^5.4 || ^6.4
symfony/console Version ^5.4 || ^6.4
symfony/dependency-injection Version ^5.4 || ^6.4
symfony/event-dispatcher Version ^5.4 || ^6.4
symfony/filesystem Version ^5.4 || ^6.4
symfony/framework-bundle Version ^5.4 || ^6.4
symfony/http-kernel Version ^5.4 || ^6.4
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 teamneusta/pimcore-testing-framework contains the following files

Loading the files please wait ....