Skip to content

Commit 2d30e33

Browse files
authored
Merge pull request #12 from php-db/adapter-migration
Adapter migration
2 parents bc056e0 + 72a4af7 commit 2d30e33

File tree

96 files changed

+10777
-1960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+10777
-1960
lines changed

.ci/mysql_fixtures.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Configure MySQL test database"
4+
5+
mysql --user=root --password=Password123 -e "create database laminasdb_test;"

.github/workflows/continuous-integration.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,41 @@ on:
77
tags:
88

99
jobs:
10-
ci:
11-
uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x
10+
matrix:
11+
name: Generate job matrix
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.matrix.outputs.matrix }}
15+
steps:
16+
- name: Gather CI configuration
17+
id: matrix
18+
uses: laminas/laminas-ci-matrix-action@v1
19+
20+
qa:
21+
name: QA Checks
22+
needs: [matrix]
23+
runs-on: ${{ matrix.operatingSystem }}
24+
strategy:
25+
fail-fast: false
26+
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
27+
steps:
28+
- name: ${{ matrix.name }}
29+
uses: laminas/laminas-continuous-integration-action@v1
30+
with:
31+
job: ${{ matrix.job }}
32+
services:
33+
mysql:
34+
image: mysql:5.7
35+
env:
36+
MYSQL_ROOT_PASSWORD: 'password'
37+
MYSQL_ROOT_HOST: '%'
38+
MYSQL_USER: 'gha'
39+
MYSQL_PASSWORD: 'password'
40+
MYSQL_DATABASE: 'laminasdb_test'
41+
options: >-
42+
--health-cmd="mysqladmin ping"
43+
--health-interval 10s
44+
--health-timeout 5s
45+
--health-retries 3
46+
ports:
47+
- 3306

.laminas-ci/mysql_permissions.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE USER 'gha'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
2+
GRANT ALL PRIVILEGES ON *.* TO 'gha'@'%';
3+
FLUSH PRIVILEGES;

.laminas-ci/phpunit.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
requireCoverageMetadata="true"
7+
colors="true">
8+
9+
<extensions>
10+
<bootstrap class="PhpDbIntegrationTest\Mysql\Extension\ListenerExtension" />
11+
</extensions>
12+
<testsuites>
13+
<testsuite name="unit test">
14+
<directory>./test/unit</directory>
15+
</testsuite>
16+
<testsuite name="integration test">
17+
<directory>./test/integration</directory>
18+
</testsuite>
19+
</testsuites>
20+
<php>
21+
<!-- Integration Test Variables -->
22+
<env name="TESTS_PHPDB_ADAPTER_MYSQL" value="true" /><!-- todo: remove this env variable as its no longer needed-->
23+
<env name="TESTS_PHPDB_ADAPTER_MYSQL_HOSTNAME" value="mysql" />
24+
<env name="TESTS_PHPDB_ADAPTER_MYSQL_USERNAME" value="gha" />
25+
<env name="TESTS_PHPDB_ADAPTER_MYSQL_PASSWORD" value="password" />
26+
<env name="TESTS_PHPDB_ADAPTER_MYSQL_DATABASE" value="laminasdb_test" />
27+
</php>
28+
</phpunit>
29+

.laminas-ci/pre-install.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
WORKING_DIRECTORY=$2
4+
JOB=$3
5+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
6+
7+
8+
if [ ! -z "$GITHUB_BASE_REF" ] && [[ "$GITHUB_BASE_REF" =~ ^[0-9]+\.[0-9] ]]; then
9+
readarray -td. TARGET_BRANCH_VERSION_PARTS <<<"${GITHUB_BASE_REF}.";
10+
unset 'TARGET_BRANCH_VERSION_PARTS[-1]';
11+
declare -a TARGET_BRANCH_VERSION_PARTS
12+
MAJOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[0]}
13+
MINOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[1]}
14+
15+
export COMPOSER_ROOT_VERISON="${MAJOR_OF_TARGET_BRANCH}.${MINOR_OF_TARGET_BRANCH}.99"
16+
echo "Exported COMPOSER_ROOT_VERISON as ${COMPOSER_ROOT_VERISON}"
17+
fi

.laminas-ci/pre-run.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
TEST_USER=$1
6+
WORKSPACE=$2
7+
JOB=$3
8+
9+
COMMAND=$(echo "${JOB}" | jq -r '.command')
10+
11+
if [[ ! ${COMMAND} =~ phpunit ]]; then
12+
exit 0
13+
fi
14+
15+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
16+
17+
# Install CI version of phpunit config
18+
cp .laminas-ci/phpunit.xml phpunit.xml
19+
20+
# Install lsof (used in integration tests)
21+
apt update -qq
22+
apt install -yqq lsof

bin/install-deps.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
/usr/bin/composer validate && \
4+
/usr/bin/composer --ignore-platform-reqs install \
5+
--no-ansi --no-progress --no-scripts \
6+
--classmap-authoritative --no-interaction \
7+
--quiet

compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
php:
3+
build:
4+
context: ./
5+
dockerfile: docker/php/Dockerfile
6+
args:
7+
- PHP_VERSION=${PHP_VERSION:-8.3.19}
8+
volumes:
9+
- ./:/var/www/html
10+
depends_on:
11+
- mysql
12+
13+
mysql:
14+
build:
15+
context: ./
16+
dockerfile: docker/databases/mysql/Dockerfile
17+
args:
18+
- VERSION=${MYSQL_VERSION:-8.0.41}
19+
ports:
20+
- "3306:3306"
21+
environment:
22+
- MYSQL_DATABASE=${MYSQL_DATABASE:-laminasdb_test}
23+
- MYSQL_USER=${MYSQL_USER:-user}
24+
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
25+
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD:-yes}
26+
volumes:
27+
- ./test/integration/TestFixtures/mysql.sql:/docker-entrypoint-initdb.d/mysql.sql
28+
healthcheck:
29+
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
30+
timeout: 20s
31+
retries: 10

composer.json

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,62 @@
11
{
2-
"name": "laminas/laminas-db-mysql-adapter",
3-
"description": "MySQL support for laminas-db",
2+
"name": "php-db/phpdb-adapter-mysql",
3+
"description": "MySQL support for php-db",
44
"license": "BSD-3-Clause",
55
"keywords": [
66
"laminas",
7+
"mezzio",
8+
"php-db",
79
"mysql",
810
"db"
911
],
10-
"homepage": "https://github.com/axleus/laminas-db-mysql/discussions",
12+
"homepage": "https://github.com/php-db/phpdb-adapter-mysql/discussions",
1113
"support": {
12-
"issues": "https://github.com/alxeus/laminas-db-mysql/issues",
13-
"source": "https://github.com/axleus/laminas-db-mysql",
14-
"forum": "https://github.com/axleus/laminas-db-mysql/discussions"
14+
"issues": "https://github.com/php-db/phpdb-adapter-mysql/issues",
15+
"source": "https://github.com/php-db/phpdb-adapter-mysql",
16+
"forum": "https://github.com/php-db/phpdb-adapter-mysql/discussions"
1517
},
1618
"minimum-stability": "dev",
1719
"prefer-stable": true,
1820
"config": {
1921
"sort-packages": true,
2022
"platform": {
21-
"php": "8.1.99"
23+
"php": "8.2.99"
2224
},
2325
"allow-plugins": {
2426
"dealerdirect/phpcodesniffer-composer-installer": true
2527
}
2628
},
2729
"extra": {
2830
"laminas": {
29-
"component": "Laminas\\Db\\Mysql",
30-
"config-provider": "Laminas\\Db\\Mysql\\ConfigProvider"
31+
"config-provider": "PhpDb\\Adapter\\Mysql\\ConfigProvider"
3132
}
3233
},
3334
"require": {
3435
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
35-
"laminas/laminas-db": "3.0.x"
36+
"php-db/phpdb": "0.0.x-dev"
3637
},
3738
"require-dev": {
3839
"ext-mysqli": "*",
3940
"ext-pdo_mysql": "*",
4041
"laminas/laminas-coding-standard": "^3.0.1",
41-
"laminas/laminas-eventmanager": "^3.6.0",
42-
"laminas/laminas-hydrator": "^4.7",
43-
"laminas/laminas-servicemanager": "^3.19.0",
44-
"phpunit/phpunit": "^9.5.25",
42+
"phpunit/phpunit": "^11.5.15",
4543
"psalm/plugin-phpunit": "^0.19.2",
4644
"vimeo/psalm": "^6.8.8"
4745
},
4846
"suggest": {
4947
"ext-mysqli": "Required for MySQLi support",
5048
"ext-pdo_mysql": "Required for PDO MySQL support",
51-
"laminas/laminas-servicemanager": "Laminas\\ServiceManager component"
49+
"laminas/laminas-eventmanager": "Required for TableGateway events support"
5250
},
5351
"autoload": {
5452
"psr-4": {
55-
"Laminas\\Db\\Mysql\\": "src/"
53+
"PhpDb\\Adapter\\Mysql\\": "src/"
5654
}
5755
},
5856
"autoload-dev": {
5957
"psr-4": {
60-
"LaminasTest\\Db\\Mysql\\": "test/unit/",
61-
"LaminasIntegrationTest\\Db\\Mysql\\": "test/integration/"
58+
"PhpDbTest\\Adapter\\Mysql\\": "test/unit/",
59+
"PhpDbIntegrationTest\\Adapter\\Mysql\\": "test/integration/"
6260
}
6361
},
6462
"scripts": {
@@ -72,9 +70,8 @@
7270
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
7371
"test-integration": "phpunit --colors=always --testsuite \"integration test\"",
7472
"static-analysis": "psalm --shepherd --stats",
73+
"sa-update-baseline": "psalm --update-baseline",
74+
"sa-no-baseline": "psalm --shepherd --stats --ignore-baseline",
7575
"upload-coverage": "coveralls -v"
76-
},
77-
"conflict": {
78-
"laminas/laminas-db": "*"
7976
}
8077
}

0 commit comments

Comments
 (0)