couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Coallier <david.coall...@gmail.com>
Subject Re: Couchdb and PHPUnit
Date Mon, 19 Apr 2010 07:15:01 GMT
On 19 April 2010 07:16, Patrick Barnes <mrtrick@gmail.com> wrote:
> Has anyone on the list (or elsewhere) written code for phpunit to make
> setting up /tearing down couchdb test databases for unit testing easier?
>

I have setup couchdb to be used in unit tests and from the look of
your question all you'd have to do is setup the base class that would
have a setUp and that would create an instance to the CouchDB
databases you have.

abstract class TestBaseCouch extends PHPUnit_Framework_TestCase
{
    protected $couch;

    public function setUp()
    {
        $this->couch = new Couch();
    }

    public function tearDown()
    {
        unset($this->config);
    }
}

class TestyouWantTestCase extends TestBaseCouch
{
    /**
     * @expectedException Couch_Exception
     */
    public function testExceptionFromCouchClient()
    {
        $this->couch->doSomething();
    }
}


Is that what you mean?

-- 
David Coallier

Mime
View raw message