2018-03-02 20:33:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
source build-config.cfg
|
|
|
|
|
|
|
|
#./build.sh
|
|
|
|
|
|
|
|
|
|
|
|
plugin_name=`basename $destination`
|
|
|
|
test_db_prefix='wp_tainacan_test_'
|
|
|
|
|
|
|
|
|
2018-03-02 21:03:34 +00:00
|
|
|
################## set up cypress environment
|
2018-03-02 20:33:00 +00:00
|
|
|
# replace table prefix in wp_config
|
2018-03-02 21:03:34 +00:00
|
|
|
echo "Changing DB prefix in wp_config..."
|
2018-03-02 20:33:00 +00:00
|
|
|
sed -i s/"require_once(ABSPATH . 'wp-settings.php');"/"\$table_prefix = '$test_db_prefix';\nrequire_once(ABSPATH . 'wp-settings.php');"/ $wp_base_dir/wp-config.php
|
|
|
|
|
|
|
|
# install WordPress
|
|
|
|
cd $wp_base_dir
|
2018-03-02 21:03:34 +00:00
|
|
|
echo "Installing WordPress..."
|
2018-03-02 20:33:00 +00:00
|
|
|
wp core install --url=$wp_url --title=Test --admin_user=admin --admin_password=admin --admin_email=admin@admin.com
|
|
|
|
|
|
|
|
# Activate Tainacan
|
|
|
|
wp plugin activate $plugin_name
|
|
|
|
|
2018-03-02 21:03:34 +00:00
|
|
|
# back to tainacan dev directory
|
|
|
|
cd -
|
2018-03-02 20:33:00 +00:00
|
|
|
#npx cypress run --env host=$wp_url,baseUrl=$wp_url
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-02 21:03:34 +00:00
|
|
|
################## teardown cypress environment
|
2018-03-02 20:33:00 +00:00
|
|
|
|
|
|
|
# remove WordPress
|
2018-03-02 21:03:34 +00:00
|
|
|
echo "Removing WordPress..."
|
|
|
|
cd $wp_base_dir
|
|
|
|
wp db query "DROP TABLES $(wp db tables | paste -s -d, -);"
|
2018-03-02 20:33:00 +00:00
|
|
|
|
|
|
|
# recover table prefix in wp_config
|
2018-03-02 21:03:34 +00:00
|
|
|
echo "Restoring DB prefix in wp_config..."
|
2018-03-02 20:33:00 +00:00
|
|
|
sed -i s/"\$table_prefix = '$test_db_prefix';"/""/ $wp_base_dir/wp-config.php
|
|
|
|
|
|
|
|
|