@@ -46,16 +46,17 @@ public function testDelete()
46
46
47
47
public function testRequestCreateWebspace ()
48
48
{
49
- $ id = uniqid ();
50
- $ password = base64_encode (time ());
51
- $ name = "d {$ id }.test " ;
52
-
53
- $ handler = static ::$ _client ->phpHandler ()->get (null , null );
49
+ $ handlers = static ::$ _client ->phpHandler ()->getAll ();
50
+ $ enabledHandlers = array_filter ($ handlers , function ($ handler ) {
51
+ return $ handler ->handlerStatus !== 'disabled ' ;
52
+ });
53
+ $ this ->assertGreaterThan (0 , count ($ enabledHandlers ));
54
+ $ handler = current ($ enabledHandlers );
54
55
55
56
$ request = [
56
57
'add ' => [
57
58
'gen_setup ' => [
58
- 'name ' => $ name ,
59
+ 'name ' => ' webspace-test-full.test ' ,
59
60
'htype ' => 'vrt_hst ' ,
60
61
'status ' => '0 ' ,
61
62
'ip_address ' => [static ::_getIpAddress ()],
@@ -69,11 +70,11 @@ public function testRequestCreateWebspace()
69
70
],
70
71
[
71
72
'name ' => 'ftp_login ' ,
72
- 'value ' => " u { $ id }" ,
73
+ 'value ' => ' testuser ' ,
73
74
],
74
75
[
75
76
'name ' => 'ftp_password ' ,
76
- 'value ' => $ password ,
77
+ 'value ' => ' test-PWD*1 ' ,
77
78
],
78
79
],
79
80
'ip_address ' => static ::_getIpAddress (),
@@ -120,17 +121,7 @@ public function testRequestCreateWebspace()
120
121
],
121
122
];
122
123
123
- try {
124
- $ webspace = static ::$ _client ->webspace ()->request ($ request );
125
- } catch (\Exception $ e ) {
126
- try {
127
- $ webspaceInfo = static ::$ _client ->webspace ()->get ('name ' , $ name );
128
- static ::$ _client ->webspace ()->delete ('guid ' , $ webspaceInfo ->guid );
129
- } catch (\Exception $ e ) {
130
- }
131
-
132
- $ this ->fail ($ e ->getMessage ());
133
- }
124
+ $ webspace = static ::$ _client ->webspace ()->request ($ request );
134
125
135
126
$ this ->assertGreaterThan (0 , $ webspace ->id );
136
127
@@ -142,8 +133,8 @@ public function testGet()
142
133
$ webspace = static ::_createWebspace ();
143
134
$ webspaceInfo = static ::$ _client ->webspace ()->get ('id ' , $ webspace ->id );
144
135
136
+ $ this ->assertInstanceOf (\PleskX \Api \Struct \Webspace \GeneralInfo::class, $ webspaceInfo );
145
137
$ this ->assertNotEmpty ($ webspaceInfo ->name );
146
138
$ this ->assertEquals (0 , $ webspaceInfo ->realSize );
147
-
148
139
}
149
140
}
0 commit comments