You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change adds the initial Docker setup, providing an environment
where the tests can be run, regardless of the user's operating system.
It provides three services; one for PHP, one for MySQL, and one for
PostgreSQL. The PHP environment has all of the dependencies and
extensions required to interact with MySQL, PostgreSQL, and SQLite,
along with any required binaries. It also updates PHPUnit's
configuration, where required, to sync with that configuration.
The change also removes the Vagrantfile as it's no longer required.
Signed-off-by: Matthew Setter <matthew@matthewsetter.com>
Unit tests do not require additional functionality beyond having the appropriate database extensions present and loaded in your PHP binary.
42
42
43
-
### Integration tests
43
+
####Integration tests
44
44
45
45
To run the integration tests, you need databases.
46
-
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:
46
+
So, the repository includes a [Docker Compose][docker-compose] configuration which allows you to start a test environment that provides several of our target databases, including_MySQL_ and _PostgreSQL_, and SQLite.
47
47
48
-
- MySQL
49
-
- PostgreSQL
50
-
- SQL Server
48
+
To start up the configuration, run the following command:
51
49
52
-
To start up vagrant:
50
+
```bash
51
+
$ docker compose up -d
52
+
```
53
+
54
+
To test that the environment is up and running, run the following command:
53
55
54
56
```bash
55
-
$ vagrant up
57
+
$ docker compose ps
56
58
```
57
59
58
-
Copy `phpunit.xml.dist` to `phpunit.xml`, and change the following ENV var declaration values to "true":
60
+
You should see output similar to the following:
61
+
62
+
```bash
63
+
docker compose ps
64
+
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
65
+
laminas-db-mysql-1 docker.io/library/laminas-db-mysql:latest "mysqld" mysql 7 hours ago Up 7 hours
66
+
laminas-db-php-1 docker.io/library/laminas-db-php:latest "apache2-foreground" php 7 hours ago Up 7 hours
67
+
laminas-db-postgresql-1 docker.io/library/laminas-db-postgresql:latest "postgres" postgresql 7 hours ago Up 7 hours
68
+
```
69
+
70
+
If you see three containers listed, then they're all running, and you are ready to run the test suite.
71
+
So, copy `phpunit.xml.dist` to `phpunit.xml`, and change the following environment variable to "true" to enable the three databases:
59
72
60
73
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_MYSQL
61
-
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_SQLSRV
62
74
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_PGSQL
63
75
- TESTS_LAMINAS_DB_ADAPTER_DRIVER_SQLITE_MEMORY
64
76
65
-
From there, you can run the integration tests:
77
+
From there, you can run the integration tests by running the following command:
0 commit comments