@@ -18,11 +18,19 @@ WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
18
18
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR / wordpress/ }
19
19
20
20
download () {
21
- if [ ` which curl` ]; then
22
- curl -s " $1 " > " $2 " ;
23
- elif [ ` which wget` ]; then
24
- wget -nv -O " $2 " " $1 "
25
- fi
21
+ if [ ` which curl` ]; then
22
+ curl -s " $1 " > " $2 " ;
23
+ elif [ ` which wget` ]; then
24
+ wget -nv -O " $2 " " $1 "
25
+ fi
26
+ }
27
+
28
+ # Check if git is installed
29
+ check_git_installed () {
30
+ if ! command -v git > /dev/null; then
31
+ echo " Error: git is not installed. Please install git and try again."
32
+ exit 1
33
+ fi
26
34
}
27
35
28
36
if [[ $WP_VERSION =~ ^[0-9]+\. [0-9]+$ ]]; then
@@ -35,6 +43,7 @@ elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
35
43
WP_TESTS_TAG=" tags/$WP_VERSION "
36
44
fi
37
45
elif [[ $WP_VERSION == ' nightly' || $WP_VERSION == ' trunk' ]]; then
46
+ WP_BRANCH=" trunk"
38
47
WP_TESTS_TAG=" trunk"
39
48
else
40
49
# http serves a single offer, whereas https serves multiple. we only want one
45
54
echo " Latest WordPress version could not be found"
46
55
exit 1
47
56
fi
57
+ WP_BRANCH=$LATEST_VERSION
48
58
WP_TESTS_TAG=" tags/$LATEST_VERSION "
49
59
fi
50
60
@@ -104,12 +114,16 @@ install_test_suite() {
104
114
if [ ! -d $WP_TESTS_DIR ]; then
105
115
# set up testing suite
106
116
mkdir -p $WP_TESTS_DIR
107
- svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG} /tests/phpunit/includes/ $WP_TESTS_DIR /includes
108
- svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG} /tests/phpunit/data/ $WP_TESTS_DIR /data
117
+ check_git_installed
118
+ git clone --depth 1 --branch $WP_BRANCH https://github.com/wordpress/wordpress-develop $TMPDIR /wordpress-develop
119
+ rm -r $TMPDIR /wordpress-develop/.git
120
+ mv $TMPDIR /wordpress-develop/tests/phpunit/includes/ $WP_TESTS_DIR /includes
121
+ mv $TMPDIR /wordpress-develop/tests/phpunit/data/ $WP_TESTS_DIR /data
122
+ rm -r $TMPDIR /wordpress-develop
109
123
fi
110
124
111
125
if [ ! -f wp-tests-config.php ]; then
112
- download https://develop.svn. wordpress.org/ ${WP_TESTS_TAG } /wp-tests-config-sample.php " $WP_TESTS_DIR " /wp-tests-config.php
126
+ download https://raw.githubusercontent.com/ wordpress/wordpress-develop/ ${WP_BRANCH } /wp-tests-config-sample.php " $WP_TESTS_DIR " /wp-tests-config.php
113
127
# remove all forward slashes in the end
114
128
WP_CORE_DIR=$( echo $WP_CORE_DIR | sed " s:/\+$::" )
115
129
sed $ioption " s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR /':" " $WP_TESTS_DIR " /wp-tests-config.php
@@ -144,12 +158,12 @@ install_db() {
144
158
fi
145
159
146
160
# create database
147
- if [ -z $DB_PASS ] ; then
148
- echo ' No DB password'
149
- mysqladmin create $DB_NAME --user=" $DB_USER " $EXTRA
150
- else
151
- mysqladmin create $DB_NAME --user=" $DB_USER " --password=" $DB_PASS " $EXTRA
152
- fi
161
+ if [ -z $DB_PASS ] ; then
162
+ echo ' No DB password'
163
+ mysqladmin create $DB_NAME --user=" $DB_USER " $EXTRA
164
+ else
165
+ mysqladmin create $DB_NAME --user=" $DB_USER " --password=" $DB_PASS " $EXTRA
166
+ fi
153
167
}
154
168
155
169
install_wp
0 commit comments