-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,56 @@ | ||
sudo: false | ||
|
||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 7.1 | ||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
env: | ||
- WP_VERSION=latest WP_MULTISITE=0 | ||
- WP_VERSION=latest WP_MULTISITE=1 | ||
- WP_VERSION=4.4 WP_MULTISITE=0 | ||
- WP_VERSION=4.4 WP_MULTISITE=1 | ||
matrix: | ||
include: | ||
- php: 7.1 | ||
env: WP_VERSION=latest | ||
- php: 7.1 | ||
env: WP_VERSION=4.4 | ||
- php: 5.3 | ||
env: WP_VERSION=latest | ||
- php: 5.3 | ||
env: WP_VERSION=4.4 | ||
|
||
before_script: | ||
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION | ||
- export PATH="$HOME/.composer/vendor/bin:$PATH" | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION | ||
if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then | ||
composer global require "phpunit/phpunit=4.8.*" | ||
else | ||
composer global require "phpunit/phpunit=5.7.*" | ||
fi | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
composer global require wp-coding-standards/wpcs | ||
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs | ||
fi | ||
script: phpunit | ||
script: | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
phpunit | ||
WP_MULTISITE=1 phpunit | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php') | ||
fi |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WordPress Coding Standards for Plugins"> | ||
<description>Generally-applicable sniffs for WordPress plugins</description> | ||
|
||
<rule ref="WordPress-Core" /> | ||
<rule ref="WordPress-Docs" /> | ||
|
||
<exclude-pattern>*/node_modules/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
</ruleset> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<phpunit | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
> | ||
<testsuites> | ||
<testsuite> | ||
<directory prefix="test-" suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
> | ||
<testsuites> | ||
<testsuite> | ||
<directory prefix="test-" suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
<?php | ||
/** | ||
* PHPUnit bootstrap file | ||
* | ||
* @package Safe_Redirect_Manager | ||
*/ | ||
|
||
$_tests_dir = getenv( 'WP_TESTS_DIR' ); | ||
if ( ! $_tests_dir ) { | ||
$_tests_dir = '/tmp/wordpress-tests-lib'; | ||
} | ||
|
||
define( 'PHPUNIT_SRM_TESTSUITE', 1 ); | ||
define( 'PHPUNIT_SRM_TESTSUITE', true ); | ||
|
||
require_once( $_tests_dir . '/includes/functions.php' ); | ||
// Give access to tests_add_filter() function. | ||
require_once $_tests_dir . '/includes/functions.php'; | ||
|
||
/** | ||
* Manually load the plugin being tested. | ||
*/ | ||
function _manually_load_plugin() { | ||
require dirname( __FILE__ ) . '/../safe-redirect-manager.php'; | ||
require dirname( dirname( __FILE__ ) ) . '/safe-redirect-manager.php'; | ||
} | ||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); | ||
|
||
require( $_tests_dir . '/includes/bootstrap.php' ); | ||
|
||
// Start up the WP testing environment. | ||
require $_tests_dir . '/includes/bootstrap.php'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Class SampleTest | ||
* | ||
* @package Safe_Redirect_Manager | ||
*/ | ||
|
||
/** | ||
* Sample test case. | ||
*/ | ||
class SampleTest extends WP_UnitTestCase { | ||
|
||
/** | ||
* A single example test. | ||
*/ | ||
function test_sample() { | ||
// Replace this with some actual testing code. | ||
$this->assertTrue( true ); | ||
} | ||
} |