-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating .gitignore and .distignore files
- Loading branch information
1 parent
0e9851e
commit e398d22
Showing
8 changed files
with
164 additions
and
3 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,3 +1,8 @@ | ||
/bin | ||
/tests | ||
.git | ||
.gitignore | ||
.idea | ||
.idea | ||
travis.yml | ||
phpcs.xml.dist | ||
phpunit.xml.dist |
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,3 +1,4 @@ | ||
.bin | ||
.idea | ||
*.iml | ||
.gitignore |
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,67 @@ | ||
|
||
language: php | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
matrix: | ||
include: | ||
- php: 7.1 | ||
env: WP_VERSION=latest | ||
- php: 7.0 | ||
env: WP_VERSION=latest | ||
- php: 5.6 | ||
env: WP_VERSION=4.4 | ||
- php: 5.6 | ||
env: WP_VERSION=latest | ||
- php: 5.6 | ||
env: WP_VERSION=trunk | ||
- php: 5.6 | ||
env: WP_TRAVISCI=phpcs | ||
- php: 5.3 | ||
env: WP_VERSION=latest | ||
|
||
before_script: | ||
- export PATH="$HOME/.composer/vendor/bin:$PATH" | ||
- | | ||
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then | ||
phpenv config-rm xdebug.ini | ||
else | ||
echo "xdebug.ini does not exist" | ||
fi | ||
- | | ||
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: | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
phpunit | ||
WP_MULTISITE=1 phpunit | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
phpcs | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?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" /> | ||
|
||
<!-- Check all PHP files in directory tree by default. --> | ||
<arg name="extensions" value="php"/> | ||
<file>.</file> | ||
|
||
<!-- Show progress and sniff codes in all reports --> | ||
<arg value="ps"/> | ||
|
||
<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 |
---|---|---|
@@ -0,0 +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> | ||
</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
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,30 @@ | ||
<?php | ||
/** | ||
* PHPUnit bootstrap file | ||
* | ||
* @package Seriously_Simple_Stats | ||
*/ | ||
|
||
$_tests_dir = getenv( 'WP_TESTS_DIR' ); | ||
|
||
if ( ! $_tests_dir ) { | ||
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; | ||
} | ||
|
||
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) { | ||
throw new Exception( "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" ); | ||
} | ||
|
||
// 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( dirname( __FILE__ ) ) . '/seriously-simple-stats.php'; | ||
} | ||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); | ||
|
||
// 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,26 @@ | ||
<?php | ||
/** | ||
* Class FunctionsTest | ||
* | ||
* Used to test all generic functions | ||
* | ||
* @package Seriously_Simple_Stats | ||
*/ | ||
|
||
/** | ||
* Sample test case. | ||
*/ | ||
class FunctionsTest extends WP_UnitTestCase { | ||
|
||
/** | ||
* A single example test. | ||
*/ | ||
public function test_ss_stats_anonymise_ip() { | ||
$ip = '192.168.0.233'; | ||
$new_ip = ss_stats_anonymise_ip( $ip ); | ||
// check that the string still resembles an ip address | ||
$this->assertStringMatchesFormat( '%x.%x.%x.%x', $new_ip, 'The address does not match a valid ip address format.' ); | ||
// assert that the string ends with .0 | ||
$this->assertStringEndsWith( '.0', $new_ip, 'The address does not end with a zero.' ); | ||
} | ||
} |