Google News
logo
FuelPHP - Interview Questions
How to Creating Unit Tests in FuelPHP?
In FuelPHP, tests are located in the fuel/app/tests directory and its subdirectories. If this directory does not exist, go ahead and create it. By convention, test files are placed in the same subpath of fuel/app/tests as the tested class is of fuel/app/classes, so a test for the class at fuel/app/classes/model/login.php would be in the file fuel/app/tests/model/login.php.
 
Tests are classes that extend the TestCase class. TestCase is FuelPHP's extension of PHPUnit's PHPUnit_Framework_TestCase class, so you'll be able to use all the usual PHPUnit assertions and methods in your test. By convention, test classes are named after the class they test, prefixed with Test_, so a test for the Model_Login class would be named Test_Model_Login.
class Test_Model_Login extends TestCase
{
    public function test_foo()
    {
    }
}
Advertisement