Download the PHP package webfactory/doctrine-orm-test-infrastructure without Composer
On this page you can find all versions of the php package webfactory/doctrine-orm-test-infrastructure. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webfactory/doctrine-orm-test-infrastructure
More information about webfactory/doctrine-orm-test-infrastructure
Files in webfactory/doctrine-orm-test-infrastructure
Package doctrine-orm-test-infrastructure
Short Description Provides utils to create a test infrastructure for Doctrine 2 entities.
License MIT
Informations about the package doctrine-orm-test-infrastructure
doctrine-orm-test-infrastructure
This library provides some infrastructure for tests of Doctrine ORM entities, featuring:
- configuration of a SQLite in memory database, compromising well between speed and a database environment being both realistic and isolated
- a mechanism for importing fixtures into your database that circumvents Doctrine's caching. This results in a more realistic test environment when loading entities from a repository.
We use it to test Doctrine repositories and entities in Symfony applications. It's a lightweight alternative to the heavyweight functional tests suggested in the Symfony documentation (we don't suggest you should skip those - we just want to open another path).
In non-application bundles, where functional tests are not possible, it is our only way to test repositories and entities.
Installation
Install via composer (see http://getcomposer.org/):
composer require --dev webfactory/doctrine-orm-test-infrastructure
Usage
Migrating to attribute-based mapping configuration (with version 1.x)
In versions 1.x of this library, the ORMInfrastructure::createWithDependenciesFor()
and ORMInfrastructure::createOnlyFor()
methods
by default assume that the Doctrine ORM mapping is provided through annotations. Annotations-based configuration is no supported anymore in ORM 3.0.
To allow for a seamless transition towards attribute-based or other types of mapping, a mapping driver can be passed
when creating instances of the ORMInfrastructure
.
If you wish to switch to attribute-based mappings, pass a new \Doctrine\ORM\Mapping\Driver\AttributeDriver($paths)
,
where $paths
is an array of directory paths where your entity classes are stored.
For hybrid (annotations and attributes) mapping configurations, you can use \Doctrine\Persistence\Mapping\Driver\MappingDriverChain
.
Multiple mapping drivers can be registered on the driver chain by providing namespace prefixes. For every namespace prefix,
only one mapping driver can be used.
Starting in version 2.0.0, attributes-based mapping will be the default.
Testing the library itself
After installing the dependencies managed via composer, just run
vendor/bin/phpunit
from the library's root folder. This uses the shipped phpunit.xml.dist - feel free to create your own phpunit.xml if you need local changes.
Happy testing!
Known Issues
Please note that apart from any open issues in this library, you may stumble upon any Doctrine issues. Especially take care of it's known sqlite issues.
Credits, Copyright and License
This package was first written by webfactory GmbH (Bonn, Germany) and received contributions from other people since then.
webfactory is a software development agency with a focus on PHP (mostly Symfony). If you're a developer looking for new challenges, we'd like to hear from you!
Copyright 2012 – 2024 webfactory GmbH, Bonn. Code released under the MIT license.
All versions of doctrine-orm-test-infrastructure with dependencies
doctrine/common Version ^2.11|^3.0
doctrine/dbal Version ^3.2
doctrine/deprecations Version ^1.1
doctrine/event-manager Version ^1.1|^2.0
doctrine/orm Version ^2.14|^3.0
doctrine/persistence Version ^2.0|^3.0
psr/log Version ^2.0|^3.0
symfony/cache Version ^5.0|^6.0|^7.0