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
120120 When I try the previous command again
121121 Then the return code should be 1
122122
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+
123146 Scenario : Get site info
124147 Given a WP multisite install
125148
Original file line number Diff line number Diff line change @@ -332,7 +332,11 @@ public function delete( $args, $assoc_args ) {
332332 }
333333
334334 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 );
336340 } else {
337341 if ( empty ( $ args ) ) {
338342 WP_CLI ::error ( 'Need to specify a blog id. ' );
You can’t perform that action at this time.
0 commit comments