Skip to content

Commit 492baeb

Browse files
committed
Fix PHPCS errors in Behat test files
1 parent 3a718f6 commit 492baeb

5 files changed

Lines changed: 89 additions & 61 deletions

File tree

features/core-check-update-db.feature

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ Feature: Check if WordPress database update is needed
77
And a disable_sidebar_check.php file:
88
"""
99
<?php
10-
WP_CLI::add_wp_hook( 'init', static function () {
11-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
12-
} );
10+
WP_CLI::add_wp_hook(
11+
'init',
12+
static function () {
13+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
14+
}
15+
);
1316
"""
1417
And I try `wp theme install twentytwenty --activate`
1518
And I run `wp core download --version=5.4 --force`
@@ -49,9 +52,12 @@ Feature: Check if WordPress database update is needed
4952
And a disable_sidebar_check.php file:
5053
"""
5154
<?php
52-
WP_CLI::add_wp_hook( 'init', static function () {
53-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
54-
} );
55+
WP_CLI::add_wp_hook(
56+
'init',
57+
static function () {
58+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
59+
}
60+
);
5561
"""
5662
And I try `wp theme install twentytwenty --activate`
5763
And I run `wp core download --version=6.6 --force`

features/core-check-update.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Feature: Check for more recent versions
4444
<?php
4545
global $wp_version;
4646
47-
$obj = new stdClass;
47+
$obj = new stdClass();
4848
$obj->updates = [];
4949
$obj->last_checked = strtotime( '1 January 2099' );
5050
$obj->version_checked = $wp_version;

features/core-update-db.feature

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ Feature: Update core's database
77
And a disable_sidebar_check.php file:
88
"""
99
<?php
10-
WP_CLI::add_wp_hook( 'init', static function () {
11-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
12-
} );
10+
WP_CLI::add_wp_hook(
11+
'init',
12+
static function () {
13+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
14+
}
15+
);
1316
"""
1417
And I try `wp theme install twentytwenty --activate`
1518
And I run `wp core download --version=5.4 --force`
@@ -34,9 +37,12 @@ Feature: Update core's database
3437
And a disable_sidebar_check.php file:
3538
"""
3639
<?php
37-
WP_CLI::add_wp_hook( 'init', static function () {
38-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
39-
} );
40+
WP_CLI::add_wp_hook(
41+
'init',
42+
static function () {
43+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
44+
}
45+
);
4046
"""
4147
And I try `wp theme install twentytwenty --activate`
4248
And I run `wp core download --version=5.4 --force`
@@ -62,9 +68,12 @@ Feature: Update core's database
6268
And a disable_sidebar_check.php file:
6369
"""
6470
<?php
65-
WP_CLI::add_wp_hook( 'init', static function () {
66-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
67-
} );
71+
WP_CLI::add_wp_hook(
72+
'init',
73+
static function () {
74+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
75+
}
76+
);
6877
"""
6978
And I try `wp theme install twentytwenty --activate`
7079
And I run `wp core download --version=5.4 --force`
@@ -104,9 +113,12 @@ Feature: Update core's database
104113
And a disable_sidebar_check.php file:
105114
"""
106115
<?php
107-
WP_CLI::add_wp_hook( 'init', static function () {
108-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
109-
} );
116+
WP_CLI::add_wp_hook(
117+
'init',
118+
static function () {
119+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
120+
}
121+
);
110122
"""
111123
And I try `wp theme install twentytwenty --activate`
112124
And I run `wp core download --version=5.4 --force`
@@ -158,9 +170,12 @@ Feature: Update core's database
158170
And a disable_sidebar_check.php file:
159171
"""
160172
<?php
161-
WP_CLI::add_wp_hook( 'init', static function () {
162-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
163-
} );
173+
WP_CLI::add_wp_hook(
174+
'init',
175+
static function () {
176+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
177+
}
178+
);
164179
"""
165180
And I try `wp theme install twentytwenty --activate`
166181
And I run `wp core download --version=5.4 --force`
@@ -204,9 +219,12 @@ Feature: Update core's database
204219
And a before.php file:
205220
"""
206221
<?php
207-
WP_CLI::add_hook( 'before_invoke:core update-db', function(){
208-
WP_CLI::log( 'WP_INSTALLING: ' . var_export( WP_INSTALLING, true ) );
209-
});
222+
WP_CLI::add_hook(
223+
'before_invoke:core update-db',
224+
function () {
225+
WP_CLI::log( 'WP_INSTALLING: ' . var_export( WP_INSTALLING, true ) );
226+
}
227+
);
210228
"""
211229

212230
When I run `wp --require=before.php core update-db`

features/core-update.feature

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -189,33 +189,36 @@ Feature: Update WordPress core
189189
And a wp-content/mu-plugins/upgrade-override.php file:
190190
"""
191191
<?php
192-
add_filter( 'pre_site_transient_update_core', function(){
193-
return (object) array(
194-
'updates' => array(
195-
(object) array(
196-
'response' => 'autoupdate',
197-
'download' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
198-
'locale' => 'en_US',
199-
'packages' => (object) array(
200-
'full' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
201-
'no_content' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-no-content.zip',
202-
'new_bundled' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-new-bundled.zip',
203-
'partial' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-partial-1.zip',
204-
'rollback' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-rollback-1.zip',
205-
),
206-
'current' => '6.5.5',
207-
'version' => '6.5.5',
208-
'php_version' => '8.2.1',
209-
'mysql_version' => '5.0',
210-
'new_bundled' => '6.4',
211-
'partial_version' => '6.5.2',
212-
'support_email' => 'updatehelp42@wordpress.org',
213-
'new_files' => '',
214-
),
215-
),
216-
'version_checked' => '6.5.5', // Needed to avoid PHP notice in `wp_version_check()`.
217-
);
218-
});
192+
add_filter(
193+
'pre_site_transient_update_core',
194+
function () {
195+
return (object) array(
196+
'updates' => array(
197+
(object) array(
198+
'response' => 'autoupdate',
199+
'download' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
200+
'locale' => 'en_US',
201+
'packages' => (object) array(
202+
'full' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
203+
'no_content' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-no-content.zip',
204+
'new_bundled' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-new-bundled.zip',
205+
'partial' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-partial-1.zip',
206+
'rollback' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-rollback-1.zip',
207+
),
208+
'current' => '6.5.5',
209+
'version' => '6.5.5',
210+
'php_version' => '8.2.1',
211+
'mysql_version' => '5.0',
212+
'new_bundled' => '6.4',
213+
'partial_version' => '6.5.2',
214+
'support_email' => 'updatehelp42@wordpress.org',
215+
'new_files' => '',
216+
),
217+
),
218+
'version_checked' => '6.5.5', // Needed to avoid PHP notice in `wp_version_check()`.
219+
);
220+
}
221+
);
219222
"""
220223

221224
When I run `wp core download --version=6.5.2 --force`

features/core.feature

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,33 +341,34 @@ Feature: Manage WordPress installation
341341
<?php
342342
// ** MySQL settings ** //
343343
/** The name of the database for WordPress */
344-
define('DB_NAME', '{DB_NAME}');
344+
define( 'DB_NAME', '{DB_NAME}' );
345345
346346
/** MySQL database username */
347-
define('DB_USER', '{DB_USER}');
347+
define( 'DB_USER', '{DB_USER}' );
348348
349349
/** MySQL database password */
350-
define('DB_PASSWORD', '{DB_PASSWORD}');
350+
define( 'DB_PASSWORD', '{DB_PASSWORD}' );
351351
352352
/** MySQL hostname */
353-
define('DB_HOST', '{DB_HOST}');
353+
define( 'DB_HOST', '{DB_HOST}' );
354354
355355
/** Database Charset to use in creating database tables. */
356-
define('DB_CHARSET', 'utf8');
356+
define( 'DB_CHARSET', 'utf8' );
357357
358358
/** The Database Collate type. Don't change this if in doubt. */
359-
define('DB_COLLATE', '');
359+
define( 'DB_COLLATE', '' );
360360
361361
$table_prefix = 'wp_';
362362
363363
/* That's all, stop editing! Happy publishing. */
364364
365365
/** Absolute path to the WordPress directory. */
366-
if ( !defined('ABSPATH') )
367-
define('ABSPATH', dirname(__FILE__) . '/');
366+
if ( ! defined( 'ABSPATH' ) ) {
367+
define( 'ABSPATH', __DIR__ . '/' );
368+
}
368369
369370
/** Sets up WordPress vars and included files. */
370-
require_once(ABSPATH . 'wp-settings.php');
371+
require_once ABSPATH . 'wp-settings.php';
371372
"""
372373
And a wp-cli.yml file:
373374
"""

0 commit comments

Comments
 (0)