Skip to content

Commit

Permalink
use __DIR__ instead of dirname( __FILE__ )
Browse files Browse the repository at this point in the history
  • Loading branch information
reykjalin committed Mar 21, 2024
1 parent 151c73a commit ec86e08
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions includes/fraud-prevention/class-fraud-risk-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WCPay\Fraud_Prevention;

require_once dirname( __FILE__ ) . '/models/class-check.php';
require_once dirname( __FILE__ ) . '/models/class-rule.php';
require_once __DIR__ . '/models/class-check.php';
require_once __DIR__ . '/models/class-rule.php';

use WC_Payments;
use WC_Payments_Account;
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function() {

update_option( '_wcpay_feature_allow_subscription_migrations', '1' );

$_plugin_dir = dirname( __FILE__ ) . '/../../';
$_plugin_dir = __DIR__ . '/../../';

require $_plugin_dir . 'woocommerce-payments.php';

Expand Down Expand Up @@ -113,11 +113,11 @@ function() {
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

// Need those polyfills to run tests in CI.
require_once dirname( __FILE__ ) . '/../../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
require_once __DIR__ . '/../../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';

// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';
require dirname( __FILE__ ) . '/../WCPAY_UnitTestCase.php';
require __DIR__ . '/../WCPAY_UnitTestCase.php';

// We use outdated PHPUnit version, which emits deprecation errors in PHP 7.4 (deprecated reflection APIs).
if ( defined( 'PHP_VERSION_ID' ) && PHP_VERSION_ID >= 70400 ) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/class-wc-helper-subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

// WC_Mock_WC_Data is needed to mock '*_meta_data' methods required in tests.
require_once dirname( __FILE__ ) . '/class-wc-mock-wc-data.php';
require_once __DIR__ . '/class-wc-mock-wc-data.php';

/**
* Class WC_Subscription.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/class-wc-mock-wc-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

// Need to use WC_Mock_Data_Store.
require_once dirname( __FILE__ ) . '/class-wc-mock-wc-data-store.php';
require_once __DIR__ . '/class-wc-mock-wc-data-store.php';

/**
* Used for exposing and testing the various Abstract WC_Data methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use WCPay\Payment_Methods\CC_Payment_Method;

// Need to use WC_Mock_Data_Store.
require_once dirname( __FILE__ ) . '/helpers/class-wc-mock-wc-data-store.php';
require_once __DIR__ . '/helpers/class-wc-mock-wc-data-store.php';

/**
* WC_Payment_Gateway_WCPay unit tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use WCPay\Session_Rate_Limiter;

// Need to use WC_Mock_Data_Store.
require_once dirname( __FILE__ ) . '/helpers/class-wc-mock-wc-data-store.php';
require_once __DIR__ . '/helpers/class-wc-mock-wc-data-store.php';

/**
* WC_Payment_Gateway_WCPay::process_refund unit tests.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test-class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
use WCPay\Session_Rate_Limiter;

// Need to use WC_Mock_Data_Store.
require_once dirname( __FILE__ ) . '/helpers/class-wc-mock-wc-data-store.php';
require_once __DIR__ . '/helpers/class-wc-mock-wc-data-store.php';

/**
* WC_Payment_Gateway_WCPay unit tests.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test-class-wc-payments-captured-event-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function test_strings_for_captured_event( array $captured_event, array $e
public function provider() {

$res = [];
$files = glob( dirname( __FILE__, 2 ) . '/fixtures/captured-payments/*.json' );
$files = glob( dirname( __DIR__, 1 ) . '/fixtures/captured-payments/*.json' );
foreach ( $files as $file ) {
$array_from_file = json_decode( file_get_contents( $file ), true ); //phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
$title = $array_from_file['title'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use WCPay\Exceptions\Rest_Request_Exception;

// Need to use WC_Mock_Data_Store.
require_once dirname( __FILE__ ) . '/helpers/class-wc-mock-wc-data-store.php';
require_once __DIR__ . '/helpers/class-wc-mock-wc-data-store.php';

/**
* WC_Payments_Webhook_Processing_Service unit tests.
Expand Down

0 comments on commit ec86e08

Please sign in to comment.