2017 © Pedro Peláez
 

library doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

image

matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  • Tuesday, October 3, 2017
  • by matthiasnoback
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11,766 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 11 % Grown

The README.md

Doctrine DBAL service provider for unit tests

Build Status, (*1)

This library contains a service provider to be used with a service container for PHPUnit tests., (*2)

Usage

Use the trait Noback\PHPUnitTestServiceContainer\PHPUnit\TestCaseWithDoctrineDbalConnection in your test class. You then need to implement the createSchema() and return an instance of Doctrine\DBAL\Schema\Schema., (*3)

For each test method a database connection (of instance Doctrine\DBAL\Connection) will be available. Also the schema returned by createSchema() will be created in the database. The database itself is (by default) an SQLite in-memory database, which will leave no traces on the filesystem., (*4)

<?php

use Noback\PHPUnitTestServiceContainer\PHPUnit\TestCaseWithDoctrineDbalConnection;
use Doctrine\DBAL\Schema\Schema;

final class StorageTest
{
    use TestCaseWithDoctrineDbalConnection;

    /**
     * @test
     */
    public function something()
    {
        $connection = $this->getConnection();

        $connection->insert('some_table', array('some_column' => 'value'));

        ...
    }

    protected function createSchema()
    {
        $schema = new Schema();

        $table = $schema->createTable('some_table');

        $table->addColumn('some_column', 'string');

        return $schema;
    }
}

Read more

The Versions

03/10 2017

dev-master

9999999-dev http://github.com/matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  Sources   Download

MIT

The Requires

 

The Development Requires

phpunit service provider doctrine dbal

03/10 2017

v3.0.0

3.0.0.0 http://github.com/matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  Sources   Download

MIT

The Requires

 

phpunit service provider doctrine dbal

03/10 2017

dev-upgrade

dev-upgrade http://github.com/matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  Sources   Download

MIT

The Requires

 

phpunit service provider doctrine dbal

20/01 2015

v2.0.0

2.0.0.0 http://github.com/matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  Sources   Download

MIT

The Requires

 

The Development Requires

phpunit service provider doctrine dbal

16/12 2013

1.0.x-dev

1.0.9999999.9999999-dev http://github.com/matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  Sources   Download

MIT

The Requires

 

The Development Requires

phpunit service provider doctrine dbal

16/12 2013

v1.0.0

1.0.0.0 http://github.com/matthiasnoback/doctrine-dbal-test-service-provider

Service provider for tests in need of a Doctrine DBAL connection

  Sources   Download

MIT

The Requires

 

The Development Requires

phpunit service provider doctrine dbal