Skip to content
Snippets Groups Projects
Commit c38def5d authored by Erick Hitter's avatar Erick Hitter
Browse files

Merge branch 'master' into develop

parents 63fa0be8 aa217a9e
Branches
Tags
3 merge requests!6add linting,!5WIP: Add JUnit reporting,!4WIP: Initial release
Pipeline #142 failed
.DS_Store .DS_Store
phpcs.xml
phpunit.xml phpunit.xml
Thumbs.db Thumbs.db
wp-cli.local.yml wp-cli.local.yml
......
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: wordpress_tests
MYSQL_ROOT_PASSWORD: mysql
cache:
paths:
- $HOME/.composer
- /root/.composer
before_script:
# Set up WordPress tests
- bash bin/install-wp-tests.sh $MYSQL_DATABASE root $MYSQL_ROOT_PASSWORD mysql latest true
# PHPUnit
- |
if [[ $(php -v) =~ "PHP 7." ]]; then
composer global require "phpunit/phpunit=6.1.*"
else
composer global require "phpunit/phpunit=4.8.*"
fi
# Install PHPCS and WPCS
- composer global require automattic/vipwpcs
- phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs
PHPunit:PHP5.3:MySQL:
image: containers.ethitter.com:443/docker/images/php:5.3
services:
- mysql:5.6
script:
- phpcs -n
- phpunit
PHPunit:PHP5.6:MySQL:
image: containers.ethitter.com:443/docker/images/php:5.6
services:
- mysql:5.6
script:
- phpcs -n
- phpunit
PHPunit:PHP7.0:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.0
services:
- mysql:5.6
script:
- phpcs -n
- phpunit
PHPunit:PHP7.1:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.1
services:
- mysql:5.6
script:
- phpcs -n
- phpunit
PHPunit:PHP7.2:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.2
services:
- mysql:5.6
script:
- phpcs -n
- phpunit
...@@ -46,8 +46,8 @@ before_script: ...@@ -46,8 +46,8 @@ before_script:
fi fi
- | - |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
composer global require wp-coding-standards/wpcs composer global require automattic/vipwpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs
fi fi
script: script:
......
...@@ -95,7 +95,7 @@ install_wp() { ...@@ -95,7 +95,7 @@ install_wp() {
install_test_suite() { install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed # portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i .bak' local ioption='-i.bak'
else else
local ioption='-i' local ioption='-i'
fi fi
......
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>
<!--
Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps" />
<!-- Only check the PHP files. -->
<arg name="extensions" value="php" />
<!-- Check all files in this directory and the directories below it. -->
<file>.</file>
<!-- Exclude a few directories and autogenerated files. -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/</exclude-pattern>
<rule ref="WordPress" />
<rule ref="WordPressVIPMinimum" />
<!--<rule ref="WordPress-VIP-Go" />-->
<config name="minimum_supported_wp_version" value="4.9" />
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array" value="camo" />
</properties>
</rule>
</ruleset>
<?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>
...@@ -5,27 +5,29 @@ ...@@ -5,27 +5,29 @@
* @package Camo_Image_Proxy * @package Camo_Image_Proxy
*/ */
$_tests_dir = getenv( 'WP_TESTS_DIR' ); $camo_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) { if ( ! $camo_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; $camo_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
} }
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) { if ( ! file_exists( $camo_tests_dir . '/includes/functions.php' ) ) {
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // @codingStandardsIgnoreStart
echo "Could not find $camo_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
// @codingStandardsIgnoreEnd
exit( 1 ); exit( 1 );
} }
// Give access to tests_add_filter() function. // Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php'; require_once $camo_tests_dir . '/includes/functions.php';
/** /**
* Manually load the plugin being tested. * Manually load the plugin being tested.
*/ */
function _manually_load_plugin() { function camo_manually_load_plugin() {
require dirname( dirname( __FILE__ ) ) . '/camo-image-proxy.php'; require dirname( dirname( __FILE__ ) ) . '/camo-image-proxy.php';
} }
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); tests_add_filter( 'muplugins_loaded', 'camo_manually_load_plugin' );
// Start up the WP testing environment. // Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php'; require $camo_tests_dir . '/includes/bootstrap.php';
...@@ -13,7 +13,7 @@ class SampleTest extends WP_UnitTestCase { ...@@ -13,7 +13,7 @@ class SampleTest extends WP_UnitTestCase {
/** /**
* A single example test. * A single example test.
*/ */
function test_sample() { public function test_sample() {
// Replace this with some actual testing code. // Replace this with some actual testing code.
$this->assertTrue( true ); $this->assertTrue( true );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment