In this video you will learn how to run your PHP Unit Tests in combination with an SQLite database. Whilst we don't get access to the in-memory version of SQLite due to a limitation with Doctrine (at the time of recording), we can make use of a file-based SQLite database, which is still much faster than using MySQL.
If you're following along and are using an Ubuntu linux server, you will need to go ahead and install the required dependencies to get SQLite to work properly, and to help with making our database dump file SQLite compatible.
apt-get install php5-sqlite sqlite3
If you're using another Linux distribution or Windows then Google will likely have the answers you're looking for.
As you'll see in the video, we will need to make a change to our existing codeception.yml file, so here are the pertinent lines to help you through:
modules: config: Db: dsn: 'sqlite:app/codecept_data.sqlite' dump: tests/_data/dump-sqlite.sql
Then you will need to run the sqlite3 tool to generate a SQLite compatible dump file.
sqlite3 /full/path/to/your/project/app/codecept_data.sqlite .dump > tests/_data/dump-sqlite.sql
Of course, feel free to change any of the file names to your liking.
All the config for Codeception's DB module can be found here.
If you have found this video helpful, please consider sharing. I really appreciate it.
|1||Installing Codeception in Your Symfony 2 Project||04:20|
|3||Codeception's Folder Structure||06:42|
|5||How to Run Codeception Tests||02:43|
|6||Our First Acceptance Test||08:00|
|7||An Alternative Perspective on Acceptance Testing||04:33|
|8||Acceptance Testing Symfony Forms||08:22|
|11||An Introduction to Unit Testing in Codeception||04:24|
|12||Unit Testing a Symfony Service||11:59|
|13||Integration with Symfony 2||06:27|
|14||Databases and Unit Tests||14:21|
|15||Real World Unit Testing - Database Clean Up Issues||06:15|
|16||Fast PHP Unit Testing with SQLite Database||10:19|
|17||Mocking the Entity Manager||20:22|
|18||Codeception Selenium Setup||06:08|
|19||How to Setup XDebug with PHPStorm||07:36|
|20||Step Objects and Page Objects||09:35|
|21||Fizz Buzz Kata||24:43|
|22||Code Coverage Reports||10:10|
|23||Running Acceptance Tests Faster With Phantom JS||01:30|
|24||Mobile Browser Tests||01:18|