Skip to content

Commit 031f6c1

Browse files
committed
Travis again.
1 parent 61a1d5b commit 031f6c1

10 files changed

+105
-241
lines changed

.travis.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
1-
# Travis CI Configuration File
2-
3-
# Tell Travis CI we're using PHP
41
language: php
52

6-
# Versions of PHP to test against
73
php:
8-
- 5.2
94
- 5.3
105
- 5.4
116
- 5.5
127

13-
# Specify versions of WordPress to test against
14-
# WP_VERSION = WordPress version number (use "master" for SVN trunk)
15-
# WP_MULTISITE = whether to test multisite (use either "0" or "1")
168
env:
17-
- WP_VERSION=master WP_MULTISITE=0
18-
#- WP_VERSION=3.4.2 WP_MULTISITE=0
19-
#- WP_VERSION=3.3.3 WP_MULTISITE=0
20-
#- WP_VERSION=3.2.1 WP_MULTISITE=0
21-
- WP_VERSION=master WP_MULTISITE=1
22-
#- WP_VERSION=3.4.2 WP_MULTISITE=1
23-
#- WP_VERSION=3.3.3 WP_MULTISITE=1
24-
#- WP_VERSION=3.2.1 WP_MULTISITE=1
9+
- WP_VERSION=latest WP_MULTISITE=0
10+
- WP_VERSION=latest WP_MULTISITE=1
11+
#- WP_VERSION=3.6.1 WP_MULTISITE=0
12+
#- WP_VERSION=3.6.1 WP_MULTISITE=1
2513

26-
# Grab the setup script and execute
2714
before_script:
28-
- wget https://raw.github.com/tierra/wordpress-plugin-tests/setup/setup.sh
29-
- source setup.sh
15+
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
3016

3117
script: phpunit
3218

@@ -42,4 +28,5 @@ notifications:
4228
# Tells Travis CI not to run unit tests against the setup branch
4329
branches:
4430
except:
31+
- gh-pages
4532
- setup

bin/install-wp-tests.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
3+
if [ $# -lt 3 ]; then
4+
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
5+
exit 1
6+
fi
7+
8+
DB_NAME=$1
9+
DB_USER=$2
10+
DB_PASS=$3
11+
DB_HOST=${4-localhost}
12+
WP_VERSION=${5-master}
13+
14+
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
15+
WP_CORE_DIR=/tmp/wordpress/
16+
17+
set -ex
18+
19+
install_wp() {
20+
mkdir -p $WP_CORE_DIR
21+
22+
if [ $WP_VERSION == 'latest' ]; then
23+
local ARCHIVE_NAME='latest'
24+
else
25+
local ARCHIVE_NAME="wordpress-$WP_VERSION"
26+
fi
27+
28+
wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz
29+
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
30+
31+
wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
32+
}
33+
34+
install_test_suite() {
35+
# portable in-place argument for both GNU sed and Mac OSX sed
36+
if [[ $(uname -s) == 'Darwin' ]]; then
37+
local ioption='-i ""'
38+
else
39+
local ioption='-i'
40+
fi
41+
42+
# set up testing suite
43+
mkdir -p $WP_TESTS_DIR
44+
cd $WP_TESTS_DIR
45+
svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
46+
47+
wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
48+
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
49+
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php
50+
sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php
51+
sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
52+
sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php
53+
}
54+
55+
install_db() {
56+
# parse DB_HOST for port or socket references
57+
local PARTS=(${DB_HOST//\:/ })
58+
local DB_HOSTNAME=${PARTS[0]};
59+
local DB_SOCK_OR_PORT=${PARTS[1]};
60+
local EXTRA=""
61+
62+
if ! [ -z $DB_HOSTNAME ] ; then
63+
if [[ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]] ; then
64+
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
65+
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
66+
EXTRA=" --socket=$DB_SOCK_OR_PORT"
67+
elif ! [ -z $DB_HOSTNAME ] ; then
68+
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
69+
fi
70+
fi
71+
72+
# create database
73+
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
74+
}
75+
76+
install_wp
77+
install_test_suite
78+
install_db

phpunit.xml

100755100644
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<phpunit
2-
bootstrap="bootstrap_tests.php"
2+
bootstrap="tests/bootstrap.php"
33
backupGlobals="false"
44
colors="true"
5-
>
6-
<testsuites>
7-
<!-- Default test suite to run all tests -->
8-
<testsuite>
9-
<directory prefix="test_" suffix=".php">tests</directory>
10-
</testsuite>
11-
</testsuites>
12-
</phpunit>
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
>
9+
<testsuites>
10+
<testsuite>
11+
<directory prefix="test-" suffix=".php">./tests/</directory>
12+
</testsuite>
13+
</testsuites>
14+
</phpunit>

tests/README.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/includes/clover.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/includes/install.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/includes/unittests-config.travis.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/test-sample.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
class SampleTest extends WP_UnitTestCase {
4+
5+
function testSample() {
6+
// replace this with some actual testing code
7+
$this->assertTrue( true );
8+
}
9+
}
10+

tests/test_redux-framework.php

Lines changed: 0 additions & 64 deletions
This file was deleted.

tests/test_wordpress_plugin_tests.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)