<commit_before><?php

namespace Concrete\Tests\Database;

use Concrete\Core\Database\Connection\Connection;
use Concrete\TestHelpers\Database\ConcreteDatabaseTestCase;
use Database;
use PDOException;

class DatabaseTest extends ConcreteDatabaseTestCase
{
    protected $fixtures = [
        'Users',
    ];

    public function setUp(): void
    {
        $conn = $this->getConnection();

        $conn->exec('DROP TABLE IF EXISTS Users');
        $conn->exec(
            'CREATE TABLE Users (uID INT UNSIGNED NOT NULL AUTO_INCREMENT, uName VARCHAR(128) NULL, uFirstName VARCHAR(128) NULL, uEmail VARCHAR(128) NULL, PRIMARY KEY (uID));');
        parent::setUp();
    }

    public function testInvalidConnection()
    {
        $this->expectException(\Doctrine\DBAL\Driver\PDOException::class);
        $this->expectExceptionMessageMatches('/(getaddrinfo (?:for .+)? failed)/');
        $connection = Database::getFactory()->createConnection(<commit_msg>fix test on older versions<commit_after><?php

namespace Concrete\Tests\Database;

use Concrete\Core\Database\Connection\Connection;
use Concrete\TestHelpers\Database\ConcreteDatabaseTestCase;
use Database;
use PDOException;

class DatabaseTest extends ConcreteDatabaseTestCase
{
    protected $fixtures = [
        'Users',
    ];

    public function setUp(): void
    {
        $conn = $this->getConnection();

        $conn->exec('DROP TABLE IF EXISTS Users');
        $conn->exec(
            'CREATE TABLE Users (uID INT UNSIGNED NOT NULL AUTO_INCREMENT, uName VARCHAR(128) NULL, uFirstName VARCHAR(128) NULL, uEmail VARCHAR(128) NULL, PRIMARY KEY (uID));');
        parent::setUp();
    }

    public function testInvalidConnection()
    {
        $this->expectException(\Doctrine\DBAL\Driver\PDOException::class);
        // php 8.1 and above the error message is more detailed
        $this->expectExceptionMessageMatches('/(getaddrinfo (?:for .+ )?failed)/');
        $connection = Database::getFactory()->createConnection(
{'fraction_non_alphanumeric': 0.12217194570135746, 'fraction_numerical': 0.010055304172951232, 'mean_word_length': 3.617169373549884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '2122820', 'n_tokens_mistral': 583, 'n_tokens_neox': 553, 'n_words': 135}