-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathbootstrap.feature
More file actions
56 lines (52 loc) · 1.49 KB
/
bootstrap.feature
File metadata and controls
56 lines (52 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Feature: Bootstrap WP-CLI
Scenario: Override command bundled with freshly built PHAR
Given an empty directory
And a new Phar with the same version
And a cli-override-command/cli.php file:
"""
<?php
if ( ! class_exists( 'WP_CLI' ) ) {
return;
}
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
if ( file_exists( $autoload ) ) {
require_once $autoload;
}
WP_CLI::add_command( 'cli', 'CLI_Command', array( 'when' => 'before_wp_load' ) );
"""
And a cli-override-command/src/CLI_Command.php file:
"""
<?php
class CLI_Command extends WP_CLI_Command {
public function version() {
WP_CLI::success( "WP-Override-CLI" );
}
}
"""
And a cli-override-command/composer.json file:
"""
{
"name": "wp-cli/cli-override",
"description": "A command that overrides the bundled 'cli' command.",
"autoload": {
"psr-4": { "": "src/" },
"files": [ "cli.php" ]
},
"extra": {
"commands": [
"cli"
]
}
}
"""
And I run `composer install --working-dir={RUN_DIR}/cli-override-command --no-interaction 2>&1`
When I run `{PHAR_PATH} cli version`
Then STDOUT should contain:
"""
WP-CLI
"""
When I run `{PHAR_PATH} --require=cli-override-command/cli.php cli version`
Then STDOUT should contain:
"""
WP-Override-CLI
"""