forked from Automattic/jetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-travis.sh
executable file
·50 lines (40 loc) · 1.5 KB
/
setup-travis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# If this is an NPM environment test, we don't need a developer WordPress checkout
if [ "$WP_TRAVISCI" != "phpunit" ]; then
exit 0;
fi
phpenv config-rm xdebug.ini
# Configure PHP and PHPUnit environment
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
composer global require "phpunit/phpunit=5.7.*" --no-suggest
elif [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
composer global require "phpunit/phpunit=4.8.*" --no-suggest
fi
mysql -e "set global wait_timeout = 3600;"
# Prepare a developer checkout of WordPress
mysql -u root -e "CREATE DATABASE wordpress_tests;"
echo "Preparing WordPress from \"$WP_BRANCH\" branch...";
case $WP_BRANCH in
master)
git clone --depth=1 --branch master git://develop.git.wordpress.org/ /tmp/wordpress-master
;;
latest)
git clone --depth=1 --branch $(php ./tests/get-wp-version.php) git://develop.git.wordpress.org/ /tmp/wordpress-latest
;;
previous)
git clone --depth=1 --branch $(php ./tests/get-wp-version.php --previous) git://develop.git.wordpress.org/ /tmp/wordpress-previous
;;
esac
clone_exit_code=$?
if [ $clone_exit_code -ne 0 ]; then
echo "Failed to clone WordPress from develop.git.wordpress.org"
exit 1
fi
cd ..
cp -r $PLUGIN_SLUG "/tmp/wordpress-$WP_BRANCH/src/wp-content/plugins/$PLUGIN_SLUG"
cd /tmp/wordpress-$WP_BRANCH
cp wp-tests-config-sample.php wp-tests-config.php
sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere//" wp-tests-config.php
exit 0;