Skip to content

Commit 14f83fd

Browse files
authored
Merge pull request #204 from wp-cli/fix/tests
2 parents 6ca81ab + 7ed7190 commit 14f83fd

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

features/profile-hook.feature

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Feature: Profile a specific hook
6666
<meta name="generator"
6767
"""
6868

69-
@require-wp-4.0
69+
@require-wp-4.0 @less-than-wp-6.9
7070
Scenario: Profile the shutdown hook
7171
Given a WP install
7272
And a wp-content/mu-plugins/shutdown.php file:
@@ -86,6 +86,28 @@ Feature: Profile a specific hook
8686
| total (2) | 0 | 1 |
8787
And STDERR should be empty
8888

89+
# `_wp_cron` was added to shutdown hook in 6.9, see https://core.trac.wordpress.org/changeset/60925.
90+
@require-wp-6.9
91+
Scenario: Profile the shutdown hook
92+
Given a WP install
93+
And a wp-content/mu-plugins/shutdown.php file:
94+
"""
95+
<?php
96+
function wp_cli_shutdown_hook() {
97+
wp_cache_get( 'foo' );
98+
}
99+
add_action( 'shutdown', 'wp_cli_shutdown_hook' );
100+
"""
101+
102+
When I run `wp profile hook shutdown --fields=callback,cache_hits,cache_misses`
103+
Then STDOUT should be a table containing rows:
104+
| callback | cache_hits | cache_misses |
105+
| wp_cli_shutdown_hook() | 0 | 1 |
106+
| wp_ob_end_flush_all() | 0 | 0 |
107+
| _wp_cron() | 0 | 0 |
108+
| total (3) | 0 | 1 |
109+
And STDERR should be empty
110+
89111
@require-wp-4.0
90112
Scenario: Indicate where a callback is defined with profiling a hook
91113
Given a WP install

0 commit comments

Comments
 (0)