2017 © Pedro Peláez
 

library enlite-test

Helpers for testing

image

enlitepro/enlite-test

Helpers for testing

  • Tuesday, September 3, 2013
  • by ftdebugger
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Installation

Modify TestConfig.php.dist and change glob path options to:, (*1)

'config_glob_paths' => array(
    'config/autoload/{,*.}{global,local}.php',
    __DIR__ . "/global.php"
)

Create file glob.php near id test directory with options like this, (*2)

<?php

return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
                'params' => array(
                    'memory' => true
                ),
            )
        ),
    ),
);

Now in your test you can use real database, (*3)

<?php

class SomeTest extends \PHPUnit_Framework_TestCase
{
    use \EnliteTest\DatabaseFixtureTrait;

    public function testSave()
    {
        $entity = new Some();
        $entity->setTitle('hello');

        $em = $this->getEntityManager();
        $em->persist($entity);
        $em->flush();

        $this->assertSame($entity, $em->getRepository('Some')->find($entity->getId()));
    }

}

The Versions

03/09 2013

dev-master

9999999-dev

Helpers for testing

  Sources   Download

MIT

The Requires

 

by Evgeny Shpilevsky