Skip to content

Commit aaa12ba

Browse files
committed
Add test to trigger issue wp-cli/wp-cli#5795
1 parent bd4d2a7 commit aaa12ba

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

features/requests.feature

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,121 @@ Feature: Requests integration with both v1 and v2
9696
"""
9797
Success: Installed 1 of 1 plugins.
9898
"""
99+
100+
Scenario: Composer stack with Requests v1 pulling wp-cli/wp-cli-bundle
101+
Given an empty directory
102+
And a composer.json file:
103+
"""
104+
{
105+
"name": "example/wordpress",
106+
"type": "project",
107+
"extra": {
108+
"wordpress-install-dir": "wp",
109+
"installer-paths": {
110+
"content/plugins/{$name}/": [
111+
"type:wordpress-plugin"
112+
],
113+
"content/themes/{$name}/": [
114+
"type:wordpress-theme"
115+
]
116+
}
117+
},
118+
"repositories": [
119+
{
120+
"type": "composer",
121+
"url": "https://wpackagist.org"
122+
}
123+
],
124+
"require": {
125+
"johnpbloch/wordpress": "6.1"
126+
},
127+
"require-dev": {
128+
"wp-cli/wp-cli-bundle": "^2.8.0"
129+
},
130+
"config": {
131+
"allow-plugins": {
132+
"johnpbloch/wordpress-core-installer": true
133+
}
134+
}
135+
}
136+
"""
137+
# Note: Composer outputs messages to stderr.
138+
And I run `composer install --no-interaction 2>&1`
139+
And a wp-cli.yml file:
140+
"""
141+
path: wp
142+
"""
143+
144+
When I run `vendor/bin/wp cli version`
145+
Then STDOUT should contain:
146+
"""
147+
WP-CLI 2.8
148+
"""
149+
150+
When I run `vendor/bin/wp config create --dbname={DB_NAME} --dbuser={DB_USER} --dbpass={DB_PASSWORD} --dbhost={DB_HOST}`
151+
Then STDOUT should be:
152+
"""
153+
Success: Generated 'wp-config.php' file.
154+
"""
155+
156+
When I run `vendor/bin/wp db create`
157+
Then STDOUT should be:
158+
"""
159+
Success: Database created.
160+
"""
161+
162+
When I run `vendor/bin/wp core install --url=localhost:8181 --title=Composer --admin_user=admin --admin_password=password --admin_email=admin@example.com`
163+
Then STDOUT should contain:
164+
"""
165+
Success: WordPress installed successfully.
166+
"""
167+
168+
When I run `vendor/bin/wp core version`
169+
Then STDOUT should contain:
170+
"""
171+
6.1
172+
"""
173+
174+
When I run `vendor/bin/wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'`
175+
Then STDOUT should contain:
176+
"""
177+
object(Requests_Response)
178+
"""
179+
And STDOUT should contain:
180+
"""
181+
HTTP/1.1 200 OK
182+
"""
183+
And STDERR should be empty
184+
185+
When I run `vendor/bin/wp plugin install duplicate-post --activate`
186+
Then STDOUT should contain:
187+
"""
188+
Success: Installed 1 of 1 plugins.
189+
"""
190+
191+
And I launch in the background `wp server --host=localhost --port=8181`
192+
And I run `wp option set blogdescription 'Just another Composer-based WordPress site'`
193+
194+
When I run `curl -sS localhost:8181`
195+
Then STDOUT should contain:
196+
"""
197+
Just another Composer-based WordPress site
198+
"""
199+
200+
When I run `vendor/bin/wp eval 'echo COOKIEHASH;'`
201+
And save STDOUT as {COOKIEHASH}
202+
Then STDOUT should not be empty
203+
204+
When I run `vendor/bin/wp eval 'echo wp_generate_auth_cookie( 1, 32503680000 );'`
205+
And save STDOUT as {AUTH_COOKIE}
206+
Then STDOUT should not be empty
207+
208+
When I run `curl -b 'wordpress_{COOKIEHASH}={AUTH_COOKIE}' -sS localhost:8181/wp-admin/plugins.php`
209+
Then STDOUT should contain:
210+
"""
211+
Plugins</h1>
212+
"""
213+
And STDOUT should contain:
214+
"""
215+
plugin=duplicate-post
216+
"""

0 commit comments

Comments
 (0)