Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

matula opened this issue Sep 6, 2011 · 1 comment

Comments

@matula
Copy link

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))))
        {
... 
@frypan-handler
Copy link
Contributor

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.

frypan-handler pushed a commit to frypan-handler/CodeIgniter that referenced this issue Oct 3, 2012
frypan-handler added a commit to frypan-handler/CodeIgniter that referenced this issue Oct 4, 2012
Signed-off-by: Kyle Johnson <blyxx86@gmail.com>
@narfbg narfbg closed this as completed Oct 5, 2012
nonchip pushed a commit to nonchip/CodeIgniter that referenced this issue Jun 29, 2013
Signed-off-by: Kyle Johnson <blyxx86@gmail.com>
satheeshin pushed a commit to wms-code/CodeIgniter-Standard that referenced this issue Sep 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants