Unit Test class - set_test_items() not working for report(). #395

Closed
matula opened this Issue Sep 6, 2011 · 1 comment

Comments

Projects
None yet
3 participants

matula commented Sep 6, 2011

I don't know if this is intentional or not, but using the Unit Test library, if do:

$this->unit->set_test_items(array('test_name', 'result'));
echo $this->unit->run($test, $expected_result, $test_name);
echo $this->unit->report();

The first "run()" outputs only the expected test_name and result fields. The "report()" outputs everything.

If this is expected and intentional, that's fine. If not, it's a really simple fix.

if ( !in_array($key, $this->_test_items_visible))
{
    continue;
}
if (is_array($val))
{
    foreach ($val as $k => $v)
    {
// begin fix
        if ( !in_array($k, $this->_test_items_visible))
        {
            continue;
        }
//end fix
            if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v))))
        {
... 
Contributor

CodingWithKyle commented Oct 3, 2012

I just spent the last 15-30 minutes trying to figure out this exact fix, I come here to report it as a bug with a fix... Did a search to see if there was a previous bug open already... BOOM. Should really start working the other way. Would have saved me 15 minutes.

Based on the documentation, this is definitely a bug.

I'll submit a pull request with this fix in it.

@CodingWithKyle CodingWithKyle pushed a commit to CodingWithKyle/CodeIgniter that referenced this issue Oct 3, 2012

Kyle Johnson Updated result function to check for visible items as defined in issue c4a3c3c

@CodingWithKyle CodingWithKyle added a commit to CodingWithKyle/CodeIgniter that referenced this issue Oct 4, 2012

@CodingWithKyle CodingWithKyle Updated changelog with bugfix (#395)
Signed-off-by: Kyle Johnson <blyxx86@gmail.com>
ddb32da

narfbg closed this Oct 5, 2012

@nonchip nonchip pushed a commit to nonchip/CodeIgniter that referenced this issue Jun 29, 2013

Kyle Johnson Updated result function to check for visible items as defined in issue dfcd418

@nonchip nonchip pushed a commit to nonchip/CodeIgniter that referenced this issue Jun 29, 2013

@CodingWithKyle CodingWithKyle Updated changelog with bugfix (#395)
Signed-off-by: Kyle Johnson <blyxx86@gmail.com>
527b460

@satheeshdomainindia satheeshdomainindia pushed a commit to wms-code/CodeIgniter-Standard that referenced this issue Sep 29, 2013

@benedmunds benedmunds Merge pull request #395 from StevenBullen/2
Removal of whitespace
3e5f34f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment