@@ -93,3 +93,89 @@ Feature: Create a new site on a WP multisite
9393 | blog_id | url |
9494 | 1 | http://localhost/ |
9595 | 2 | http://localhost/newsite/ |
96+
97+ Scenario: Create site with custom URL in subdomain multisite
98+ Given a WP multisite subdomain install
99+
100+ When I run `wp site create --url=http://custom.example.com`
101+ Then STDOUT should contain:
102+ """
103+ Success: Site 2 created: http://custom.example.com/
104+ """
105+
106+ When I run `wp site list --fields=blog_id,url`
107+ Then STDOUT should be a table containing rows:
108+ | blog_id | url |
109+ | 1 | https://example.com/ |
110+ | 2 | http://custom.example.com/ |
111+
112+ When I run `wp --url=custom.example.com option get home`
113+ Then STDOUT should be:
114+ """
115+ http://custom.example.com
116+ """
117+
118+ Scenario: Create site with custom URL in subdirectory multisite
119+ Given a WP multisite subdirectory install
120+
121+ When I run `wp site create --url=http://example.com/custom/path/`
122+ Then STDOUT should contain:
123+ """
124+ Success: Site 2 created: http://example.com/custom/path/
125+ """
126+
127+ When I run `wp site list --fields=blog_id,url`
128+ Then STDOUT should be a table containing rows:
129+ | blog_id | url |
130+ | 1 | https://example.com/ |
131+ | 2 | http://example.com/custom/path/ |
132+
133+ When I run `wp --url=example.com/custom/path option get home`
134+ Then STDOUT should be:
135+ """
136+ http://example.com/custom/path
137+ """
138+
139+ Scenario: Create site with custom URL and explicit slug
140+ Given a WP multisite subdomain install
141+
142+ When I run `wp site create --url=http://custom.example.com --slug=myslug`
143+ Then STDOUT should contain:
144+ """
145+ Success: Site 2 created: http://custom.example.com/
146+ """
147+
148+ Scenario: Error when neither slug nor url is provided
149+ Given a WP multisite install
150+
151+ When I try `wp site create --title="Test Site"`
152+ Then STDERR should be:
153+ """
154+ Error: Either --slug or --url must be provided.
155+ """
156+ And the return code should be 1
157+
158+ Scenario: Error when invalid URL format is provided
159+ Given a WP multisite install
160+
161+ When I try `wp site create --url=not-a-valid-url`
162+ Then STDERR should contain:
163+ """
164+ Error: Invalid URL format
165+ """
166+ And the return code should be 1
167+
168+ Scenario: Preserve existing slug behavior
169+ Given a WP multisite subdomain install
170+
171+ When I run `wp site create --slug=testsite`
172+ Then STDOUT should contain:
173+ """
174+ Success: Site 2 created: http://testsite.example.com/
175+ """
176+
177+ When I run `wp site list --fields=blog_id,url`
178+ Then STDOUT should be a table containing rows:
179+ | blog_id | url |
180+ | 1 | https://example.com/ |
181+ | 2 | http://testsite.example.com/ |
0 commit comments