diff --git a/.gitignore b/.gitignore
index d04c047e..a1a702ea 100755
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ cypress/screenshots
/artifacts/
/blob-report/
/playwright/.cache/
+.phpunit.result.cache
diff --git a/phpcs.xml b/phpcs.xml
index 68dac9de..9dab49fc 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -20,5 +20,6 @@
+
diff --git a/phpunit/bootstrap.php b/phpunit/bootstrap.php
index 43d6208d..b53ded67 100644
--- a/phpunit/bootstrap.php
+++ b/phpunit/bootstrap.php
@@ -6,7 +6,7 @@
*/
// Require composer dependencies.
-require_once dirname( dirname( __FILE__ ) ) . '/vendor/autoload.php';
+require_once dirname( __DIR__ ) . '/vendor/autoload.php';
// Determine the tests directory (from a WP dev checkout).
// Try the WP_TESTS_DIR environment variable first.
@@ -19,7 +19,7 @@
// See if we're installed inside an existing WP dev instance.
if ( ! $_tests_dir ) {
- $_try_tests_dir = dirname( __FILE__ ) . '/../../../../../tests/phpunit';
+ $_try_tests_dir = __DIR__ . '/../../../../../tests/phpunit';
if ( file_exists( $_try_tests_dir . '/includes/functions.php' ) ) {
$_tests_dir = $_try_tests_dir;
}
@@ -40,7 +40,7 @@
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
- require dirname( dirname( __FILE__ ) ) . '/wp-bootstrap-blocks.php';
+ require dirname( __DIR__ ) . '/wp-bootstrap-blocks.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
@@ -48,4 +48,4 @@ function _manually_load_plugin() {
require $_tests_dir . '/includes/bootstrap.php';
// Load plugin UnitTestCase
-require_once dirname( __FILE__ ) . '/wp-bootstrap-blocks-unittestcase.php';
+require_once __DIR__ . '/wp-bootstrap-blocks-unittestcase.php';
diff --git a/phpunit/settings/class-wp-bootstrap-blocks-settings-test.php b/phpunit/settings/class-wp-bootstrap-blocks-settings-test.php
index 3199dc31..2f176a2c 100644
--- a/phpunit/settings/class-wp-bootstrap-blocks-settings-test.php
+++ b/phpunit/settings/class-wp-bootstrap-blocks-settings-test.php
@@ -5,7 +5,7 @@
* @package wp-bootstrap-blocks
*/
-use \WP_Bootstrap_Blocks\Settings;
+use WP_Bootstrap_Blocks\Settings;
/**
* Class WP_Bootstrap_Blocks_Settings_Test
diff --git a/phpunit/wp-bootstrap-blocks-functions-test.php b/phpunit/wp-bootstrap-blocks-functions-test.php
index 82f28651..c09d77bd 100644
--- a/phpunit/wp-bootstrap-blocks-functions-test.php
+++ b/phpunit/wp-bootstrap-blocks-functions-test.php
@@ -34,7 +34,7 @@ public function test_wp_bootstrap_blocks_get_template_with_filter() {
add_filter(
'wp_bootstrap_blocks_get_template',
function () {
- return trailingslashit( dirname( __FILE__ ) ) . 'fixtures/templates/dummy.php';
+ return trailingslashit( __DIR__ ) . 'fixtures/templates/dummy.php';
}
);
$container_template = wp_bootstrap_blocks_get_template( 'container', array() );
diff --git a/phpunit/wp-bootstrap-blocks-unittestcase.php b/phpunit/wp-bootstrap-blocks-unittestcase.php
index 978d9f64..e4cb40cd 100644
--- a/phpunit/wp-bootstrap-blocks-unittestcase.php
+++ b/phpunit/wp-bootstrap-blocks-unittestcase.php
@@ -75,9 +75,9 @@ protected function load_fixture( $variant, $state = '' ) {
$filepath = $this->get_fixture_path( $variant, $state );
if ( ! file_exists( $filepath ) ) {
if ( self::OUTPUT_STATE_NAME === $state ) {
- throw new Exception( 'Fixture file ' . $filepath . ' does not exist. Please record output fixture file first by setting the environment variable WP_BOOTSTRAP_BLOCKS_RECORD to true and running the tests again.' );
+ throw new Exception( 'Fixture file ' . esc_html( $filepath ) . ' does not exist. Please record output fixture file first by setting the environment variable WP_BOOTSTRAP_BLOCKS_RECORD to true and running the tests again.' );
} else {
- throw new Exception( 'Fixture file ' . $filepath . ' does not exist. Please create it first.' );
+ throw new Exception( 'Fixture file ' . esc_html( $filepath ) . ' does not exist. Please create it first.' );
}
}
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
@@ -94,7 +94,7 @@ protected function load_fixture( $variant, $state = '' ) {
*/
protected function create_fixture_if_needed( $variant, $content ) {
if ( getenv( 'WP_BOOTSTRAP_BLOCKS_RECORD' ) === '1' ) {
- // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents
file_put_contents( $this->get_fixture_path( $variant, 'output' ), $content );
}
}
diff --git a/src/class-wp-bootstrap-blocks.php b/src/class-wp-bootstrap-blocks.php
index 7739950c..bd2077a4 100755
--- a/src/class-wp-bootstrap-blocks.php
+++ b/src/class-wp-bootstrap-blocks.php
@@ -346,5 +346,4 @@ protected function log_version_number() {
delete_option( $this->token . '_version' );
update_option( $this->token . '_version', self::$version );
}
-
}
diff --git a/src/settings/class-settings.php b/src/settings/class-settings.php
index 2fd963b1..72c22789 100644
--- a/src/settings/class-settings.php
+++ b/src/settings/class-settings.php
@@ -428,6 +428,5 @@ public static function is_css_grid_enabled() {
public static function get_option( $option_name, $constant_name, $default_value ) {
return defined( $constant_name ) ? constant( $constant_name ) : get_option( $option_name, $default_value );
}
-
}
endif;