Completed
Pull Request — master (#1383)
by
unknown
02:35 queued 11s
created
tests/phpunit/bootstrap.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$_tests_dir = getenv( 'WP_TESTS_DIR' ) ?: '/tmp/wordpress-tests-lib';
3
+$_tests_dir = getenv('WP_TESTS_DIR') ?: '/tmp/wordpress-tests-lib';
4 4
 
5
-if ( PHP_VERSION_ID >= 80000 && is_dir( $_tests_dir . '/includes/phpunit7/MockObject' ) ) {
5
+if (PHP_VERSION_ID >= 80000 && is_dir($_tests_dir . '/includes/phpunit7/MockObject')) {
6 6
 	// WP Core test library includes patches for PHPUnit 7 to make it compatible with PHP8.
7 7
 	require_once $_tests_dir . '/includes/phpunit7/MockObject/Builder/NamespaceMatch.php';
8 8
 	require_once $_tests_dir . '/includes/phpunit7/MockObject/Builder/ParametersMatch.php';
@@ -13,25 +13,25 @@  discard block
 block discarded – undo
13 13
 require_once $_tests_dir . '/includes/functions.php';
14 14
 
15 15
 function _manually_load_plugin() {
16
-	$plugins_dir = dirname( dirname( dirname( __DIR__ ) ) );
16
+	$plugins_dir = dirname(dirname(dirname(__DIR__)));
17 17
 	require $plugins_dir . '/woocommerce/woocommerce.php';
18 18
 	require __DIR__ . '/setup.php';
19 19
 	require $plugins_dir . '/woocommerce-gateway-stripe/woocommerce-gateway-stripe.php';
20 20
 }
21 21
 
22
-tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
22
+tests_add_filter('muplugins_loaded', '_manually_load_plugin');
23 23
 
24 24
 require $_tests_dir . '/includes/bootstrap.php';
25 25
 
26
-require_once( __DIR__ . '/helpers/class-wc-helper-order.php' );
27
-require_once( __DIR__ . '/helpers/class-wc-helper-product.php' );
28
-require_once( __DIR__ . '/helpers/class-wc-helper-shipping.php' );
29
-require_once( __DIR__ . '/helpers/class-wc-helper-token.php' );
30
-require_once( __DIR__ . '/helpers/class-wc-helper-subscription.php' );
31
-require_once( __DIR__ . '/helpers/class-wc-helper-subscriptions.php' );
32
-require_once( __DIR__ . '/helpers/class-wc-helper-subscriptions-cart.php' );
26
+require_once(__DIR__ . '/helpers/class-wc-helper-order.php');
27
+require_once(__DIR__ . '/helpers/class-wc-helper-product.php');
28
+require_once(__DIR__ . '/helpers/class-wc-helper-shipping.php');
29
+require_once(__DIR__ . '/helpers/class-wc-helper-token.php');
30
+require_once(__DIR__ . '/helpers/class-wc-helper-subscription.php');
31
+require_once(__DIR__ . '/helpers/class-wc-helper-subscriptions.php');
32
+require_once(__DIR__ . '/helpers/class-wc-helper-subscriptions-cart.php');
33 33
 
34 34
 // We use outdated PHPUnit version, which emits deprecation errors in PHP 7.4 (deprecated reflection APIs).
35
-if ( defined( 'PHP_VERSION_ID' ) && PHP_VERSION_ID >= 70400 ) {
36
-	error_reporting( error_reporting() ^ E_DEPRECATED ); // phpcs:ignore
35
+if (defined('PHP_VERSION_ID') && PHP_VERSION_ID >= 70400) {
36
+	error_reporting(error_reporting() ^ E_DEPRECATED); // phpcs:ignore
37 37
 }
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-token.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@
 block discarded – undo
19 19
 	 * @param int    $user_id        ID of the token's user, defaults to get_current_user_id().
20 20
 	 * @param string $gateway        Token's Gateway ID, default to WC_Payment_Gateway_WCPay::GATEWAY_ID
21 21
 	 */
22
-	public static function create_token( $payment_method, $user_id = null, $gateway = WC_Payment_Gateway_WCPay::GATEWAY_ID ) {
22
+	public static function create_token($payment_method, $user_id = null, $gateway = WC_Payment_Gateway_WCPay::GATEWAY_ID) {
23 23
 		$token = new WC_Payment_Token_CC();
24
-		$token->set_token( $payment_method );
25
-		$token->set_gateway_id( $gateway );
26
-		$token->set_user_id( isset ( $user_id ) ? $user_id : get_current_user_id() );
27
-		$token->set_card_type( 'visa' );
28
-		$token->set_last4( '4242' );
29
-		$token->set_expiry_month( 6 );
30
-		$token->set_expiry_year( intval( gmdate( 'Y' ) ) + 1 );
24
+		$token->set_token($payment_method);
25
+		$token->set_gateway_id($gateway);
26
+		$token->set_user_id(isset ($user_id) ? $user_id : get_current_user_id());
27
+		$token->set_card_type('visa');
28
+		$token->set_last4('4242');
29
+		$token->set_expiry_month(6);
30
+		$token->set_expiry_year(intval(gmdate('Y')) + 1);
31 31
 		$token->save();
32 32
 
33
-		return WC_Payment_Tokens::get( $token->get_id() );
33
+		return WC_Payment_Tokens::get($token->get_id());
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.