File tree Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,33 @@ Feature: Manage sites in a multisite installation
139
139
When I try the previous command again
140
140
Then STDERR should contain:
141
141
"""
142
- Site with slug '42' does not exist.
142
+ Error: Could not find site with slug '42'.
143
+ """
144
+ And the return code should be 1
145
+
146
+ Scenario : Archive a site by a numeric slug
147
+ Given a WP multisite install
148
+
149
+ When I run `wp site create --slug=42`
150
+ Then STDOUT should contain:
151
+ """
152
+ Success: Site 2 created: http
153
+ """
154
+ And STDOUT should contain:
155
+ """
156
+ ://example.com/42/
157
+ """
158
+
159
+ When I run `wp site archive --slug=42`
160
+ Then STDOUT should contain:
161
+ """
162
+ Success: Site 2 archived.
163
+ """
164
+
165
+ When I try `wp site archive --slug=43`
166
+ Then STDERR should contain:
167
+ """
168
+ Error: Could not find site with slug '43'.
143
169
"""
144
170
And the return code should be 1
145
171
Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ public function delete( $args, $assoc_args ) {
334
334
if ( isset ( $ assoc_args ['slug ' ] ) ) {
335
335
$ blog_id = get_id_from_blogname ( $ assoc_args ['slug ' ] );
336
336
if ( null === $ blog_id ) {
337
- WP_CLI ::error ( " Site with slug ' { $ assoc_args ['slug ' ]} ' does not exist. " );
337
+ WP_CLI ::error ( sprintf ( ' Could not find site with slug \' %s \' . ' , $ assoc_args ['slug ' ] ) );
338
338
}
339
339
$ blog = get_blog_details ( $ blog_id );
340
340
} else {
@@ -982,11 +982,11 @@ private function get_sites_ids( $args, $assoc_args ) {
982
982
$ slug = Utils \get_flag_value ( $ assoc_args , 'slug ' , false );
983
983
984
984
if ( $ slug ) {
985
- $ blog = get_blog_details ( trim ( $ slug , '/ ' ) );
986
- if ( ! $ blog ) {
985
+ $ blog_id = get_id_from_blogname ( trim ( $ slug , '/ ' ) );
986
+ if ( null === $ blog_id ) {
987
987
WP_CLI ::error ( sprintf ( 'Could not find site with slug \'%s \'. ' , $ slug ) );
988
988
}
989
- return [ $ blog -> blog_id ];
989
+ return [ $ blog_id ];
990
990
}
991
991
992
992
return $ args ;
You can’t perform that action at this time.
0 commit comments