PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Nov 28, 2014 12:38 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: sharedFixture
PostPosted: Mon Nov 03, 2008 12:54 pm 
Offline
Forum Contributor

Joined: Sat May 03, 2008 8:43 am
Posts: 268
I'm having a hard time finding out how to share my db connection. The phpunit manual addresses this topic but I don't know enough about phpunit to know how to implement it. Or I'm just not getting it.

Let's take this code:

Syntax: [ Download ] [ Hide ]
 
class Lib_AllTests extends PHPUnit_Framework_TestSuite {
    protected function setUp() {
        $this->sharedFixture = *mydatabaseconnection*;
    }
    public static function main() {
        PHPUnit_TextUI_TestRunner::run(self::suite());
    }
    public static function suite() {
        $suite = new PHPUnit_Framework_TestSuite('My Library');
        $suite->addTest(Lib_Package_AllTests::main());
        return $suite;
    }
}
 


The manual says this should be enough to have the sharedFixture available in the other tests (Lib_Package_AllTests). But it doesn't work.

What am I missing here?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group