Codeception acceptance not run with test database

Dear everyone,

I’m using codeception to make acceptance. Everything is configured and worked fine, but I really that codeception acceptance run test in my dev environment, not in test environment in Yii2. The evidence is a new record is inserted in my dev database instead of my test database. Moreover, it is not clean or rollback after test. I use yiibasic template, and this is my configuration files:




#codeceptions.yml


actor: Tester

paths:

    tests: codeception

    log: codeception/_output

    data: codeception/_data

    helpers: codeception/_support

settings:

    bootstrap: _bootstrap.php

    suite_class: \PHPUnit_Framework_TestSuite

    memory_limit: 1024M

    log: true

    colors: true

config:

    # the entry script URL (with host info) for functional and acceptance tests

    # PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL

    test_entry_url: http://mysite.local/index-test.php

modules:

    config:

        Db:

            dsn: 'mysql:host=localhost;dbname=mysite_tests'

            user: 'root'

            password: 'root'

            cleanup: true

            dump: 'codeception/_data/mysite.sql'






# acceptance.suite.yml


class_name: AcceptanceTester

modules:

    enabled:

        - Db

#       - PhpBrowser

# you can use WebDriver instead of PhpBrowser to test javascript and ajax.

# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium

# "restart" option is used by the WebDriver to start each time per test-file new session and cookies,

# it is useful if you want to login in your app in each test.

        - WebDriver

    config:

#       PhpBrowser:

# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO

#            url: http://localhost:8080

        WebDriver:

            url: 'http://mysite.local'

            browser: firefox

            window_size: maximize

            restart: true






<?php

# tests/codeception/config/config.php


return [

    'controllerMap' => [

        'fixture' => [

            'class' => 'yii\faker\FixtureController',

            'fixtureDataPath' => '@tests/codeception/fixtures',

            'templatePath' => '@tests/codeception/templates',

            'namespace' => 'tests\codeception\fixtures',

        ],

    ],

    'components' => [

        'db' => [

            'dsn' => 'mysql:host=localhost;dbname=mysite_tests',

            'username' => 'root',

            'password' => 'root',

        ],

        'request' => [

            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation

            'cookieValidationKey' => 'abc',

            'enableCsrfValidation' => true,

        ],

        'mailer' => [

            'useFileTransport' => true,

        ],

        'urlManager' => [

            'showScriptName' => false,

        ],

    ],

];



Does anyone got the same issue with this?

After change showScriptName to true in tests/codeception/config/config.php . I have fixed it. It happened because the project have enable pretty url with .htaccess.