Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test environment for PHP 5.6 and PHP 7.0 #3432

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@
},
"scripts": {
"test:php": "composer test:unit && composer wp:tests",
"dev:install": "composer install && npm install && composer wp:install && composer wp:activate && composer test:setup",
"dev:install": "composer install && yarn install && composer wp:install && composer wp:activate && composer test:setup",
"dev:destroy": "composer nuke && composer wp:destroy",
"nuke": "rm package-lock.json && rm composer.lock && rm -rf node_modules/ && rm -rf vendor",
"nuke": "rm yarn.lock && rm composer.lock && rm -rf node_modules/ && rm -rf vendor",
"wp:install": "bash ./bin/install-docker.sh && composer wp:config",
"wp:activate": "bash ./bin/activate-plugin.sh",
"test:setup": "bash ./bin/setup-test-forms.sh",
"test:delete": "bash ./bin/delete-test-forms.sh",
"wp:config": "docker-compose run --rm cli wp rewrite structure '/%postname%/'",
"wp:config": "docker-compose run --rm cli wp rewrite structure %postname%",
"wp:start": "composer wp:server-start && composer wp:server-url",
"wp:server-start": "docker-compose up -d",
"wp:server-url": "bash ./bin/echo-server-url.sh",
Expand Down
13 changes: 12 additions & 1 deletion contributing/local-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The local server is [http://localhost:8228](http://localhost:8228)


## Requirements
* [Docker](https://docs.docker.com/)
* Docker
- [Installation documentation](https://docs.docker.com/install/)
* [Composer](https://getcomposer.org/)
- [Installation documentation](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)
Expand All @@ -25,6 +25,16 @@ The local server is [http://localhost:8228](http://localhost:8228)
- password: password
* [See Commands](https://github.com/CalderaWP/Caldera-Forms/tree/develop#composer)


## Testing Older Versions of PHP

The primary WordPress site uses the latest version of PHP.

There are also sites for testing older versions of PHP:

* PHP 5.6 [http://localhost:8256](http://localhost:8256)
* PHP 7.0 [http://localhost:8270](http://localhost:8270)

## JavaScript Development
* Install
- `yarn`
Expand All @@ -34,3 +44,4 @@ The local server is [http://localhost:8228](http://localhost:8228)
- `yarn start:blocks`
* Build all JavaScript and CSS
- `yarn build`

62 changes: 55 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.1'

services:

# WordPress site running latest PHP
wordpress:
image: wordpress
ports:
Expand All @@ -13,24 +14,70 @@ services:
volumes:
- wordpress:/var/www/html
- ./wp-content/plugins:/var/www/html/wp-content/plugins
- .:/var/www/html/wp-content/plugins/caldera-forms
- ./wp-content/mu-plugins:/var/www/html/wp-content/mu-plugins

cli:
image: wordpress:cli
# WordPress site running PHP 5.6
wordpress_5:
image: wordpress:php5.6
ports:
- 8256:80
environment:
WORDPRESS_DB_HOST: mysql_5
WORDPRESS_DB_PASSWORD: example
WORDPRESS_DEBUG: 1
ABSPATH: /usr/src/wordpress/
volumes:
- wordpress:/var/www/html
- .:/var/www/html/wp-content/plugins/caldera-forms
- ./wp-content/plugins:/var/www/html/wp-content/plugins
- wordpress:/var/www/html
- .:/var/www/html/wp-content/plugins/caldera-forms
- ./wp-content/plugins:/var/www/html/wp-content/plugins

# WordPress site running PHP 7.0
wordpress_7:
image: wordpress:php7.0
ports:
- 8270:80
environment:
WORDPRESS_DB_HOST: mysql_70
WORDPRESS_DB_PASSWORD: example
WORDPRESS_DEBUG: 1
ABSPATH: /usr/src/wordpress/
volumes:
- wordpress:/var/www/html
- .:/var/www/html/wp-content/plugins/caldera-forms
- ./wp-content/plugins:/var/www/html/wp-content/plugins

# Database for primary WordPress site
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress_test

# Database for WordPress site running PHP 5.6
mysql_5:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress_test_5

# Database for WordPress site running PHP 7.0
mysql_70:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress_test_70

# WP-CLI
cli:
image: wordpress:cli
volumes:
- wordpress:/var/www/html
- .:/var/www/html/wp-content/plugins/caldera-forms
- ./wp-content/plugins:/var/www/html/wp-content/plugins
environment:
WORDPRESS_DB_PASSWORD: example
ABSPATH: /usr/src/wordpress/

# For WordPress "unit" test runs
wordpress_phpunit:
image: chriszarate/wordpress-phpunit
environment:
Expand All @@ -39,6 +86,7 @@ services:
- .:/app
- testsuite:/tmp

# Composer
composer:
image: composer
volumes:
Expand Down
Loading