Separate seeds in PHPUnit

Posted by mik on Stack Overflow See other posts from Stack Overflow or by mik
Published on 2010-04-30T06:17:19Z Indexed on 2010/04/30 6:27 UTC
Read the original article Hit count: 301

Filed under:
|
|
|

How do I create a separate seed for some test inside one test class? PHPUnit documentation includes this example

<?php
require_once 'PHPUnit/Extensions/Database/TestCase.php';

class DatabaseTest extends PHPUnit_Extensions_Database_TestCase
{
    protected function getConnection()
    {
        $pdo = new PDO('mysql:host=localhost;dbname=testdb', 'root', '');
        return $this->createDefaultDBConnection($pdo, 'testdb');
    }

    protected function getDataSet()
    {
        return $this->createFlatXMLDataSet(dirname(__FILE__).'/_files/bank-account-seed.xml');
    }
}
?>

But in this example I have one seed for all the tests inside my class. Thank you for help.

© Stack Overflow or respective owner

Related posts about php

Related posts about phpunit