<commit_before><?php

namespace Pheasant\Tests;

use \Pheasant;
use \Pheasant\Database\Mysqli;
use \Pheasant\Database\Dsn;

class ConnectionTest extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $this->dsn = new Dsn('mysql://root@localhost/pheasanttest?charset=utf8');
        $this->conn = new Mysqli\Connection($this->dsn);
    }

    public function testConnecting()
    {
        $this->assertTrue(is_numeric($this->conn->execute("SELECT CONNECTION_ID()")->scalar()));
    }

    public function testReconnecting()
    {
        $id = $this->conn->execute("SELECT CONNECTION_ID()")->scalar();

        // force a re-connect
        $this->conn->connect();<commit_msg>Updated ConnectionTest for DSN from ENV<commit_after><?php

namespace Pheasant\Tests;

use \Pheasant;
use \Pheasant\Database\Mysqli;
use \Pheasant\Database\Dsn;

class ConnectionTest extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $dsn = getenv('PHEASANT_TEST_DSN')
            ?: 'mysql://root@localhost/pheasanttest?charset=utf8';

        $this->dsn = new Dsn($dsn);
        $this->conn = new Mysqli\Connection($this->dsn);
    }

    public function testConnecting()
    {
        $this->assertTrue(is_numeric($this->conn->execute("SELECT CONNECTION_ID()")->scalar()));
    }

    public function testReconnecting()
    {
        $id = $this->conn->execute("SELECT CONNECTION_ID()")->scalar();

        // force a re-connect
        $this->conn->connect();
{'fraction_non_alphanumeric': 0.15271265907568654, 'fraction_numerical': 0.0013395847287340924, 'mean_word_length': 3.2443181818181817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6121724', 'n_tokens_mistral': 489, 'n_tokens_neox': 474, 'n_words': 81}