Skip to content

Commit

Permalink
fix phpcs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tschortsch committed Nov 12, 2023
1 parent 55dab62 commit ed5a5ff
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ cypress/screenshots
/artifacts/
/blob-report/
/playwright/.cache/
.phpunit.result.cache
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed" />
</rule>
</ruleset>
8 changes: 4 additions & 4 deletions phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
Expand All @@ -40,12 +40,12 @@
* 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' );

// Start up the WP testing environment.
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';
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package wp-bootstrap-blocks
*/

use \WP_Bootstrap_Blocks\Settings;
use WP_Bootstrap_Blocks\Settings;

/**
* Class WP_Bootstrap_Blocks_Settings_Test
Expand Down
2 changes: 1 addition & 1 deletion phpunit/wp-bootstrap-blocks-functions-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
6 changes: 3 additions & 3 deletions phpunit/wp-bootstrap-blocks-unittestcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 );
}
}
Expand Down
1 change: 0 additions & 1 deletion src/class-wp-bootstrap-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,4 @@ protected function log_version_number() {
delete_option( $this->token . '_version' );
update_option( $this->token . '_version', self::$version );
}

}
1 change: 0 additions & 1 deletion src/settings/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit ed5a5ff

Please sign in to comment.