Welcome Guest, Not a member yet? Register   Sign In
How to use set_test_items in unit test
#1

[eluser]Unknown[/eluser]
Hi,
I try to use this function for display some item but not work .it's still show full display.
How i missing.
Code:
class Welcome extends CI_Controller {

    public function index()
    {
    $this->load->library('unit_test');
    
    $test = 1 + 1;
    $expected_result = 2;
    $test_name = 'Adds one plus one';
    $this->unit->set_test_items(array('test_name', 'result'));
    $this->unit->run($test, $expected_result, $test_name,'ssdsads');
    
    $test = 'message';
    $expected_result = 10;
    $test_name = 'Adds multiple one';
    $this->unit->run($test, 'is_string', $test_name);
    
    echo $this->unit->report();
    echo "<pre>";
    print_r($this->unit->result());

}
}
#2

[eluser]ben.IT[/eluser]
I am encountering exactly the same problem ...

It doesnt work with report () method but only with run () method

http://stackoverflow.com/questions/39260...ort-output

so you have to echo :
echo $this->unit->run($test, $expected_result, $test_name);
greetings,
ben




Theme © iAndrew 2016 - Forum software by © MyBB