Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Intro: I have a Yii webapp which I want to test using phpunit and selenium testing, but here is the catch, I do not use a DB. I communicate with an API which integrates with Yii's activeRecord (https://github.com/Haensel/ActiveResource).

Situation: So I have phpunit test working and I have a running Selenium stand alone server running as well. I do not use the FF plugin. I run it as a unit test:

<?php 
class TestTest extends WebTestCase
{
    public $fixtures=array(
        //'posts'=>'Post',
    );

    public function testShow()
    {
        $this->open('site/login');
        // verify the sample post title exists
        $this->assertTextPresent($this->posts['sample1']['title']);
        // verify comment form exists
        $this->assertTextPresent('Password');
    }
}
?>

But it keeps trying to connect to the database, which doesn't exist. My webapp works fine without the database connection so I know it doesn't need it.

Question:

So what I want to know is whether it is actually possible (I am new to Yii, but lots of MVC experience)?

How can I "set it up" to not look for a DB resource?

Has anyone done this and maybe have a few pointers or guide etc?

thanks alot!

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

"How can I "set it up" to not look for a DB resource" -> I believe that you can do that in the same file "protected/config/main.php", that you set it up to look for a DB.

share|improve this answer
    
Nope removed all db sources from all my configs and it still requests one, in the end I actually just created a db for it... even though it does nothing –  We0 Jul 10 '13 at 7:08
    
Hum. If you removed all, i believe, it will request for one. Try just use the default config of main.php. –  Eric Vieira Jul 11 '13 at 20:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.