Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.47
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
wp /
features /
[ HOME SHELL ]
Name
Size
Permission
Action
aliases.feature
15.82
KB
-rw-r--r--
bootstrap.feature
14.43
KB
-rw-r--r--
class-wp-cli.feature
570
B
-rw-r--r--
cli-bash-completion.feature
7.13
KB
-rw-r--r--
cli-cache.feature
2.12
KB
-rw-r--r--
cli-check-update.feature
10.09
KB
-rw-r--r--
cli-info.feature
1.25
KB
-rw-r--r--
cli.feature
2.52
KB
-rw-r--r--
command.feature
37.85
KB
-rw-r--r--
config.feature
18.61
KB
-rw-r--r--
context.feature
5.68
KB
-rw-r--r--
flags.feature
9.63
KB
-rw-r--r--
formatter.feature
5.73
KB
-rw-r--r--
framework.feature
11.22
KB
-rw-r--r--
help.feature
33.66
KB
-rw-r--r--
hook.feature
6.09
KB
-rw-r--r--
prompt.feature
5.14
KB
-rw-r--r--
requests.feature
3.62
KB
-rw-r--r--
runcommand.feature
10.41
KB
-rw-r--r--
runner.feature
2.6
KB
-rw-r--r--
skip-plugins.feature
3.35
KB
-rw-r--r--
skip-themes.feature
5.52
KB
-rw-r--r--
steps.feature
1.78
KB
-rw-r--r--
utils-wp.feature
22.54
KB
-rw-r--r--
utils.feature
6.71
KB
-rw-r--r--
validation.feature
1.16
KB
-rw-r--r--
wp-config.feature
1.11
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : hook.feature
Feature: Tests `WP_CLI::add_hook()` Scenario: Add callback to the `before_invoke:plugin list` Given a WP installation And a before-invoke.php file: """ <?php $callback = function() { WP_CLI::log( '`add_hook()` to the `before_invoke` is working.'); }; WP_CLI::add_hook( 'before_invoke:plugin list', $callback ); """ And a wp-cli.yml file: """ require: - before-invoke.php """ When I run `wp plugin list` Then STDOUT should contain: """ `add_hook()` to the `before_invoke` is working. """ And the return code should be 0 # `wp db check` does not yet work on SQLite, # See https://github.com/wp-cli/db-command/issues/234 @require-mysql Scenario: Add callback to the `before_invoke:db check` Given a WP installation And a before-invoke.php file: """ <?php $callback = function() { WP_CLI::log( '`add_hook()` to the `before_invoke` is working.'); }; WP_CLI::add_hook( 'before_invoke:db check', $callback ); """ And a wp-cli.yml file: """ require: - before-invoke.php """ When I run `wp db check` Then STDOUT should contain: """ `add_hook()` to the `before_invoke` is working. """ And the return code should be 0 Scenario: Add callback to the `before_invoke:core version` Given a WP installation And a before-invoke.php file: """ <?php $callback = function() { WP_CLI::log( '`add_hook()` to the `before_invoke` is working.'); }; WP_CLI::add_hook( 'before_invoke:core version', $callback ); """ And a wp-cli.yml file: """ require: - before-invoke.php """ When I run `wp core version` Then STDOUT should contain: """ `add_hook()` to the `before_invoke` is working. """ And the return code should be 0 Scenario: Add callback to the `before_run_command` with args Given a WP installation And a before-run-command.php file: """ <?php $callback = function ( $args, $assoc_args, $options ) { WP_CLI::log( '`add_hook()` to the `before_run_command` is working.' ); if ( 'version' !== $args[1] ) { WP_CLI::error( 'Arg context not being passed in to callback properly' ); } if ( ! array_key_exists( 'extra', $assoc_args ) ) { WP_CLI::error( 'Assoc arg context not being passed in to callback properly' ); } }; WP_CLI::add_hook( 'before_run_command', $callback ); """ And a wp-cli.yml file: """ require: - before-run-command.php """ When I run `wp core version --extra` Then STDOUT should contain: """ `add_hook()` to the `before_run_command` is working. """ And the return code should be 0 Scenario: Use return value of a callback hook Given a WP installation And a custom-hook.php file: """ <?php $callback = function ( $first, $second ) { WP_CLI::log( '`add_hook()` to the `custom_hook` is working.' ); if ( 'value1' !== $first ) { WP_CLI::error( 'First argument is not being passed in to callback properly' ); } if ( 'value2' !== $second ) { WP_CLI::error( 'Second argument is not being passed in to callback properly' ); } return 'value3'; }; WP_CLI::add_hook( 'custom_hook', $callback ); $result = WP_CLI::do_hook( 'custom_hook', 'value1', 'value2' ); if ( empty( $result ) ) { WP_CLI::error( 'First argument is not returned via do_hook()' ); } if ( 'value3' !== $result ) { WP_CLI::error( 'First argument is not mutable via do_hook()' ); } """ And a wp-cli.yml file: """ require: - custom-hook.php """ When I run `wp cli version` Then STDOUT should contain: """ `add_hook()` to the `custom_hook` is working. """ And STDOUT should not contain: """ First argument is not being passed in to callback properly """ And STDOUT should not contain: """ Second argument is not being passed in to callback properly """ And STDOUT should not contain: """ First argument is not returned via do_hook() """ And STDOUT should not contain: """ First argument is not mutable via do_hook() """ And the return code should be 0 Scenario: Callback hook with arguments does not break on bad callback Given a WP installation And a custom-hook.php file: """ <?php $callback = function ( $first, $second ) { WP_CLI::log( '`add_hook()` to the `custom_hook` is working.' ); if ( 'value1' !== $first ) { WP_CLI::error( 'First argument is not being passed in to callback properly' ); } if ( 'value2' !== $second ) { WP_CLI::error( 'Second argument is not being passed in to callback properly' ); } }; WP_CLI::add_hook( 'custom_hook', $callback ); $result = WP_CLI::do_hook( 'custom_hook', 'value1', 'value2' ); if ( empty( $result ) ) { WP_CLI::error( 'First argument is not returned via do_hook()' ); } if ( 'value1' !== $result ) { WP_CLI::error( 'First argument is not correctly returned on bad callback missing return' ); } """ And a wp-cli.yml file: """ require: - custom-hook.php """ When I run `wp cli version` Then STDOUT should contain: """ `add_hook()` to the `custom_hook` is working. """ And STDOUT should not contain: """ First argument is not being passed in to callback properly """ And STDOUT should not contain: """ Second argument is not being passed in to callback properly """ And STDOUT should not contain: """ First argument is not returned via do_hook() """ And STDOUT should not contain: """ First argument is not correctly returned on bad callback missing return """ And the return code should be 0
Close