Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.gitignore export-ignore
/test export-ignore
/phpunit.xml.dist export-ignore
/phpcs.xml.dist export-ignore
13 changes: 7 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ jobs:

strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
php-versions: ['8.3', '8.4']
dbal: ['3.*', '4.*']
name: PHP ${{ matrix.php-versions }}, DBAL ${{ matrix.dbal }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
Expand All @@ -26,10 +27,10 @@ jobs:
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
key: ${{ runner.os }}-composer-${{ matrix.dbal }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.dbal }}-
- name: composer install
run: composer install --no-progress --prefer-dist --optimize-autoloader
run: composer require --dev doctrine/dbal:"${{ matrix.dbal }}" --no-progress --prefer-dist --optimize-autoloader
- run: sudo /etc/init.d/mysql start
- name: phpunit
run: php vendor/bin/phpunit
Expand Down
2 changes: 1 addition & 1 deletion bin/mysql_github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ finish() {
DBNAME="$(date +%s%N)"
echo "CREATE DATABASE \`$DBNAME\`;" | $MYSQL >&3

# PHP 7.3 compatibility, does not support caching_sha2_password, use mysql_native_password on a new user instead.
# Older PHP/mysql clients do not support caching_sha2_password, use mysql_native_password on a new user instead.
echo "CREATE USER IF NOT EXISTS 'test'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';" | $MYSQL >&3
echo "GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost';" | $MYSQL >&3
echo "FLUSH PRIVILEGES;" | $MYSQL >&3
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"description": "Provide a real database, safe for testing purposes",
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"doctrine/orm": "^2.5.4"
"php": "^8.3"
},
"require-dev": {
"doctrine/dbal": "^3.7|^4.0",
"hostnet/phpcs-tool": "^9.1.0",
"phpunit/phpunit": "^9.4"
},
Expand Down
10 changes: 5 additions & 5 deletions test/MysqlPersistentConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Hostnet\Component\DatabaseTest;

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Tools\DsnParser;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -22,7 +23,7 @@ public function testConstruction(): void

$connection = new MysqlPersistentConnection();
$url = $connection->getConnectionUrl();
$this->assertCount(1, $this->listDatabases(['url' => $url]));
$this->assertCount(1, $this->listDatabases((new DsnParser(['mysql' => 'pdo_mysql']))->parse($url)));
}

/**
Expand Down Expand Up @@ -55,13 +56,12 @@ public function testDestruction(): void
*
* @param string[] $params Doctrine connection parameters
* @return string[]
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Exception
*/
private function listDatabases(array $params): array
{
$doctrine = DriverManager::getConnection($params);
$statement = $doctrine->executeQuery('SHOW DATABASES');
$data = $statement->fetchAll(\PDO::FETCH_COLUMN);
$doctrine = DriverManager::getConnection($params);
$data = $doctrine->executeQuery('SHOW DATABASES')->fetchFirstColumn();

return array_filter(
$data,
Expand Down
Loading