matthiasnoback/doctrine-orm-test-service-provider
PHPUnit service provider for testing Doctrine ORM with a test service container. Adds a per-test SQLite connection, builds schema automatically from your entity directories, and exposes EntityManager, EventManager, and Connection for fast unit/integration tests.
EventManager and Connection, useful for testing Doctrine event listeners/subscribers or custom DBAL logic.DatabaseTransactions, DatabaseMigrations) may conflict or overlap.PHPUnit test case setup, but requires custom configuration to avoid clashes with Laravel’s default test database.DatabaseTransactions or RefreshDatabase traits are more idiomatic.Doctrine bindings (e.g., laravel-doctrine) are used.RefreshDatabase or Migrations may interfere with this package’s schema management. Requires careful test case isolation.RefreshDatabase) that could achieve similar isolation with lower overhead?phpunit.xml, test case inheritance)?matthiasnoback/phpunit-test-service-container).RefreshDatabase or DatabaseTransactions (for Eloquent).createTestingDatabase()).doctrine/dbal for simpler DBAL tests.composer require matthiasnoback/doctrine-orm-test-service-provider matthiasnoback/phpunit-test-service-container
phpunit.xml or setUpBeforeClass).TestCaseWithEntityManager:
use Noback\PHPUnitTestServiceContainer\PHPUnit\TestCaseWithEntityManager;
abstract class DoctrineTestCase extends TestCase
{
use TestCaseWithEntityManager;
abstract protected function getEntityDirectories(): array;
}
DatabaseTransactions trait for these tests).doctrine/orm version. Check for breaking changes in the package’s supported versions.RefreshDatabase, Migrations, or DatabaseTransactions. Use separate test classes or conditional setup.phpunit.xml to use the test service container globally or per suite.DoctrineTestCase.RefreshDatabase with these tests").How can I help you explore Laravel packages today?