We have about 180 unit tests implement webtestcase class and tests are running over controllers.

However when we run the unit tests, they open too many connection to db. Because of too many active tcp connection test are fail after 120th test. All the connection are active while tests are running.

In the tearDown function we call the close function of entity manager, but there is nothing, it doesn't any affect. There is some class keeping the connection object reference, i think.

Because in php manual mentioned about pdo connection closed when the object assigned to null. We also do that but no changes. P.S: Our unit tests are functional tests. Works over controller and integrated with db, there is no mock objects

Where is our mistake ? How can we fix the problem?

This my connection parameters in config_test.yml

imports:
    - { resource: config_dev.yml }

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

web_profiler:
    toolbar: false
    intercept_redirects: false

doctrine:
    dbal:
        driver: pdo_mysql
        port: 3306
        host: localhost
        dbname: mydb
        user: myuser
        password: mypass
        charset: UTF8
Edit
Report