<commit_before><?php

class TestCase extends PHPUnit_Framework_TestCase
{

    /**
     * Setup.
     * @return  false
     */
    public function setUp()
    {
        require __DIR__.'/../bootstrap/bootstrap.php';

        return false;
    }

    /**
     * Actually runs a protected method of the given object.
     * @param       $obj
     * @param       $method
     * @param array $args
     * @return mixed
     */
    protected function callProtected($obj, $method, $args = array())
    {
        $methodObj = new ReflectionMethod(get_class($obj), $method);
        $methodObj->setAccessible(true);

        if (is_object($args)) {
            $args = [$args];
        } else {
            $args = (array) $args;
        }

        return $methodObj->invokeArgs($obj, $args);
    }
}
<commit_msg>Added the capability to set protected attributes of objects for testing purposes<commit_after><?php

class TestCase extends PHPUnit_Framework_TestCase
{

    /**
     * Setup.
     * @return  false
     */
    public function setUp()
    {
        require __DIR__.'/../bootstrap/bootstrap.php';

        return false;
    }

    /**
     * Actually runs a protected method of the given object.
     * @param       $obj
     * @param       $method
     * @param array $args
     * @return mixed
     */
    protected function callProtected($obj, $method, $args = array())
    {
        $methodObj = new ReflectionMethod(get_class($obj), $method);
        $methodObj->setAccessible(true);

        if (is_object($args)) {
            $args = [$args];
        } else {
            $args = (array) $args;
        }

        return $methodObj->invokeArgs($obj, $args);
    }

    /**
     * Call a protected property of an object
     *
     * @param  mixed $obj
     * @param  string $attribute Property name
     * @param  mixed  $value Value to be set
     */
    protected function setProtected($obj, $property, $value)
    {
        $class = new ReflectionClass($obj);
        $property = $class->getProperty($property);
        $property->setAccessible(true);

        if (is_string($obj)) { // static
            $property->setValue($value);
            return;
        }

        $property->setValue($obj, $value);
    }
}

{'fraction_non_alphanumeric': 0.12819363514119228, 'fraction_numerical': 0.0, 'mean_word_length': 1.9484808454425364, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2804123', 'n_tokens_mistral': 648, 'n_tokens_neox': 637, 'n_words': 161}