@@ -2,6 +2,7 @@ Feature: Manage super admins associated with a multisite instance
22
33 Scenario : Add, list, and remove super admins.
44 Given a WP multisite installation
5+
56 When I run `wp user create superadmin superadmin@example.com`
67 And I run `wp super-admin list`
78 Then STDOUT should be:
@@ -232,3 +233,112 @@ Feature: Manage super admins associated with a multisite instance
232233
233234 When I run `wp super-admin list`
234235 Then STDERR should be empty
236+
237+ Scenario : Add, list, and remove super admins.
238+ Given a WP multisite installation
239+ And a wp-content/mu-plugins/test-hooks.php file:
240+ """
241+ <?php
242+ add_action( 'grant_super_admin', static function () {
243+ WP_CLI::log( 'grant_super_admin hook was fired.' );
244+ });
245+ add_action( 'granted_super_admin', static function () {
246+ WP_CLI::log( 'granted_super_admin hook was fired.' );
247+ });
248+ add_action( 'revoke_super_admin', static function () {
249+ WP_CLI::log( 'revoke_super_admin hook was fired.' );
250+ });
251+ add_action( 'revoked_super_admin', static function () {
252+ WP_CLI::log( 'revoked_super_admin hook was fired.' );
253+ });
254+ """
255+
256+ When I run `wp user create superadmin superadmin@example.com`
257+ Then STDOUT should contain:
258+ """
259+ grant_super_admin hook was fired.
260+ """
261+ And STDOUT should contain:
262+ """
263+ granted_super_admin hook was fired.
264+ """
265+
266+ When I run `wp super-admin add superadmin`
267+ Then STDOUT should contain:
268+ """
269+ grant_super_admin hook was fired.
270+ """
271+ And STDOUT should contain:
272+ """
273+ granted_super_admin hook was fired.
274+ """
275+
276+ When I try `wp super-admin add superadmin`
277+ Then STDOUT should contain:
278+ """
279+ grant_super_admin hook was fired.
280+ """
281+ And STDOUT should not contain:
282+ """
283+ granted_super_admin hook was fired.
284+ """
285+
286+ When I run `wp super-admin remove admin`
287+ Then STDOUT should contain:
288+ """
289+ revoke_super_admin hook was fired.
290+ """
291+ And STDOUT should contain:
292+ """
293+ revoked_super_admin hook was fired.
294+ """
295+
296+ When I try `wp super-admin add noadmin`
297+ Then STDOUT should contain:
298+ """
299+ grant_super_admin hook was fired.
300+ """
301+ And STDOUT should not contain:
302+ """
303+ granted_super_admin hook was fired.
304+ """
305+
306+ When I try `wp super-admin add admin noadmin`
307+ Then STDOUT should contain:
308+ """
309+ grant_super_admin hook was fired.
310+ """
311+ And STDOUT should not contain:
312+ """
313+ granted_super_admin hook was fired.
314+ """
315+
316+ When I try `wp super-admin remove noadmin`
317+ Then STDOUT should contain:
318+ """
319+ revoke_super_admin hook was fired.
320+ """
321+ And STDOUT should not contain:
322+ """
323+ revoked_super_admin hook was fired.
324+ """
325+
326+ When I try `wp super-admin remove admin admin@example.com noadmin superadmin`
327+ Then STDOUT should contain:
328+ """
329+ revoke_super_admin hook was fired.
330+ """
331+ And STDOUT should contain:
332+ """
333+ revoked_super_admin hook was fired.
334+ """
335+
336+ When I try `wp super-admin remove superadmin`
337+ Then STDOUT should contain:
338+ """
339+ revoke_super_admin hook was fired.
340+ """
341+ And STDOUT should not contain:
342+ """
343+ revoked_super_admin hook was fired.
344+ """
0 commit comments