samedi 23 juillet 2016

How to test a code which uses ini_get with different ini values dynamically with PHPUnit?

I have a code that uses ini_get and does some additional logic based on its value.

I want to test the code using PHPUnit with multiple set of values for those ini-configuration. Is that possible? How?

A mimic of the code is as below:

function check_upload_limit()
{
    $value = ini_get('post_max_size');

    if (num_bytes($value) < 10 * 1000 * 1000)
    {
        return 'Too small';
    }
    else
    {
        return 'Sufficient';
    }
}

I want to test it with several values for post_max_size.

Aucun commentaire:

Enregistrer un commentaire