2016-08-30 06:57:55 -07:00
|
|
|
Feature: Profile the template render stage
|
|
|
|
|
2016-10-04 06:47:01 -07:00
|
|
|
Scenario: Profiler loads a summary table
|
|
|
|
Given a WP install
|
|
|
|
|
|
|
|
When I run `wp profile stage --fields=stage`
|
|
|
|
Then STDOUT should be a table containing rows:
|
|
|
|
| stage |
|
|
|
|
| bootstrap |
|
|
|
|
| main_query |
|
|
|
|
| template |
|
|
|
|
|
2016-08-30 06:57:55 -07:00
|
|
|
Scenario: Profiler loads a table with the correct hooks
|
|
|
|
Given a WP install
|
|
|
|
|
2016-10-07 15:58:08 -07:00
|
|
|
When I run `wp profile stage bootstrap --fields=hook`
|
|
|
|
Then STDOUT should be a table containing rows:
|
|
|
|
| hook |
|
|
|
|
| |
|
|
|
|
| muplugins_loaded |
|
|
|
|
| |
|
|
|
|
| plugins_loaded |
|
|
|
|
| |
|
|
|
|
| setup_theme |
|
|
|
|
| |
|
|
|
|
| after_setup_theme |
|
|
|
|
| |
|
|
|
|
| init |
|
|
|
|
| |
|
|
|
|
| wp_loaded |
|
|
|
|
| |
|
|
|
|
| total |
|
|
|
|
|
|
|
|
When I run `wp profile stage main_query --fields=hook`
|
|
|
|
Then STDOUT should be a table containing rows:
|
|
|
|
| hook |
|
|
|
|
| |
|
|
|
|
| parse_request |
|
|
|
|
| |
|
|
|
|
| send_headers |
|
|
|
|
| |
|
|
|
|
| pre_get_posts |
|
|
|
|
| |
|
|
|
|
| the_posts |
|
|
|
|
| |
|
|
|
|
| wp |
|
|
|
|
| |
|
|
|
|
| total |
|
|
|
|
|
2016-10-04 06:47:01 -07:00
|
|
|
When I run `wp profile stage template --fields=hook`
|
2016-08-30 06:57:55 -07:00
|
|
|
Then STDOUT should be a table containing rows:
|
|
|
|
| hook |
|
|
|
|
| |
|
|
|
|
| template_redirect |
|
|
|
|
| |
|
|
|
|
| template_include |
|
|
|
|
| |
|
|
|
|
| wp_head |
|
|
|
|
| |
|
|
|
|
| loop_start |
|
|
|
|
| |
|
|
|
|
| loop_end |
|
|
|
|
| |
|
|
|
|
| wp_footer |
|
2016-09-08 17:42:58 -07:00
|
|
|
| |
|
2016-08-30 06:57:55 -07:00
|
|
|
| total |
|
2016-10-07 15:45:48 -07:00
|
|
|
|
|
|
|
Scenario: Use --all flag to profile all stages
|
|
|
|
Given a WP install
|
|
|
|
|
|
|
|
When I run `wp profile stage --all --fields=hook`
|
|
|
|
Then STDOUT should be a table containing rows:
|
|
|
|
| hook |
|
|
|
|
| |
|
|
|
|
| muplugins_loaded |
|
|
|
|
| |
|
|
|
|
| plugins_loaded |
|
|
|
|
| |
|
|
|
|
| setup_theme |
|
|
|
|
| |
|
|
|
|
| after_setup_theme |
|
|
|
|
| |
|
|
|
|
| init |
|
|
|
|
| |
|
|
|
|
| wp_loaded |
|
|
|
|
| |
|
|
|
|
| parse_request |
|
|
|
|
| |
|
|
|
|
| send_headers |
|
|
|
|
| |
|
|
|
|
| pre_get_posts |
|
|
|
|
| |
|
|
|
|
| the_posts |
|
|
|
|
| |
|
|
|
|
| wp |
|
|
|
|
| |
|
|
|
|
| template_redirect |
|
|
|
|
| |
|
|
|
|
| template_include |
|
|
|
|
| |
|
|
|
|
| wp_head |
|
|
|
|
| |
|
|
|
|
| loop_start |
|
|
|
|
| |
|
|
|
|
| loop_end |
|
|
|
|
| |
|
|
|
|
| wp_footer |
|
|
|
|
| |
|
|
|
|
| total |
|
|
|
|
|
|
|
|
Scenario: Invalid stage specified
|
|
|
|
Given a WP install
|
|
|
|
|
|
|
|
When I try `wp profile stage foo_bar`
|
|
|
|
Then STDERR should be:
|
|
|
|
"""
|
|
|
|
Error: Invalid stage. Must be one of bootstrap, main_query, template, or use --all.
|
|
|
|
"""
|