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

WIP Feature/tests #99

Open
wants to merge 11 commits into
base: master
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 .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ TEST_SITE_TABLE_PREFIX=wp_
TEST_SITE_ADMIN_USERNAME=admin
TEST_SITE_ADMIN_PASSWORD=admin
TEST_SITE_WP_ADMIN_PATH=/wp-admin
WP_ROOT_FOLDER=/app/wordpress/
WP_ROOT_FOLDER=/app/wordpress-test/
TEST_DB_NAME=test
TEST_DB_HOST=test
TEST_DB_USER=test
TEST_DB_PASSWORD=test
TEST_TABLE_PREFIX=wp_
TEST_SITE_WP_URL=https://bea-content-sync-fusion.lndo.site
TEST_SITE_WP_DOMAIN=bea-content-sync-fusion.lndo.site
TEST_SITE_WP_URL=https://bea-content-sync-fusion-test.lndo.site
TEST_SITE_WP_DOMAIN=bea-content-sync-fusion-test.lndo.site
TEST_SITE_ADMIN_EMAIL=admin@admin.fr
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: "Setup Env"
run: |
lando start
lando setup
lando setup-test-env

- name: "Run tests"
run: |
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ sftp-config.json
vendor
composer.lock
/bin/
/wordpress/
/wordpress/
/wordpress-test/
app
60 changes: 50 additions & 10 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,51 @@
name: bea-content-sync-fusion
recipe: wordpress
env_file:
- .env.testing
config:
webroot: ./wordpress/
env:
- .env.testing
proxy:
appserver:
- bea-content-sync-fusion.lndo.site
appserver_test:
- bea-content-sync-fusion-test.lndo.site
services:
appserver:
run_as_root:
- ln -s /app/ /app/wordpress/wp-content/plugins/bea-content-sync-fusion
- rm -rf /app/wordpress/wp-content/plugins/bea-content-sync-fusion && ln -s /app/ /app/wordpress/wp-content/plugins/bea-content-sync-fusion
appserver_test:
type: php
via: apache
webroot: wordpress-test
ssl: true
sslExpose: true
run_as_root:
- rm -rf /app/wordpress-test/wp-content/plugins/bea-content-sync-fusion && ln -s /app/ /app/wordpress-test/wp-content/plugins/bea-content-sync-fusion
test:
type: mysql:5.7
portforward: true
creds:
user: test
password: test
database: test
chromedriver:
type: compose
services:
image: robcherry/docker-chromedriver:latest
expose:
- "4444"
environment:
CHROMEDRIVER_WHITELISTED_IPS: ""
CHROMEDRIVER_URL_BASE: "/wd/hub"
CHROMEDRIVER_EXTRA_ARGS: "--ignore-certificate-errors --reduce-security-for-testing --enable-features=NetworkService"
security_opt:
- seccomp:unconfined
command: ["/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf"]
events:
# Runs composer install and a custom php script before your app starts
pre-start:
- appserver: cd $LANDO_MOUNT && composer install
- appserver:
- cd $LANDO_MOUNT && composer install && cp -R wordpress wordpress-test
tooling:
setup:
service: appserver
Expand All @@ -31,7 +58,7 @@ tooling:
- echo "➡️ Create config"
- wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=database --path=/app/wordpress
- echo "➡️ Install WP"
- wp core multisite-install --url=https://bea-content-sync-fusion.lndo.site --title="Content sync fusion" --admin_password=admin --admin_email=admin@admin.fr --path=wordpress --skip-email
- wp core multisite-install --url=https://bea-content-sync-fusion.lndo.site --title="Content sync fusion" --admin_password=admin --admin_email=admin@admin.fr --path=/app/wordpress --skip-email
- echo "➡️ Install query monitor"
- wp plugin install --activate-network query-monitor
- echo "➡️ Activate plugin"
Expand All @@ -41,21 +68,34 @@ tooling:
- wp site create --slug=site-2 --title="Site 2"
- wp site create --slug=site-3 --title="Site 3"
- wp site create --slug=site-4 --title="Site 4"
- echo "➡️ Copye .htaccess"
- echo "➡️ Copy .htaccess"
- cp /app/tests/bin/htaccess /app/wordpress/.htaccess
setup-test-env:
service: appserver_test
description: 'Setup test env, only create the config file and .htaccess.'
cmd:
- echo "➡️ Reset DB ?"
- if [ -f /app/wordpress-test/wp-config.php ]; then echo "wp-config exists reset DB" && wp db reset --yes --path=/app/wordpress-test ; else echo "No wp-config.php, no reset" ; fi
- echo "➡️ Reset config"
- if [ -f /app/wordpress-test/wp-config.php ]; then echo "wp-config exists deleting it" && rm -f /app/wordpress-test/wp-config.php; else echo "No wp-config.php, no rm" ; fi
- echo "➡️ Create config"
- wp config create --dbname=test --dbuser=test --dbpass=test --dbhost=test --path=/app/wordpress-test
- wp core multisite-install --url=https://bea-content-sync-fusion-test.lndo.site --title="Content sync fusion TEST" --admin_password=admin --admin_email=admin@admin.fr --path=/app/wordpress-test --skip-email
- echo "➡️ Copy .htaccess"
- cp /app/tests/bin/htaccess /app/wordpress-test/.htaccess
test-unit:
service: appserver
service: appserver_test
cmd: composer test-unit
description: Run our PHPunit tests
test-wpunit:
service: appserver
service: appserver_test
cmd: composer test-wpunit
description: Run our wpunit tests
test-acceptance:
service: appserver
service: appserver_test
cmd: composer test-acceptance
description: Run our acceptance tests
test-functional:
service: appserver
service: appserver_test
cmd: composer test-functional
description: Run our functional tests
4 changes: 4 additions & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
- Codeception\Extension\Recorder
config:
Codeception\Extension\Recorder:
module: WPWebDriver
commands:
- Codeception\Command\GenerateWPUnit
- Codeception\Command\GenerateWPRestApi
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"sensiolabs/security-checker": "^6.0",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.0",
"vlucas/phpdotenv": "^5.2",
"wp-coding-standards/wpcs": "^2.3"
},
"extra": {
Expand Down
Loading