For the sake of simplicity, let's say I have this schema.
A Machine, Site and User is associated with a Task. A Task can have many (say at least twenty) different TaskDetail's.
Task
task_id (int PK)
machine_id (int FK)
user_id (int FK)
site_id (int FK)
task_name (varchar)
task_time (int)
TaskDetail
task_detail_id (int PK)
task_id (int FK)
task_detail_value (varchar)
Machine
machine_id (int PK)
machine_name (varchar)
User
user_id (int PK)
user_name (varchar)
user_register_time (int)
Site
site_id (int PK)
site_name (varchar)
How can I best populate test data with Symfony? I am using PHPUnit as the testing framework.
I have written functional tests in Symfony before, but never to test data from the database. It's always been limited to simpler tests (does the dropdown menu have the following items in it, etc).
So for example, on my list of tasks page - I wanted to test that 5 tasks appear. How would I set up a test such that I'd populate the database with 5 tasks (that I imagine I will need to hard code somewhere?), then test that the output of that page shows those 5 tasks I created?
I've looked at http://symfony.com/doc/current/cookbook/testing/database.html and a few other pages and I've yet to find anything which outlines how to do what I am asking - and it seems like a fairly simple test case to me.
So any pointers are certainly welcome. Thanks.