Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
10ef671
initial commit of unit tests
matgargano Sep 8, 2014
e85df9a
restructure original class to make it testable, hit 100% coverage* (w…
matgargano Sep 9, 2014
bd31aa6
fix copypasta issues with phpdoc in helper methods
matgargano Sep 12, 2014
20b01fb
set post key in superglobal
matgargano Sep 12, 2014
14b36d0
fix for test issues
matgargano Sep 12, 2014
400c144
update versions of wordpress to 3.8.4, 3.9.2, 4.0 and latest
matgargano Sep 12, 2014
019f3aa
Make the tests installer executable.
jeffstieler Sep 13, 2014
48eb2e5
Add trigger_error() testing from http://www.sitepoint.com/testing-err…
jeffstieler Sep 13, 2014
d4fc7b5
Add default for assertError using PHP’s default error number.
jeffstieler Sep 13, 2014
bf2f351
Remove trigger_error() wrapper and refactor test.
jeffstieler Sep 13, 2014
e773801
Move logic for adding theme support and attaching hooks into separate…
jeffstieler Sep 13, 2014
796d542
Remove all functions that simply wrap WP core functions.
jeffstieler Sep 13, 2014
63680e8
Don’t call (now nonexistent) WP core function wrappers.
jeffstieler Sep 13, 2014
a534699
Missed one call to a WP core function wrapper.
jeffstieler Sep 13, 2014
2621995
Separate argument parsing logic.
jeffstieler Sep 13, 2014
67c22e0
Having parse_arguments() logic separate from register() is difficult …
jeffstieler Sep 14, 2014
f08953f
Update test for register() call.
jeffstieler Sep 14, 2014
fc50613
Add directory whitelist for code coverage scoping/performance.
jeffstieler Sep 14, 2014
999d26b
Scope the register() test’s coverage.
jeffstieler Sep 14, 2014
4cd1be0
Fix dataProvider hookup for test_register().
jeffstieler Sep 14, 2014
5a1d3f1
Test trigger_registration_error()
jeffstieler Sep 14, 2014
6cd96e7
Just add the theme support in register(), add test for it.
jeffstieler Sep 14, 2014
6962f66
Code formatting in attach_hooks().
jeffstieler Sep 14, 2014
07f244e
Test attach_hooks().
jeffstieler Sep 14, 2014
6d3f270
add test for test_thumbnail_meta_box
matgargano Sep 15, 2014
004e340
keep test in scope
matgargano Sep 15, 2014
d7714ff
refactor class to use shell instance objects
matgargano Sep 15, 2014
cacf681
refactor class, update tests
matgargano Sep 16, 2014
4e32ba4
add backupGlobal/restoreGlobal methods in favor of global backupGlobals
matgargano Sep 16, 2014
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
svn
.DS_Store
node_modules
coverage
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: php

php:
- 5.3
- 5.4

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=1
- WP_VERSION=4.0 WP_MULTISITE=0
- WP_VERSION=4.0 WP_MULTISITE=1
- WP_VERSION=3.9.2 WP_MULTISITE=0
- WP_VERSION=3.9.2 WP_MULTISITE=1
- WP_VERSION=3.8.4 WP_MULTISITE=0
- WP_VERSION=3.8.4 WP_MULTISITE=1

before_script:
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION

script: phpunit
78 changes: 78 additions & 0 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
exit 1
fi

DB_NAME=$1
DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}

WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=/tmp/wordpress/

set -ex

install_wp() {
mkdir -p $WP_CORE_DIR

if [ $WP_VERSION == 'latest' ]; then
local ARCHIVE_NAME='latest'
else
local ARCHIVE_NAME="wordpress-$WP_VERSION"
fi

wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR

wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
}

install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i .bak'
else
local ioption='-i'
fi

# set up testing suite
mkdir -p $WP_TESTS_DIR
cd $WP_TESTS_DIR
svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/

wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php
sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php
sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php
}

install_db() {
# parse DB_HOST for port or socket references
local PARTS=(${DB_HOST//\:/ })
local DB_HOSTNAME=${PARTS[0]};
local DB_SOCK_OR_PORT=${PARTS[1]};
local EXTRA=""

if ! [ -z $DB_HOSTNAME ] ; then
if [[ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]] ; then
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
EXTRA=" --socket=$DB_SOCK_OR_PORT"
elif ! [ -z $DB_HOSTNAME ] ; then
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
fi
fi

# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
}

install_wp
install_test_suite
install_db
Loading