Skip to content

Commit 014dcd3

Browse files
committed
Merge branch 'main' into mapper
2 parents eb8861f + 5e2058f commit 014dcd3

File tree

4 files changed

+114
-19
lines changed

4 files changed

+114
-19
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,9 +1432,10 @@ I am testing mainly on Ubuntu and I have the following test setups:
14321432
- (Docker) Debian 9 with PHP 7.0, MariaDB 10.1, PostgreSQL 9.6 (PostGIS 2.3) and SQLite 3.16
14331433
- (Docker) Ubuntu 18.04 with PHP 7.2, MySQL 5.7, PostgreSQL 10.4 (PostGIS 2.4) and SQLite 3.22
14341434
- (Docker) Debian 10 with PHP 7.3, MariaDB 10.3, PostgreSQL 11.4 (PostGIS 2.5) and SQLite 3.27
1435-
- (Docker) Ubuntu 20.04 with PHP 7.4, MySQL 8.0, PostgreSQL 12.2 (PostGIS 3.0) and SQLite 3.31
1435+
- (Docker) Ubuntu 20.04 with PHP 7.4, MySQL 8.0, PostgreSQL 12.2 (PostGIS 3.0) and SQL Server 2019 and SQLite 3.31
14361436
- (Docker) CentOS 8 with PHP 8.1, MariaDB 10.7, PostgreSQL 12.10 (PostGIS 3.0) and SQLite 3.26
14371437
- (Docker) Debian 11 with PHP 7.4, MariaDB 10.5, PostgreSQL 13.4 (PostGIS 3.1) and SQLite 3.34
1438+
- (Docker) Ubuntu 22.04 with PHP 8.1, MySQL 8.0, PostgreSQL 14.2 (PostGIS 3.2) and SQLite 3.37
14381439

14391440
This covers not all environments (yet), so please notify me of failing tests and report your environment.
14401441
I will try to cover most relevant setups in the "docker" folder of the project.
@@ -1573,6 +1574,18 @@ To run the docker tests run "build_all.sh" and "run_all.sh" from the docker dire
15731574
pgsql: 119 tests ran in 1368 ms, 1 skipped, 0 failed
15741575
sqlsrv: 119 tests ran in 8410 ms, 1 skipped, 0 failed
15751576
sqlite: 119 tests ran in 1053 ms, 13 skipped, 0 failed
1577+
================================================
1578+
Ubuntu 22.04 (PHP 8.1)
1579+
================================================
1580+
[1/4] Starting MySQL 8.0 ........ done
1581+
[2/4] Starting PostgreSQL 14.2 .. done
1582+
[3/4] Starting SQLServer 2019 ... skipped
1583+
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1584+
------------------------------------------------
1585+
mysql: 119 tests ran in 6882 ms, 1 skipped, 0 failed
1586+
pgsql: 119 tests ran in 2570 ms, 1 skipped, 0 failed
1587+
sqlsrv: skipped, driver not loaded
1588+
sqlite: 119 tests ran in 2548 ms, 13 skipped, 0 failed
15761589

15771590
The above test run (including starting up the databases) takes less than 5 minutes on my slow laptop.
15781591

@@ -1584,6 +1597,7 @@ The above test run (including starting up the databases) takes less than 5 minut
15841597
5) ubuntu16
15851598
6) ubuntu18
15861599
7) ubuntu20
1600+
8) ubuntu22
15871601
> 6
15881602
================================================
15891603
Ubuntu 18.04 (PHP 7.2)

docker-compose.yml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@ services:
55
container_name: database
66
restart: always
77
environment:
8-
- MYSQL_ROOT_PASSWORD=php-crud-api
9-
- MYSQL_DATABASE=php-crud-api
10-
- MYSQL_USER=php-crud-api
11-
- MYSQL_PASSWORD=php-crud-api
12-
#ports:
13-
#- "33066:3306"
8+
- MYSQL_ROOT_PASSWORD=php-crud-api
9+
- MYSQL_DATABASE=php-crud-api
10+
- MYSQL_USER=php-crud-api
11+
- MYSQL_PASSWORD=php-crud-api
12+
#ports:
13+
#- "33066:3306"
1414
volumes:
15-
- ./tests/fixtures/blog_mysql.sql:/docker-entrypoint-initdb.d/blog_mysql.sql
15+
- ./tests/fixtures/blog_mysql.sql:/docker-entrypoint-initdb.d/blog_mysql.sql
1616
webserver:
1717
container_name: webserver
1818
build:
1919
context: ./
2020
environment:
21-
#- PHP_CRUD_API_DRIVER=mysql
22-
- PHP_CRUD_API_ADDRESS=database
23-
#- PHP_CRUD_API_PORT=3306
24-
#- PHP_CRUD_API_DATABASE=php-crud-api
25-
#- PHP_CRUD_API_USERNAME=php-crud-api
26-
#- PHP_CRUD_API_PASSWORD=php-crud-api
27-
#- PHP_CRUD_API_DEBUG=1
21+
#- PHP_CRUD_API_DRIVER=mysql
22+
- PHP_CRUD_API_ADDRESS=database
23+
#- PHP_CRUD_API_PORT=3306
24+
#- PHP_CRUD_API_DATABASE=php-crud-api
25+
#- PHP_CRUD_API_USERNAME=php-crud-api
26+
#- PHP_CRUD_API_PASSWORD=php-crud-api
27+
#- PHP_CRUD_API_DEBUG=1
28+
- PHP_CRUD_API_MAPPING=abc_posts.abc_id=posts.id,abc_posts.abc_user_id=posts.user_id,abc_posts.abc_category_id=posts.category_id,abc_posts.abc_content=posts.content
2829
ports:
29-
- "8080:80"
30+
- "8080:80"
3031
depends_on:
31-
- database
32-
#volumes:
33-
#- .:/php-crud-api:ro
32+
- database
33+
#volumes:
34+
#- .:/php-crud-api:ro

docker/ubuntu22/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:22.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
# install: php / mysql / postgres / sqlite / tools / mssql deps
6+
RUN apt-get update && apt-get -y install \
7+
php-cli php-xml php-mbstring \
8+
mysql-server mysql-client php-mysql \
9+
postgresql php-pgsql \
10+
postgresql-14-postgis-3 \
11+
sqlite3 php-sqlite3 \
12+
git wget \
13+
curl gnupg
14+
15+
# install locales
16+
RUN apt-get -y install locales
17+
RUN locale-gen en_US.UTF-8
18+
RUN update-locale LANG=en_US.UTF-8
19+
20+
# install run script
21+
ADD run.sh /usr/sbin/docker-run
22+
CMD docker-run

docker/ubuntu22/run.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
echo "================================================"
3+
echo " Ubuntu 22.04 (PHP 8.1)"
4+
echo "================================================"
5+
6+
echo -n "[1/4] Starting MySQL 8.0 ........ "
7+
# run mysql server
8+
nohup mysqld > /root/mysql.log 2>&1 &
9+
# wait for mysql to become available
10+
while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
11+
sleep 1
12+
done
13+
# create database and user on mysql
14+
mysql -u root >/dev/null << 'EOF'
15+
CREATE DATABASE `php-crud-api` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
16+
CREATE USER 'php-crud-api'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'php-crud-api';
17+
GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
18+
FLUSH PRIVILEGES;
19+
EOF
20+
echo "done"
21+
22+
echo -n "[2/4] Starting PostgreSQL 14.2 .. "
23+
# ensure statistics can be written
24+
mkdir /var/run/postgresql/10-main.pg_stat_tmp/ && chmod 777 /var/run/postgresql/10-main.pg_stat_tmp/
25+
# run postgres server
26+
nohup su - -c "/usr/lib/postgresql/14/bin/postgres -D /etc/postgresql/14/main" postgres > /root/postgres.log 2>&1 &
27+
# wait for postgres to become available
28+
until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do
29+
sleep 1;
30+
done
31+
# create database and user on postgres
32+
su - -c "psql -U postgres >/dev/null" postgres << 'EOF'
33+
CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
34+
CREATE DATABASE "php-crud-api";
35+
GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
36+
\c "php-crud-api";
37+
CREATE EXTENSION IF NOT EXISTS postgis;
38+
\q
39+
EOF
40+
echo "done"
41+
42+
echo -n "[3/4] Starting SQLServer 2019 ... "
43+
echo "skipped"
44+
45+
echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
46+
# install software
47+
if [ -d /php-crud-api ]; then
48+
echo "skipped"
49+
else
50+
git clone --quiet https://github.com/mevdschee/php-crud-api.git
51+
echo "done"
52+
fi
53+
54+
echo "------------------------------------------------"
55+
56+
# run the tests
57+
cd php-crud-api
58+
php test.php

0 commit comments

Comments
 (0)