Skip to content

Commit 9e11596

Browse files
Copilotswissspidy
andauthored
Stabilize Windows Behat failures in scaffold package/readme scenarios (#294)
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 0af5005 commit 9e11596

2 files changed

Lines changed: 39 additions & 17 deletions

File tree

features/scaffold-package-readme.feature

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,17 @@ Feature: Scaffold a README.md file for an existing package
9494
Scenario: Scaffold a README.md requiring a nightly build
9595
Given an empty directory
9696

97-
When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='>=0.24.0-alpha'`
97+
And a foo/composer.json file:
98+
"""
99+
{
100+
"name": "wp-cli/foo",
101+
"require": {
102+
"wp-cli/wp-cli": ">=0.24.0-alpha"
103+
}
104+
}
105+
"""
106+
107+
When I run `wp scaffold package-readme foo`
98108
Then STDOUT should contain:
99109
"""
100110
Success: Created package readme.
@@ -103,23 +113,27 @@ Feature: Scaffold a README.md file for an existing package
103113
"""
104114
"require": {
105115
"wp-cli/wp-cli": ">=0.24.0-alpha"
106-
},
116+
}
107117
"""
108118
And the foo/README.md file should exist
109119
And the foo/README.md file should contain:
110120
"""
111121
Installing this package requires WP-CLI v0.24.0-alpha or greater. Update to the latest nightly release with `wp cli update --nightly`.
112122
"""
113-
When I run `wp package uninstall wp-cli/foo`
114-
Then STDOUT should contain:
115-
"""
116-
Success: Uninstalled package.
117-
"""
118-
119123
Scenario: Scaffold a README.md requiring the latest stable release
120124
Given an empty directory
121125

122-
When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='*'`
126+
And a foo/composer.json file:
127+
"""
128+
{
129+
"name": "wp-cli/foo",
130+
"require": {
131+
"wp-cli/wp-cli": "*"
132+
}
133+
}
134+
"""
135+
136+
When I run `wp scaffold package-readme foo`
123137
Then STDOUT should contain:
124138
"""
125139
Success: Created package readme.
@@ -128,19 +142,13 @@ Feature: Scaffold a README.md file for an existing package
128142
"""
129143
"require": {
130144
"wp-cli/wp-cli": "*"
131-
},
145+
}
132146
"""
133147
And the foo/README.md file should exist
134148
And the foo/README.md file should contain:
135149
"""
136150
Installing this package requires WP-CLI's latest stable release. Update to the latest stable release with `wp cli update`.
137151
"""
138-
When I run `wp package uninstall wp-cli/foo`
139-
Then STDOUT should contain:
140-
"""
141-
Success: Uninstalled package.
142-
"""
143-
144152
Scenario: Scaffold a readme with custom shields
145153
Given an empty directory
146154
And a foo/composer.json file:
@@ -182,6 +190,13 @@ Feature: Scaffold a README.md file for an existing package
182190

183191
Scenario: Scaffold a readme with a remote support body
184192
Given an empty directory
193+
And that HTTP requests to https://gist.githubusercontent.com/danielbachhuber/bb652b1b744cea541705ee9c13605dad/raw/195c17ebb8cf25e947a9df6e02de1e96a084c287/support.md will respond with:
194+
"""
195+
HTTP/1.1 200 OK
196+
Content-Type: text/plain
197+
198+
Support isn't free!
199+
"""
185200
And a foo/composer.json file:
186201
"""
187202
{
@@ -209,6 +224,13 @@ Feature: Scaffold a README.md file for an existing package
209224

210225
Scenario: Scaffold a readme with a pre, post and body for the section
211226
Given an empty directory
227+
And that HTTP requests to https://gist.githubusercontent.com/danielbachhuber/bb652b1b744cea541705ee9c13605dad/raw/195c17ebb8cf25e947a9df6e02de1e96a084c287/support.md will respond with:
228+
"""
229+
HTTP/1.1 200 OK
230+
Content-Type: text/plain
231+
232+
Support isn't free!
233+
"""
212234
And a foo/composer.json file:
213235
"""
214236
{

src/ScaffoldPackageCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function package( $args, $assoc_args ) {
135135
}
136136

137137
// Convert to absolute path if relative.
138-
if ( ! preg_match( '#^([a-zA-Z]:)?[\\/]#', $package_dir ) ) {
138+
if ( ! preg_match( '#^([a-zA-Z]:)?[\\\\/]#', $package_dir ) ) {
139139
$cwd = getcwd();
140140
if ( false === $cwd ) {
141141
WP_CLI::error( 'Could not determine current working directory.' );

0 commit comments

Comments
 (0)