Skip to content

Commit a7acfdb

Browse files
authored
Merge pull request laminas#205 from weierophinney/feature/php-8.1-support
Provide PHP 8.1 support
2 parents af9634d + 7c848c9 commit a7acfdb

File tree

338 files changed

+6417
-5569
lines changed

Some content is hidden

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

338 files changed

+6417
-5569
lines changed

.ci/mysql_fixtures.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
echo "Configure MySQL test database"
44

5-
mysql --user=root --password=Password123 -e 'create database zenddb_test;'
5+
mysql --user=root --password=Password123 -e "create database laminasdb_test;"

.ci/pgsql_fixtures.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
echo "Configure PostgreSQL test database"
44

5-
psql -U postgres -c 'create database zenddb_test;'
5+
psql -U postgres -c 'create database laminasdb_test;'
66
psql -U postgres -c "alter role postgres password 'postgres'"

.ci/sqlsrv_fixtures.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
echo "Configure SQL server test database"
44

5-
sqlcmd -S localhost -U sa -P Password123 -Q "CREATE DATABASE zenddb_test;"
5+
sqlcmd -S localhost -U sa -P Password123 -Q "CREATE DATABASE laminasdb_test;"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
/.phpcs-cache
12
/.phpunit.result.cache
3+
/.vagrant/
24
/clover.xml
35
/coveralls-upload.json
46
/docs/html/

.laminas-ci.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"pgsql",
88
"sqlite3",
99
"sqlsrv"
10-
]
10+
],
11+
"ignore_php_platform_requirements": {
12+
"8.1": true
13+
}
1114
}

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,58 @@
11
# laminas-db
22

3-
[![Build Status](https://github.com/laminas/laminas-config/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-config/actions?query=workflow%3A"Continuous+Integration")
3+
[![Build Status](https://github.com/laminas/laminas-db/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-db/actions?query=workflow%3A"Continuous+Integration")
44

55
`Laminas\Db` is a component that abstract the access to a Database using an object
66
oriented API to build the queries. `Laminas\Db` consumes different storage adapters
77
to access different database vendors such as MySQL, PostgreSQL, Oracle, IBM DB2,
88
Microsoft Sql Server, PDO, etc.
99

10+
## Contributing
11+
12+
Please be sure to read the [contributor's guide](/laminas/.github/blob/main/CONTRIBUTING.md) for general information on contributing.
13+
This section outlines specifics for laminas-db.
14+
15+
### Test suites
16+
17+
The `phpunit.xml.dist` file defines two test suites, "unit test" and "integration test".
18+
You can run one or the other using the `--testsuite` option to `phpunit`:
19+
20+
```bash
21+
$ ./vendor/bin/phpunit --testsuite "unit test" # unit tests only
22+
$ ./vendor/bin/phpunit --testsuite "integration test" # integration tests only
23+
```
24+
25+
Unit tests do not require additional functionality beyond having the appropriate database extensions present and loaded in your PHP binary.
26+
27+
### Integration tests
28+
29+
To run the integration tests, you need databases.
30+
The repository includes a `Vagrantfile` which allows you to fire up a [vagrant box](https://app.vagrantup.com) with several of our target databases, including:
31+
32+
- MySQL
33+
- PostgreSQL
34+
- SQL Server
35+
36+
To start up vagrant:
37+
38+
```bash
39+
$ vagrant up
40+
```
41+
42+
Copy `phpunit.xml.dist` to `phpunit.xml`, and change the following ENV var declaration values to "true":
43+
44+
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_MYSQL
45+
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_SQLSRV
46+
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_PGSQL
47+
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_SQLITE_MEMORY
48+
49+
From there, you can run the integration tests:
50+
51+
```bash
52+
$ ./vendor/bin/phpunit --testsuite "integration test"
53+
```
54+
55+
-----
56+
1057
- File issues at https://github.com/laminas/laminas-db/issues
1158
- Documentation is at https://docs.laminas.dev/laminas-db/

Vagrantfile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ apt-get -yq update
99
apt-get -yq install postgresql
1010
1111
# Allow external connections to PostgreSQL as postgres
12-
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/9.5/main/postgresql.conf
13-
sed -i "s/peer/trust/" /etc/postgresql/9.5/main/pg_hba.conf
14-
echo 'host all all 0.0.0.0/0 trust' >> /etc/postgresql/9.5/main/pg_hba.conf
12+
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/12/main/postgresql.conf
13+
sed -i "s/peer/trust/" /etc/postgresql/12/main/pg_hba.conf
14+
echo 'host all all 0.0.0.0/0 trust' >> /etc/postgresql/12/main/pg_hba.conf
1515
service postgresql restart
1616
1717
# INSTALL MySQL
@@ -22,20 +22,29 @@ apt-get -yq install mysql-server
2222
# Allow external connections to MySQL as root (with password Password123)
2323
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/g' /etc/mysql/mysql.conf.d/mysqld.cnf
2424
mysql -u root -pPassword123 -e 'USE mysql; UPDATE `user` SET `Host`="%" WHERE `User`="root" AND `Host`="localhost"; DELETE FROM `user` WHERE `Host` != "%" AND `User`="root"; FLUSH PRIVILEGES;'
25+
mysql -h localhost -u root -pPassword123 -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Password123';"
2526
service mysql restart
2627
2728
# INSTALL SQL Server
28-
# More info here: https://www.microsoft.com/en-us/sql-server/developer-get-started/php-ubuntu
29-
29+
# More info here: https://docs.microsoft.com/en-us/sql/linux/sample-unattended-install-ubuntu?view=sql-server-ver15
30+
MSSQL_SA_PASSWORD='Password123'
31+
MSSQL_PID=developer
32+
SQL_INSTALL_AGENT='y'
3033
curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
31-
curl -s https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list > /etc/apt/sources.list.d/mssql-server.list
34+
repoargs="$(curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)"
35+
add-apt-repository "${repoargs}"
36+
repoargs="$(curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list)"
37+
add-apt-repository "${repoargs}"
3238
apt-get -yq update
3339
apt-get -yq install mssql-server
34-
printf "YES\nPassword123\nPassword123\ny\ny" | /opt/mssql/bin/mssql-conf setup
3540
36-
curl -s https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-tools.list
37-
apt-get -yq update
38-
ACCEPT_EULA=Y apt-get -yq install msodbcsql mssql-tools unixodbc-dev
41+
MSSQL_SA_PASSWORD=$MSSQL_SA_PASSWORD \
42+
MSSQL_PID=$MSSQL_PID \
43+
/opt/mssql/bin/mssql-conf -n setup accept-eula
44+
45+
echo "Installing mssql-tools and unixODBC developer..."
46+
ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
47+
3948
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> /home/vagrant/.bash_profile
4049
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> /home/vagrant/.bashrc
4150
source /home/vagrant/.bashrc
@@ -49,7 +58,7 @@ fi
4958
SCRIPT
5059

5160
Vagrant.configure(2) do |config|
52-
config.vm.box = 'bento/ubuntu-16.04'
61+
config.vm.box = 'bento/ubuntu-20.04'
5362
config.vm.provider "virtualbox" do |v|
5463
v.memory = 4096
5564
v.cpus = 2

composer.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,19 @@
2525
}
2626
},
2727
"require": {
28-
"php": "^7.3 || ~8.0.0",
29-
"laminas/laminas-stdlib": "^3.3",
30-
"laminas/laminas-zendframework-bridge": "^1.0"
28+
"php": "^7.3 || ~8.0.0 || ~8.1.0",
29+
"laminas/laminas-stdlib": "^3.6"
3130
},
3231
"require-dev": {
33-
"laminas/laminas-coding-standard": "~1.0.0",
34-
"laminas/laminas-eventmanager": "^3.3",
35-
"laminas/laminas-hydrator": "^3.2 || ^4.0",
36-
"laminas/laminas-servicemanager": "^3.3",
37-
"phpspec/prophecy-phpunit": "^2.0",
38-
"phpunit/phpunit": "^9.3"
32+
"laminas/laminas-coding-standard": "~2.2.1",
33+
"laminas/laminas-eventmanager": "^3.4",
34+
"laminas/laminas-hydrator": "^3.2 || ^4.3",
35+
"laminas/laminas-servicemanager": "^3.7",
36+
"phpunit/phpunit": "^9.5.5"
3937
},
4038
"suggest": {
4139
"laminas/laminas-eventmanager": "Laminas\\EventManager component",
42-
"laminas/laminas-hydrator": "(^3.2 || ^4.0) Laminas\\Hydrator component for using HydratingResultSets",
40+
"laminas/laminas-hydrator": "(^3.2 || ^4.3) Laminas\\Hydrator component for using HydratingResultSets",
4341
"laminas/laminas-servicemanager": "Laminas\\ServiceManager component"
4442
},
4543
"autoload": {
@@ -65,7 +63,7 @@
6563
"test-integration": "phpunit --colors=always --testsuite \"integration test\"",
6664
"upload-coverage": "coveralls -v"
6765
},
68-
"replace": {
69-
"zendframework/zend-db": "^2.11.0"
66+
"conflict": {
67+
"zendframework/zend-db": "*"
7068
}
7169
}

0 commit comments

Comments
 (0)