<commit_before><?php
namespace CLIFramework\Testing;
use PHPUnit_Framework_TestCase;

abstract class CommandTestCase extends PHPUnit_Framework_TestCase
{
    public $app;

    abstract public function setupApplication();

    public function getApplication()
    {
        return $this->app;
    }

    public function setUp()
    {
        $this->app = $this->setupApplication();
    }

    public function tearDown()
    {
        $this->app = NULL;
    }

    public function runCommand($args) {
        if (is_string($args)) {
            $args = preg_split('/\s+/',$args);
        }
        return $this->app->run($args);
    }
}<commit_msg>Add outputBufferingActive property to clean up output buffer automatically<commit_after><?php
namespace CLIFramework\Testing;
use PHPUnit_Framework_TestCase;

abstract class CommandTestCase extends PHPUnit_Framework_TestCase
{
    public $app;

    public $outputBufferingActive = true;

    abstract public function setupApplication();

    public function getApplication()
    {
        return $this->app;
    }

    public function setUp()
    {
        if ($this->outputBufferingActive) {
            ob_start();
        }
        $this->app = $this->setupApplication();
    }

    public function tearDown()
    {
        $this->app = NULL;
        if ($this->outputBufferingActive) {
            ob_end_clean();
        }
    }

    public function runCommand($args) {
        if (is_string($args)) {
            $args = preg_split('/\s+/',$args);
        }
        return $this->app->run($args);
    }
}
{'fraction_non_alphanumeric': 0.11760925449871465, 'fraction_numerical': 0.0, 'mean_word_length': 2.46, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '4882655', 'n_tokens_mistral': 442, 'n_tokens_neox': 431, 'n_words': 97}