title: Setting up functional tests with custom database data in Symfony
body: <p>For the sake of simplicity, let's say I have this schema.</p>
  
  <p>A <code>Machine</code>, <code>Site</code> and <code>User</code> is associated with a <code>Task</code>. A <code>Task</code> can have many (say at least twenty) different <code>TaskDetail</code>'s.</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>How can I best populate test data with Symfony? I am using PHPUnit as the testing framework.</p>
  
  <p>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).</p>
  
  <p>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?</p>
  
  <p>I've looked at <a href="http://symfony.com/doc/current/cookbook/testing/database.html" rel="nofollow">http://symfony.com/doc/current/cookbook/testing/database.html</a> 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.</p>
  
  <p>So any pointers are certainly welcome. Thanks.</p>