-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathpackage.feature
More file actions
145 lines (135 loc) · 3.96 KB
/
package.feature
File metadata and controls
145 lines (135 loc) · 3.96 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Feature: Install WP-CLI packages
Background:
When I run `wp package path`
Then save STDOUT as {PACKAGE_PATH}
Scenario: Install a package requiring a WP-CLI version that doesn't match
Given an empty directory
And a new Phar with version "2.10.0"
And a path-command/command.php file:
"""
<?php
WP_CLI::add_command( 'community-command', function(){
WP_CLI::success( "success!" );
}, array( 'when' => 'before_wp_load' ) );
"""
And a path-command/composer.json file:
"""
{
"name": "wp-cli/community-command",
"description": "A demo community command.",
"license": "MIT",
"minimum-stability": "dev",
"autoload": {
"files": [ "command.php" ]
},
"require": {
"wp-cli/wp-cli": ">=2.11.0"
},
"require-dev": {
"behat/behat": "~2.5"
}
}
"""
When I try `{PHAR_PATH} package install path-command`
Then STDOUT should contain:
"""
Your requirements could not be resolved to an installable set of packages.
"""
And STDOUT should contain:
"""
wp-cli/community-command dev-
"""
And STDOUT should contain:
"""
wp-cli/wp-cli >=2.11.0 -> satisfiable by
"""
And STDERR should contain:
"""
Error: Package installation failed
"""
And the return code should be 1
When I run `cat {PACKAGE_PATH}composer.json`
Then STDOUT should contain:
"""
"version": "2.10.0",
"""
Scenario: Install a package requiring a WP-CLI version that does match
Given an empty directory
And a new Phar with version "2.11.0"
And a path-command/command.php file:
"""
<?php
WP_CLI::add_command( 'community-command', function(){
WP_CLI::success( "success!" );
}, array( 'when' => 'before_wp_load' ) );
"""
And a path-command/composer.json file:
"""
{
"name": "wp-cli/community-command",
"description": "A demo community command.",
"license": "MIT",
"minimum-stability": "dev",
"autoload": {
"files": [ "command.php" ]
},
"require": {
"wp-cli/wp-cli": ">=2.10.0"
},
"require-dev": {
"behat/behat": "~2.5"
}
}
"""
# Allow for composer/ca-bundle using `openssl_x509_parse()` which throws PHP warnings on old versions of PHP.
When I try `{PHAR_PATH} package install path-command`
Then STDOUT should contain:
"""
Success: Package installed.
"""
And the return code should be 0
When I run `cat {PACKAGE_PATH}composer.json`
Then STDOUT should contain:
"""
"version": "2.11.0",
"""
Scenario: Install a package requiring a WP-CLI alpha version that does match
Given an empty directory
And a new Phar with version "2.12.0-alpha-90ecad6"
And a path-command/command.php file:
"""
<?php
WP_CLI::add_command( 'community-command', function(){
WP_CLI::success( "success!" );
}, array( 'when' => 'before_wp_load' ) );
"""
And a path-command/composer.json file:
"""
{
"name": "wp-cli/community-command",
"description": "A demo community command.",
"license": "MIT",
"minimum-stability": "dev",
"autoload": {
"files": [ "command.php" ]
},
"require": {
"wp-cli/wp-cli": ">=2.11.0"
},
"require-dev": {
"behat/behat": "~2.5"
}
}
"""
# Allow for composer/ca-bundle using `openssl_x509_parse()` which throws PHP warnings on old versions of PHP.
When I try `{PHAR_PATH} package install path-command`
Then STDOUT should contain:
"""
Success: Package installed.
"""
And the return code should be 0
When I run `cat {PACKAGE_PATH}composer.json`
Then STDOUT should contain:
"""
"version": "2.12.0-alpha",
"""