Skip to content

enlitepro/enlite-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Modify TestConfig.php.dist and change glob path options to:

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

Create file glob.php near id test directory with options like this

<?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

<?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()));
    }

}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages