diff --git a/.coveralls.yml b/.coveralls.yml new file mode 120000 index 0000000..566a7e4 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1 @@ +dev-lib/travis/.coveralls.yml \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a725465..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 120000 index 0000000..a3e53f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dev-lib/git/.gitignore \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e366f9f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "dev-lib"] + path = dev-lib + url = https://github.com/WordPoints/dev-lib.git diff --git a/.jshintignore b/.jshintignore new file mode 120000 index 0000000..09843c3 --- /dev/null +++ b/.jshintignore @@ -0,0 +1 @@ +dev-lib/jshint/.jshintignore \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 120000 index 0000000..a38fb1b --- /dev/null +++ b/.jshintrc @@ -0,0 +1 @@ +dev-lib/jshint/.jshintrc \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..21bf43f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,73 @@ +# Travis CI configuration file for a WordPoints module. + +language: php + +# 5.3 runs first so that we can fail fast on the codesniff pass (see below). +php: + - 5.3 + - 5.2 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + +env: + - TRAVISCI_RUN=codesniff + - TRAVISCI_RUN=phpunit WP_VERSION=master WORDPOINTS_VERSION=master WC_VERSION=2.6.4 + - TRAVISCI_RUN=phpunit WP_VERSION=4.5 WORDPOINTS_VERSION=master WC_VERSION=2.6.4 + - TRAVISCI_RUN=phpunit WP_VERSION=4.4 WORDPOINTS_VERSION=master WC_VERSION=2.6.4 + +sudo: false + +matrix: + include: + # Only run HHVM against trunk for now. + - php: hhvm + env: TRAVISCI_RUN=phpunit WP_VERSION=master WC_VERSION=2.6.4 + # Only run nightly against trunk. + - php: nightly + env: TRAVISCI_RUN=phpunit WP_VERSION=master WC_VERSION=2.6.4 + exclude: + # The codesniff pass only needs to be run once, I chose PHP 5.3, since WPCS requires it. + - php: 5.2 + env: TRAVISCI_RUN=codesniff + - php: 5.4 + env: TRAVISCI_RUN=codesniff + - php: 5.5 + env: TRAVISCI_RUN=codesniff + - php: 5.6 + env: TRAVISCI_RUN=codesniff + - php: 7.0 + env: TRAVISCI_RUN=codesniff + allow_failures: + - php: hhvm + - php: nightly + fast_finish: true + +before_script: + - export WORDPOINTS_PROJECT_TYPE=module + - export DEV_LIB_PATH=dev-lib + - if [ -e .wordpoints-dev-lib-config.sh ]; then source .wordpoints-dev-lib-config.sh; fi + - source $DEV_LIB_PATH/travis/before_script.sh + +script: + - codesniff-php-syntax + - codesniff-php-autoloaders + - codesniff-phpcs + - codesniff-jshint + - codesniff-l10n + - codesniff-xmllint + - codesniff-bash + - codesniff-symlinks + - phpunit-basic + - phpunit-ms + - phpunit-ms-network + - phpunit-uninstall + - phpunit-ms-uninstall + - phpunit-ms-network-uninstall + - phpunit-ajax + - phpunit-ms-ajax + - phpunit-ms-network-ajax + +after_script: + - source $DEV_LIB_PATH/travis/after_script.sh diff --git a/.wordpoints-dev-lib-config.sh b/.wordpoints-dev-lib-config.sh new file mode 100644 index 0000000..65c0326 --- /dev/null +++ b/.wordpoints-dev-lib-config.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e +shopt -s expand_aliases + +# Install WooCommerce when running tests. +install-woocommerce() { + + mkdir /tmp/woocommerce + + curl -L "https://github.com/woothemes/woocommerce/archive/${WC_VERSION}.tar.gz" \ + | tar xvz --strip-components=1 -C /tmp/woocommerce + + mv /tmp/woocommerce /tmp/wordpress/src/wp-content/plugins/woocommerce +} + +# Sets up custom configuration. +function wordpoints-dev-lib-config() { + + alias setup-phpunit="\setup-phpunit; install-woocommerce" +} + +set +e + +# EOF diff --git a/.wp-l10n-validator-cache.json b/.wp-l10n-validator-cache.json new file mode 100644 index 0000000..7b2535f --- /dev/null +++ b/.wp-l10n-validator-cache.json @@ -0,0 +1,40 @@ +{ + "files": { + "\/components\/points\/includes\/functions.php": { + "size": 1634, + "hash": "268e6793315b680fbdb33bc00ee9ca31", + "errors": false + }, + "\/components\/points\/includes\/gateways\/points.php": { + "size": 6250, + "hash": "ea3dd18ff0de80df7d129dac4e987b2a", + "errors": false + }, + "\/components\/points\/points.php": { + "size": 494, + "hash": "5d7c235bbb9fc10e4e85fc64f1211651", + "errors": false + }, + "\/includes\/class-un-installer.php": { + "size": 526, + "hash": "3fafcdde71acee86a0be045db47bc446", + "errors": false + }, + "\/includes\/constants.php": { + "size": 449, + "hash": "cd895286efb36fff138393ba52ac61f9", + "errors": false + }, + "\/includes\/functions.php": { + "size": 899, + "hash": "e3862371baeae43c74ecc2ff489613f6", + "errors": false + }, + "\/woocommerce.php": { + "size": 1191, + "hash": "a14114c7cdf4aa604cadb6f93793548d", + "errors": false + } + }, + "config_signature": "59e021655228772535dbe74b7e705298" +} \ No newline at end of file diff --git a/tools/wp-l10n-validator/ignores-cache.json b/.wp-l10n-validator-ignores-cache.json similarity index 72% rename from tools/wp-l10n-validator/ignores-cache.json rename to .wp-l10n-validator-ignores-cache.json index f7dabb0..61241fb 100644 --- a/tools/wp-l10n-validator/ignores-cache.json +++ b/.wp-l10n-validator-ignores-cache.json @@ -37,13 +37,6 @@ } }, "text": { - "105": { - "name": "array", - "type": "unknown", - "args_started": true, - "arg_count": 1, - "parentheses": 1 - }, "112": { "name": "array", "type": "unknown", @@ -53,13 +46,6 @@ } }, "select": { - "119": { - "name": "array", - "type": "unknown", - "args_started": true, - "arg_count": 1, - "parentheses": 1 - }, "127": { "name": "array", "type": "unknown", @@ -78,7 +64,7 @@ } }, "success": { - "197": { + "195": { "name": "array", "type": "unknown", "args_started": true, @@ -87,15 +73,12 @@ } } }, - "\/includes\/functions.php": { - "wordpoints-woocommerce": { - "37": { - "name": "wordpoints_load_module_textdomain", - "type": "unknown", - "args_started": true, - "arg_count": 0, - "parentheses": 1 - } + "\/includes\/class-un-installer.php": { + "module": { + "20": false + }, + "WordPoints_WooCommerce_Un_Installer": { + "34": false } } } \ No newline at end of file diff --git a/composer.json b/composer.json index 26dcd23..b08759d 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,6 @@ "php": ">=5.2.0" }, "require-dev": { - "wordpoints/module-uninstall-tester": "~0.2", - "wordpoints/l10n-validator-config": "~1.0" + "wordpoints/module-uninstall-tester": "^0.4" } } diff --git a/composer.lock b/composer.lock index 74a82a5..c0a14a6 100644 --- a/composer.lock +++ b/composer.lock @@ -1,23 +1,25 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], - "hash": "89f08abd0343b2e122afb90a061e80c2", + "hash": "dc6f918e9d143c42cf9766d970e39413", + "content-hash": "eac14eea3f515db30a49264ca17ebb02", "packages": [], "packages-dev": [ { "name": "jdgrimes/wp-plugin-uninstall-tester", - "version": "0.4.2", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/JDGrimes/wp-plugin-uninstall-tester.git", - "reference": "ee09116b088115919b1b81fcff19f74da6e5833e" + "reference": "99e9c16ded11150f21a7a78a472997c2a0c59fb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JDGrimes/wp-plugin-uninstall-tester/zipball/ee09116b088115919b1b81fcff19f74da6e5833e", - "reference": "ee09116b088115919b1b81fcff19f74da6e5833e", + "url": "https://api.github.com/repos/JDGrimes/wp-plugin-uninstall-tester/zipball/99e9c16ded11150f21a7a78a472997c2a0c59fb2", + "reference": "99e9c16ded11150f21a7a78a472997c2a0c59fb2", "shasum": "" }, "require": { @@ -38,46 +40,24 @@ ], "description": "Utilities for testing WordPress plugin install/uninstall with PHPUnit", "homepage": "https://github.com/JDGrimes/wp-plugin-uninstall-tester", - "time": "2014-11-25 14:47:10" - }, - { - "name": "wordpoints/l10n-validator-config", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/WordPoints/l10n-validator-config.git", - "reference": "b5083fb51c17e3626b8f0279ff920d38f587971b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WordPoints/l10n-validator-config/zipball/b5083fb51c17e3626b8f0279ff920d38f587971b", - "reference": "b5083fb51c17e3626b8f0279ff920d38f587971b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "description": "WordPoints-specific configuration for https://github.com/JDGrimes/wp-l10n-validator", - "time": "2015-01-07 22:32:10" + "time": "2016-06-30 19:28:49" }, { "name": "wordpoints/module-uninstall-tester", - "version": "0.2.2", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/WordPoints/module-uninstall-tester.git", - "reference": "1470fdee74c738403415aee51cc319b651d33b1a" + "reference": "3702d007ff7d2f8d0ad62a41de7e1e4dbaeab5c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPoints/module-uninstall-tester/zipball/1470fdee74c738403415aee51cc319b651d33b1a", - "reference": "1470fdee74c738403415aee51cc319b651d33b1a", + "url": "https://api.github.com/repos/WordPoints/module-uninstall-tester/zipball/3702d007ff7d2f8d0ad62a41de7e1e4dbaeab5c4", + "reference": "3702d007ff7d2f8d0ad62a41de7e1e4dbaeab5c4", "shasum": "" }, "require": { - "jdgrimes/wp-plugin-uninstall-tester": "~0.2", + "jdgrimes/wp-plugin-uninstall-tester": "^0.6", "php": ">=5.2.0" }, "type": "library", @@ -95,12 +75,14 @@ ], "description": "Utilities for testing WordPoints module install/uninstall with PHPUnit", "homepage": "https://github.com/WordPoints/wordpoints-module-uninstall-tester", - "time": "2015-01-02 15:22:16" + "time": "2016-07-27 20:28:04" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.2.0" }, diff --git a/dev-lib b/dev-lib new file mode 160000 index 0000000..31c8cd5 --- /dev/null +++ b/dev-lib @@ -0,0 +1 @@ +Subproject commit 31c8cd50b8d95dacf4b262c4c1c11eb5c382deb4 diff --git a/phpcs.ruleset.xml b/phpcs.ruleset.xml new file mode 120000 index 0000000..a792581 --- /dev/null +++ b/phpcs.ruleset.xml @@ -0,0 +1 @@ +dev-lib/phpcs/WordPoints/ruleset.xml \ No newline at end of file diff --git a/src/components/points/includes/gateways/points.php b/src/components/points/includes/gateways/points.php index b6a66b1..f8924f8 100644 --- a/src/components/points/includes/gateways/points.php +++ b/src/components/points/includes/gateways/points.php @@ -55,7 +55,7 @@ public function __construct() { * * @return bool Whether the gateway is enabled. */ - function is_valid_for_use() { + public function is_valid_for_use() { if ( ! wordpoints_get_points_types() ) { return false; @@ -98,7 +98,7 @@ public function init_form_fields() { 'title' => __( 'Enable/Disable', 'wordpoints-woocommerce' ), 'type' => 'checkbox', 'label' => __( 'Enable WordPoints points', 'wordpoints-woocommerce' ), - 'default' => 'yes' + 'default' => 'yes', ), 'title' => array( 'title' => _x( 'Title', 'form label', 'wordpoints-woocommerce' ), @@ -139,8 +139,6 @@ public function init_form_fields() { /** * Process the payment and return the result. * - * @param int $order_id - * * @return array */ public function process_payment( $order_id ) { @@ -157,10 +155,10 @@ public function process_payment( $order_id ) { wc_add_notice( __( 'Payment error:', 'wordpoints-woocommerce' ) . ' ' - . __( - 'You have insufficient points to make this purchase.' - , 'wordpoints-woocommerce' - ) + . __( + 'You have insufficient points to make this purchase.' + , 'wordpoints-woocommerce' + ) , 'error' ); @@ -179,10 +177,10 @@ public function process_payment( $order_id ) { wc_add_notice( __( 'Payment error:', 'wordpoints-woocommerce' ) . ' ' - . __( - 'Unable to subtract the points from your account.' - , 'wordpoints-woocommerce' - ) + . __( + 'Unable to subtract the points from your account.' + , 'wordpoints-woocommerce' + ) , 'error' ); @@ -202,10 +200,6 @@ public function process_payment( $order_id ) { /** * Process a refund if supported. * - * @param int $order_id - * @param float $amount - * @param string $reason - * * @return bool|wp_error True or false based on success, or a WP_Error object */ public function process_refund( $order_id, $amount = null, $reason = '' ) { diff --git a/src/includes/class-un-installer.php b/src/includes/class-un-installer.php new file mode 100644 index 0000000..dda60c4 --- /dev/null +++ b/src/includes/class-un-installer.php @@ -0,0 +1,36 @@ + array( + 'points_hooks' => array( + 'wordpoints_wc_order_complete_points_hook', + ), + ), + ); +} + +return 'WordPoints_WooCommerce_Un_Installer'; + +// EOF diff --git a/src/includes/constants.php b/src/includes/constants.php index 7999bf9..6f21f5b 100644 --- a/src/includes/constants.php +++ b/src/includes/constants.php @@ -14,7 +14,7 @@ * * @type string WORDPOINTS_WOOCOMMERCE_VERSION */ -define( 'WORDPOINTS_WOOCOMMERCE_VERSION', '1.0.1' ); +define( 'WORDPOINTS_WOOCOMMERCE_VERSION', '1.0.2' ); /** * The full path to the module's main directory. diff --git a/src/includes/functions.php b/src/includes/functions.php index 977df69..c862f65 100644 --- a/src/includes/functions.php +++ b/src/includes/functions.php @@ -11,33 +11,32 @@ * Install the module. * * @since 1.0.0 + * @deprecated 1.0.2 Use WordPoints_Installables::install( 'module', 'woocommerce' ) + * instead. */ function wordpoints_woocommerce_install() { - $wordpoints_data = wordpoints_get_network_option( 'wordpoints_data' ); + _deprecated_function( __FUNCTION__, '1.0.2', 'WordPoints_Installables::install' ); - if ( ! isset( $wordpoints_data['modules']['woocommerce']['version'] ) ) { - $wordpoints_data['modules']['woocommerce']['version'] = WORDPOINTS_WOOCOMMERCE_VERSION; - wordpoints_update_network_option( 'wordpoints_data', $wordpoints_data ); - } + WordPoints_Installables::install( 'module', 'woocommerce' ); } -wordpoints_register_module_activation_hook( - WORDPOINTS_WOOCOMMERCE_DIR . '/wordpoints-woocommerce.php' - , 'wordpoints_woocommerce_install' -); /** * Load the module's text domain. * + * No longer needed as this is done automatically by WordPoints_Modules::register(). + * * @since 1.0.0 + * @deprecated 1.0.2 */ function wordpoints_woocommerce_load_textdomain() { + _deprecated_function( __FUNCTION__, '1.0.2' ); + wordpoints_load_module_textdomain( 'wordpoints-woocommerce' , wordpoints_module_basename( WORDPOINTS_WOOCOMMERCE_DIR ) . '/languages' ); } -add_action( 'wordpoints_modules_loaded', 'wordpoints_woocommerce_load_textdomain' ); // EOF diff --git a/src/languages/wordpoints-woocommerce.pot b/src/languages/wordpoints-woocommerce.pot index abbc48a..c244d7b 100644 --- a/src/languages/wordpoints-woocommerce.pot +++ b/src/languages/wordpoints-woocommerce.pot @@ -1,14 +1,14 @@ -# Copyright (C) 2015 J.D. Grimes +# Copyright (C) 2016 J.D. Grimes # This file is distributed under the same license as the WordPoints WooCommerce package. msgid "" msgstr "" -"Project-Id-Version: WordPoints WooCommerce 1.0.0\n" +"Project-Id-Version: WordPoints WooCommerce 1.0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-08 21:29:13+00:00\n" +"POT-Creation-Date: 2016-08-09 14:42:33+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -114,20 +114,20 @@ msgstr "" msgid "1 point is worth 0.01 monetary units" msgstr "" -#: components/points/includes/gateways/points.php:159 -#: components/points/includes/gateways/points.php:181 +#: components/points/includes/gateways/points.php:157 +#: components/points/includes/gateways/points.php:179 msgid "Payment error:" msgstr "" -#: components/points/includes/gateways/points.php:160 +#: components/points/includes/gateways/points.php:158 msgid "You have insufficient points to make this purchase." msgstr "" -#: components/points/includes/gateways/points.php:182 +#: components/points/includes/gateways/points.php:180 msgid "Unable to subtract the points from your account." msgstr "" -#: components/points/includes/gateways/points.php:234 +#: components/points/includes/gateways/points.php:228 msgid "Refunded %s points." msgstr "" diff --git a/src/uninstall.php b/src/uninstall.php deleted file mode 100644 index 6f8b095..0000000 --- a/src/uninstall.php +++ /dev/null @@ -1,20 +0,0 @@ - */ +WordPoints_Modules::register( + ' + Module Name: WooCommerce + Author: J.D. Grimes + Author URI: http://codesymphony.co/ + Version: 1.0.2 + Description: Let your users pay with points. + Text Domain: wordpoints-woocommerce + Domain Path: /languages + ID: 445 + Channel: wordpoints.org + ' + , __FILE__ +); + /** * The module's constants. * diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php index 6860db6..8ac394e 100644 --- a/tests/phpunit/includes/bootstrap.php +++ b/tests/phpunit/includes/bootstrap.php @@ -30,7 +30,7 @@ * * @since 1.0.0 */ -require_once getenv( 'WP_TESTS_DIR' ) . 'includes/functions.php'; +require_once getenv( 'WP_TESTS_DIR' ) . '/includes/functions.php'; /** * The module's utilitiy functions for the tests. @@ -69,7 +69,7 @@ * * @since 1.0.0 */ -require_once getenv( 'WORDPOINTS_TESTS_DIR' ) . 'includes/bootstrap.php'; +require_once getenv( 'WORDPOINTS_TESTS_DIR' ) . '/includes/bootstrap.php'; /** The plugin uninstall tester functions. */ require_once WORDPOINTS_WC_TESTS_DIR . '/../../vendor/jdgrimes/wp-plugin-uninstall-tester/bootstrap.php'; diff --git a/tests/phpunit/includes/factories/order.php b/tests/phpunit/includes/factories/order.php index 9755612..f2fdcd6 100644 --- a/tests/phpunit/includes/factories/order.php +++ b/tests/phpunit/includes/factories/order.php @@ -80,11 +80,11 @@ public function get_object_by_id( $order_id ) { */ public function create_object( $args ) { - $order = wc_create_order( $args ); + $order = wc_create_order( $args ); - if ( is_wp_error( $order ) ) { - return $order; - } + if ( is_wp_error( $order ) ) { + return $order; + } $default_args = array( 'billing_address' => $this->default_adress, diff --git a/tests/phpunit/includes/functions.php b/tests/phpunit/includes/functions.php index 4193594..03e914a 100644 --- a/tests/phpunit/includes/functions.php +++ b/tests/phpunit/includes/functions.php @@ -28,17 +28,23 @@ function wordpoints_wc_tests_manually_load_woocommerce() { global $wpdb; $wpdb->query( - ' - SELECT CONCAT( "DROP TABLE ", GROUP_CONCAT( CONCAT( table_schema, ".", table_name ) ), ";" ) - INTO @dropcmd - FROM information_schema.tables - WHERE table_schema = database() - AND table_name LIKE "' . esc_sql( $wpdb->esc_like( $wpdb->base_prefix . 'woocommerce_' ) ) . '%" - ' + $wpdb->prepare( + ' + SELECT CONCAT( "DROP TABLE ", GROUP_CONCAT( CONCAT( table_schema, ".", table_name ) ), ";" ) + INTO @dropcmd + FROM information_schema.tables + WHERE table_schema = database() + AND table_name LIKE %s + ' + , $wpdb->esc_like( $wpdb->base_prefix . 'woocommerce_' ) . '%' + ) ); - $wpdb->query( 'PREPARE s1 FROM @dropcmd' ); - $wpdb->query( 'EXECUTE s1' ); - $wpdb->query( 'DEALLOCATE PREPARE s1' ); + + if ( $wpdb->get_var( 'SELECT @dropcmd' ) ) { + $wpdb->query( 'PREPARE s1 FROM @dropcmd' ); + $wpdb->query( 'EXECUTE s1' ); + $wpdb->query( 'DEALLOCATE PREPARE s1' ); + } $config_file_path = getenv( 'WP_TESTS_DIR' ); diff --git a/tests/phpunit/tests/points/gateways/points.php b/tests/phpunit/tests/points/gateways/points.php index 910e5f6..7883a74 100644 --- a/tests/phpunit/tests/points/gateways/points.php +++ b/tests/phpunit/tests/points/gateways/points.php @@ -48,7 +48,7 @@ public function setUp() { $this->original_user_id = get_current_user_id(); wp_set_current_user( $this->factory->user->create() ); - wordpoints_update_network_option( + wordpoints_update_maybe_network_option( 'wordpoints_default_points_type' , 'points' ); @@ -184,7 +184,7 @@ public function test_refund() { * * @since 1.0.0 * - * @throws Exception + * @throws Exception An exception. */ public function throw_exception() { throw new Exception( __CLASS__ ); @@ -227,11 +227,11 @@ public function no_commit_queries( $query ) { protected function simulate_checkout( array $args = array() ) { // Add items to the cart. - WC()->cart->add_to_cart( $this->factory->product->create() ); + WC()->cart->add_to_cart( $this->factory->product->create() ); - $_POST['_wpnonce'] = wp_create_nonce( 'woocommerce-process_checkout' ); + $_POST['_wpnonce'] = wp_create_nonce( 'woocommerce-process_checkout' ); $_POST['terms'] = 1; - $_POST['payment_method'] = 'wordpoints_points'; + $_POST['payment_method'] = 'wordpoints_points'; $_POST['billing_country'] = 'US'; $_POST['billing_first_name'] = 'Joe'; $_POST['billing_last_name'] = 'Tester'; @@ -275,9 +275,7 @@ protected function simulate_checkout( array $args = array() ) { } $this->assertEquals( - '' + '' , trim( $messages ) ); } diff --git a/tests/phpunit/tests/uninstall.php b/tests/phpunit/tests/uninstall.php index bdf2512..c8e0398 100644 --- a/tests/phpunit/tests/uninstall.php +++ b/tests/phpunit/tests/uninstall.php @@ -22,22 +22,9 @@ class WordPoints_WooCommerce_Uninstall_Test // /** - * The full path to the main module file. - * - * @since 1.0.0 - * - * @type string $module_file - */ - protected $module_file; - - /** - * The module's install function. - * * @since 1.0.0 - * - * @type callable $install_function */ - protected $install_function = 'wordpoints_woocommerce_install'; + protected $module_file = 'woocommerce/woocommerce.php'; /** * Whether the tests are being run with the module is network-activated. @@ -59,25 +46,11 @@ class WordPoints_WooCommerce_Uninstall_Test */ public function setUp() { - $this->module_file = WORDPOINTS_WC_TESTS_DIR . '/../../src/woocommerce.php'; $this->simulation_file = WORDPOINTS_WC_TESTS_DIR . '/includes/usage-simulator.php'; parent::setUp(); } - /** - * Tear down after the tests. - * - * @since 1.0.0 - * - public function tearDown() { - - // We've just deleted the tables, so this will have a DB error. - remove_action( 'delete_blog', 'wordpoints_delete_points_logs_for_blog' ); - - parent::tearDown(); - } - /** * Test installation and uninstallation. * diff --git a/tools/wp-l10n-validator/cache.json b/tools/wp-l10n-validator/cache.json deleted file mode 100644 index 3e43277..0000000 --- a/tools/wp-l10n-validator/cache.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "\/components\/points\/includes\/functions.php": { - "size": 1634, - "hash": "268e6793315b680fbdb33bc00ee9ca31", - "errors": false - }, - "\/components\/points\/includes\/gateways\/points.php": { - "size": 6363, - "hash": "65b62e80d18b45a9d32e820116ec2aaf", - "errors": false - }, - "\/components\/points\/includes\/hooks\/order-complete.php": { - "size": 3315, - "hash": "c49ecfbebd7ac401f1df2cea4b7c5be9", - "errors": false - }, - "\/components\/points\/points.php": { - "size": 658, - "hash": "1388301e57afeb3f7cf94bf9dd10ab7c", - "errors": false - }, - "\/includes\/constants.php": { - "size": 455, - "hash": "046d7fd2713c4dda759a6b29c9c44c5b", - "errors": false - }, - "\/includes\/functions.php": { - "size": 1023, - "hash": "bfe8e5c902b39c9cfdd92efc2c264497", - "errors": false - }, - "\/uninstall.php": { - "size": 490, - "hash": "0e88f799d2a463e3908f6e6c27d559ba", - "errors": false - }, - "\/woocommerce.php": { - "size": 1115, - "hash": "95040ee52d7213af866c28f8fc5e1414", - "errors": false - } -} \ No newline at end of file diff --git a/wp-l10n-validator.json b/wp-l10n-validator.json index 4cad2cb..d62a0d7 100644 --- a/wp-l10n-validator.json +++ b/wp-l10n-validator.json @@ -1,12 +1,12 @@ { "textdomain": "wordpoints-woocommerce", "basedir": "./src", - "bootstrap": "./vendor/wordpoints/l10n-validator-config/bootstrap.php", - "cache": "./tools/wp-l10n-validator/cache.json", - "ignores-cache": "./tools/wp-l10n-validator/ignores-cache.json", + "bootstrap": "dev-lib/l10n-validator/bootstrap.php", + "cache": "./.wp-l10n-validator-cache.json", + "ignores-cache": "./.wp-l10n-validator-ignores-cache.json", "ignores-tolerance": 25, "ignored-functions": { "wc_add_notice": [ 2 ], "WC_Payment_Gateway::get_option": true } -} \ No newline at end of file +}