<commit_before><?php
namespace Criterion;
class Application
{
    public static $app;

    public $config = false;
    public $config_file = false;
    public $mongo = false;
    public $db = false;

    public function __construct()
    {
        $this->config_file = dirname(dirname(__DIR__)) . '/config.json';

        if (file_exists($this->config_file))
        {
            $this->config = json_decode(file_get_contents($this->config_file), true);
        }

        $db = getenv('APP_ENV') ? 'criterion_testing' : 'criterion';
        $this->mongo = new \MongoMinify\Client();
        $this->db = $this->mongo->{$db};
        return $this;
    }
}<commit_msg>Make sure the APP_ENV is "testing" when switching db for tests<commit_after><?php
namespace Criterion;
class Application
{
    public static $app;

    public $config = false;
    public $config_file = false;
    public $mongo = false;
    public $db = false;

    public function __construct()
    {
        $this->config_file = dirname(dirname(__DIR__)) . '/config.json';

        if (file_exists($this->config_file))
        {
            $this->config = json_decode(file_get_contents($this->config_file), true);
        }

        $db = getenv('APP_ENV') === 'testing' ? 'criterion_testing' : 'criterion';
        $this->mongo = new \MongoMinify\Client();
        $this->db = $this->mongo->{$db};
        return $this;
    }
}
{'fraction_non_alphanumeric': 0.1467430207587688, 'fraction_numerical': 0.0, 'mean_word_length': 2.6692913385826773, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '2241430', 'n_tokens_mistral': 442, 'n_tokens_neox': 433, 'n_words': 95}