enlitepro / enlite-test
Helpers for testing
dev-master
2013-09-03 13:01 UTC
Requires
- doctrine/orm: *
- mockery/mockery: dev-master@dev
- phpunit/phpunit: 3.7.*
- zendframework/zend-servicemanager: 2.2.*
This package is not auto-updated.
Last update: 2024-11-18 16:00:01 UTC
README
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())); } }