File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,29 @@ Feature: Manage sites in a multisite installation
120
120
When I try the previous command again
121
121
Then the return code should be 1
122
122
123
+ When I run `wp site create --slug=42`
124
+ Then STDOUT should contain:
125
+ """
126
+ Success: Site 3 created: http
127
+ """
128
+ And STDOUT should contain:
129
+ """
130
+ ://example.com/42/
131
+ """
132
+
133
+ When I run `wp site delete --slug=42 --yes`
134
+ Then STDOUT should contain:
135
+ """
136
+ ://example.com/42/' was deleted.
137
+ """
138
+
139
+ When I try the previous command again
140
+ Then STDERR should contain:
141
+ """
142
+ Site with slug '42' does not exist.
143
+ """
144
+ And the return code should be 1
145
+
123
146
Scenario : Get site info
124
147
Given a WP multisite install
125
148
Original file line number Diff line number Diff line change @@ -332,7 +332,11 @@ public function delete( $args, $assoc_args ) {
332
332
}
333
333
334
334
if ( isset ( $ assoc_args ['slug ' ] ) ) {
335
- $ blog = get_blog_details ( trim ( $ assoc_args ['slug ' ], '/ ' ) );
335
+ $ blog_id = get_id_from_blogname ( $ assoc_args ['slug ' ] );
336
+ if ( null === $ blog_id ) {
337
+ WP_CLI ::error ( "Site with slug ' {$ assoc_args ['slug ' ]}' does not exist. " );
338
+ }
339
+ $ blog = get_blog_details ( $ blog_id );
336
340
} else {
337
341
if ( empty ( $ args ) ) {
338
342
WP_CLI ::error ( 'Need to specify a blog id. ' );
You can’t perform that action at this time.
0 commit comments