geoB
geoB

Reputation: 4714

Sqlite file db for codeception testing fails

Attempts to use a sqlite file database in the app/cache/tests directory fail. This is determined by clearing the dev MySQl database and populating the test environment database via the console. Test database being populated was confirmed by an external Sqlite Manager. [Tests performed without the sqlite configuration pass.]

codeception.yml:

actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
settings:
    bootstrap: _bootstrap.php
    colors: false
    memory_limit: 1024M
extensions:
    enabled:
        - Codeception\Extension\RunFailed
modules:
    config:
        - Db:
            dsn: 'sqlite:./app/cache/test/test.sqlite'
            user: ''
            password: ''
            dump: tests/_data/test.sql
            populate: true
            cleanup: false
            reconnect: true

Edit:

In an Ubuntu VM, adding the Symfony2 configuration to acceptance.yml allows for partial success - the test uses the Sqlite db but does not rewrite from the specified dump (test.sql). In Windows adding the Symfony configuration makes no difference.

acceptance.yml:

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: http://vol
        - \Helper\Acceptance
# adding these lines enables Ubuntu to use sqlite db
        - Symfony2:
            app_path: ./app
            environment: test

Upvotes: 3

Views: 980

Answers (1)

Naktibalda
Naktibalda

Reputation: 14120

You haven't enabled Db module in acceptance.yml

modules: enabled: - Db - PhpBrowser: url: http://vol - \Helper\Acceptance

Also don't add PhpBrowser and Symfony2 at the same time, only one can be used.

Upvotes: 1

Related Questions