-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathbootstrap.feature
More file actions
83 lines (75 loc) · 2.42 KB
/
bootstrap.feature
File metadata and controls
83 lines (75 loc) · 2.42 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
"""
Scenario: Template paths should be resolved correctly when PHAR is renamed
Given an empty directory
And a new Phar with the same version
And a WP installation
And I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.1/generic-example-plugin.0.1.1.zip --activate`
And I run `wp plugin deactivate generic-example-plugin`
When I run `php {PHAR_PATH} plugin status generic-example-plugin`
Then STDOUT should contain:
"""
Plugin generic-example-plugin details:
Name: Example Plugin
Status: Inactive
"""
And STDERR should be empty
When I run `cp {PHAR_PATH} wp-renamed.phar`
And I try `php wp-renamed.phar plugin status generic-example-plugin`
Then STDOUT should contain:
"""
Plugin generic-example-plugin details:
Name: Example Plugin
Status: Inactive
"""
And STDERR should be empty