What is DB module:
The DB module is used to cleaning database before each test. So this module was added into codeception.yml. To have your database properly cleaned you should configure it to access the database. Also provides actions to perform checks in database.
The cofig can be done in below formats:
modules:
enabled: [Db]
config:
Db:
dsn: 'mysql:host=localhost;dbname=test1'
user: 'root'
password: ''
dump: 'tests/_data/dump.sql'
populate: true
cleanup: false
So config for db module is done.
Now comes to the real work scenarios.
You must have experienced that Db module is quite slow when loading large database dumps and it is also not a good idea when dealing with complex SQLs.
So i think it's an good idea to leave tests/_data/dump.sql to be empty file and leave cleanup option of Db module enabled, so database will be cleaned up before each test, yet dump not to be loaded. We will use realdump.sql file to populate database.
To load dump before each test you can use AcceptanceHelper or any other Helper class you have. Probably you will need to create your own helper with codecept g:helper DbHelper command.
In its before method you can load db dump (using mysql in this example)
<?php
public function _before(\Codeception\TestCase $test)
{
exec("mysql -u user -ppassword test1 < tests/_data/real_dump.sql");
}
"I very much enjoyed this article.Nice article thanks for given this information. i hope it useful to many pepole.php jobs in hyderabad.
ReplyDelete"
MySQL is the most popular Open Source Relational SQL Database Management System..I really very useful blog!!
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training
And indeed, Iam just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I have had.
ReplyDeletehadoop training in chennai
hadoop training in annanagar
salesforce training in chennai
salesforce training in annanagar
c and c plus plus course in chennai
c and c plus plus course in annanagar
machine learning training in chennai
machine learning training in annanagar
Very nice posts. this could not be explained better. Thanks for sharing, Keep up the good work.
ReplyDeletejava training in chennai
java training in tambaram
aws training in chennai
aws training in tambaram
python training in chennai
python training in tambaram
selenium training in chennai
selenium training in tambaram
thank you for the useful information..
ReplyDeletesap training in chennai
sap training in omr
azure training in chennai
azure training in omr
cyber security course in chennai
cyber security course in omr
ethical hacking course in chennai
ethical hacking course in omr