Last active
November 10, 2017 20:08
-
-
Save ErnieAtLYD/ffae6db194639efc9934e49f38f46cab to your computer and use it in GitHub Desktop.
Getting WordPress Unit Tests working through CodeShip Basic (as of November 2017)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
phpenv local 7.0 | |
composer install --prefer-dist --no-interaction | |
curl -s "https://wordpress.org/latest.tar.gz" > "/tmp/wordpress.tar.gz" | |
mkdir -p /tmp/wordpress | |
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C /tmp/wordpress/ | |
curl -s "https://raw.github.com/markoheijnen/wp-mysqli/master/db.php" > "/tmp/wordpress/wp-content/db.php" | |
mkdir -p /tmp/wordpress-tests-lib | |
svn co --quiet https://develop.svn.wordpress.org/tags/4.8.3/tests/phpunit/includes/ /tmp/wordpress-tests-lib/includes | |
svn co --quiet https://develop.svn.wordpress.org/tags/4.8.3/tests/phpunit/data/ /tmp/wordpress-tests-lib/data | |
curl -s "https://develop.svn.wordpress.org/tags/4.8.3/wp-tests-config-sample.php" > "/tmp/wordpress-tests-lib/wp-tests-config.php" | |
sed -i "s:dirname( __FILE__ ) . '/src/':'/tmp/wordpress/':" /tmp/wordpress-tests-lib/wp-tests-config.php | |
sed -i "s/youremptytestdbnamehere/test/" /tmp/wordpress-tests-lib/wp-tests-config.php | |
sed -i "s/yourusernamehere/$MYSQL_USER/" /tmp/wordpress-tests-lib/wp-tests-config.php | |
sed -i "s/yourpasswordhere/$MYSQL_PASSWORD/" /tmp/wordpress-tests-lib/wp-tests-config.php | |
sed -i "s|localhost|${DB_HOST}|" /tmp/wordpress-tests-lib/wp-tests-config.php | |
# No need to create a database, because MySQL 5.6 is already part of Codeship Basic PHP. | |
# Reminder: on CodeShip they name their test DB... wait for it... test. | |
# mysql -e 'CREATE DATABASE test;' | |
# mysqladmin create test --user="$MYSQL_USER" --password="$MYSQL_PASSWORD" --host=localhost --protocol=tcp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vendor/bin/phpunit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment