Question

I'm attemption a UnitTest like this in FuelPHP:

/**
 * Products class tests
 * 
 * @group App
 * @group Products
 */

class Test_Model_Products extends Fuel\Core\TestCase
{
    public function test_foo() {
        $m = new Model_Productpropertytype;
        $m->name = 'Text';
        $m->save();
    }
}

..but there seems to be namespace issues. How can I get the TestCase to not fail on the loaded ORM?

1) Test_Model_Products::test_foo
Fuel\Core\Database_Exception: SQLSTATE[HY000] [2002] No such file or directory
Was it helpful?

Solution

This does not look like an auto loading problem, the error, to me, says that there is a problem with you SQL connection. Fuel uses a separate DB config for the development, testing and production environments.

If you set up a db.php config file in fuel/app/config/testing/db.php it will be used to make any DB connections when running unit tests via oil

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top