Im using behat for testing in my symfony2 aplication. Right now I need to have two databases. First (which is working right now), for normal use, like user doing something on site. Second database (which exists and behat work on it), for tests purpose.
What I got now is two working databases, and behat. Behat use second database, but problem is that while tests flow, site doesnt use it.
My config.yml:
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
My config_test.yml:
doctrine:
dbal:
dbname: "%database_name%_test"
My 'behat.yml':
default:
suites:
default:
paths:
features: '%paths.base%/features'
bootstrap: '%paths.base%/features/bootstrap'
contexts:
- FeatureContext: ~
- EwidencjaContext:
userManager: '@fos_user.user_manager'
em: '@doctrine.orm.entity_manager'
packageManager: '@em.package_manager'
extensions:
Behat\Symfony2Extension: ~
Behat\MinkExtension:
base_url: http://my_nginx/app_test.php
goutte: ~
selenium2:
browser: "chrome"
wd_host: http://selenium_chrome:4444/wd/hub
capabilities: { "browserName": "chrome", "browser": "chrome"}
Bex\Behat\ScreenshotExtension:
image_drivers:
local:
screenshot_directory: tests/features/images/
clear_screenshot_directory: true
What can I do to change database for time tests are in progress?
app_test.phpfile at all, I created one, copied everything fromapp_dev.php, and changed just one line for$kernel = new AppKernel('test', true);. It still doesnt work, and when i go on localhost/app_test.php it just download the file, not like when I go on localhost/app_dev.php, when i got on site in dev invironment.