Question

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

Was it helpful?

Solution 2

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.

OTHER TIPS

I have the same error and it has driven me nuts for two hours, the only info related with symfony and testing was this question but my namespaces and routes where OK... so whats the problem? It's silly easy... TRANSACTION is a SQLite keyword: https://www.sqlite.org/lang_keywords.html If I remove the cache the test where working but when it cames to retrieve the table info it crashes because of the table name.

I hope it results helpful for anybody else that could have the same problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top