unit-testingsymfonyliipfunctionaltestbundle

Symfony2 with LiipFunctionalTestBundle error when i load fixture


i've installed LiipFunctionalTestBundle and try to use it since yesterday but i've got an error and i don't know how to solve it.

I use the basic configuration as describe in the documentation(config_test) :

framework:
test: ~
session:
    storage_id: session.storage.filesystem

liip_functional_test: ~

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver: pdo_sqlite
                path: %kernel.cache_dir%/test.sql

I create a simple test file in my bundle, just to know if my db is loaded:

class AdControllerTest extends WebTestCase
{
    public function testIndex()
    {
        $client = static::createClient();

        $this->loadFixtures(array());

        $this->assertTrue(true);
    }
}

When i use $this->loadFixtures(array()); it's works fine, so i can start off with an empty database (initialized with my schema) But When i replace it and try to use a fixture i have an error like this :

$this->loadFixtures(array('\Blabla\MyBunble\DataFixtures\ORM\LoadUserData'));

Now i have this error :

Doctrine\DBAL\DBALException: An exception occurred while executing 'PRAGMA table_info(transaction)':

SQLSTATE[HY000]: General error: 1 near "transaction": syntax error

I'm pretty new in testing, if someone use this bundle and as a tips, i'll be grateful :)

Thanks


Solution

  • Ok it was a stupid mistake.

    When i cleaned the cache i saw the real error : loadFixtures was unable to find my fixture because of a wrong namespace.