Welcome Guest, Not a member yet? Register   Sign In
PHPUnit/CIUnit and Unit Testing Class integration
#1

[eluser]kenjis[/eluser]
Hi, there.

I integrate CIUnit and CI's Unit Testing Class.
You can execute tests of Unit Testing Class via PHPUnit.

Code: https://bitbucket.org/kenjis/my-ciunit


Execute Tests of CodeIgniter Unit Testing Class:
Limitation:
You must execute all tests in index() function of testing controllers.

Example:
Code:
function index()
{
    $this->test_no_additional_headers();
    $this->test_x_forwarded_for();
    $this->test_client_ip();
    $this->test_x_forwarded_for_and_client_ip();
                
    echo $this->unit->report();
}

See tests/controllers/CI_Unit_Test_class_Test.php.
In test_CI_Unit_Test_Class() function, set the folder where testing controllers are in.

Code:
$test_path = APPPATH . 'controllers';
$test_folder = 'tests';

It runs all *.php files in "application/controllers/tests" folder.

PHPUnit shows all test file names and failed test names.
If more than one test fails, PHPUnit reports 1 failure, even if 100 fails occurres.


Messages In This Thread
PHPUnit/CIUnit and Unit Testing Class integration - by El Forum - 08-23-2011, 10:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB