@@ -10,9 +10,9 @@ class ApiClientTest extends TestCase
10
10
*/
11
11
public function testWrongProtocol ()
12
12
{
13
- $ packet = $ this -> _client ->getPacket ('100.0.0 ' );
13
+ $ packet = static :: $ _client ->getPacket ('100.0.0 ' );
14
14
$ packet ->addChild ('server ' )->addChild ('get_protos ' );
15
- $ this -> _client ->request ($ packet );
15
+ static :: $ _client ->request ($ packet );
16
16
}
17
17
18
18
/**
@@ -21,9 +21,9 @@ public function testWrongProtocol()
21
21
*/
22
22
public function testUnknownOperator ()
23
23
{
24
- $ packet = $ this -> _client ->getPacket ();
24
+ $ packet = static :: $ _client ->getPacket ();
25
25
$ packet ->addChild ('unknown ' );
26
- $ this -> _client ->request ($ packet );
26
+ static :: $ _client ->request ($ packet );
27
27
}
28
28
29
29
/**
@@ -32,7 +32,7 @@ public function testUnknownOperator()
32
32
*/
33
33
public function testInvalidXmlRequest ()
34
34
{
35
- $ this -> _client ->request ('<packet><wrongly formatted xml</packet> ' );
35
+ static :: $ _client ->request ('<packet><wrongly formatted xml</packet> ' );
36
36
}
37
37
38
38
/**
@@ -41,12 +41,12 @@ public function testInvalidXmlRequest()
41
41
*/
42
42
public function testInvalidCredentials ()
43
43
{
44
- $ host = $ this -> _client ->getHost ();
45
- $ port = $ this -> _client ->getPort ();
46
- $ protocol = $ this -> _client ->getProtocol ();
44
+ $ host = static :: $ _client ->getHost ();
45
+ $ port = static :: $ _client ->getPort ();
46
+ $ protocol = static :: $ _client ->getProtocol ();
47
47
$ client = new PleskX \Api \Client ($ host , $ port , $ protocol );
48
48
$ client ->setCredentials ('bad-login ' , 'bad-password ' );
49
- $ packet = $ this -> _client ->getPacket ();
49
+ $ packet = static :: $ _client ->getPacket ();
50
50
$ packet ->addChild ('server ' )->addChild ('get_protos ' );
51
51
$ client ->request ($ packet );
52
52
}
@@ -57,46 +57,46 @@ public function testInvalidCredentials()
57
57
*/
58
58
public function testInvalidSecretKey ()
59
59
{
60
- $ host = $ this -> _client ->getHost ();
61
- $ port = $ this -> _client ->getPort ();
62
- $ protocol = $ this -> _client ->getProtocol ();
60
+ $ host = static :: $ _client ->getHost ();
61
+ $ port = static :: $ _client ->getPort ();
62
+ $ protocol = static :: $ _client ->getProtocol ();
63
63
$ client = new PleskX \Api \Client ($ host , $ port , $ protocol );
64
64
$ client ->setSecretKey ('bad-key ' );
65
- $ packet = $ this -> _client ->getPacket ();
65
+ $ packet = static :: $ _client ->getPacket ();
66
66
$ packet ->addChild ('server ' )->addChild ('get_protos ' );
67
67
$ client ->request ($ packet );
68
68
}
69
69
70
70
public function testLatestMajorProtocol ()
71
71
{
72
- $ packet = $ this -> _client ->getPacket ('1.6 ' );
72
+ $ packet = static :: $ _client ->getPacket ('1.6 ' );
73
73
$ packet ->addChild ('server ' )->addChild ('get_protos ' );
74
- $ this -> _client ->request ($ packet );
74
+ static :: $ _client ->request ($ packet );
75
75
}
76
76
77
77
public function testLatestMinorProtocol ()
78
78
{
79
- $ packet = $ this -> _client ->getPacket ('1.6.5 ' );
79
+ $ packet = static :: $ _client ->getPacket ('1.6.5 ' );
80
80
$ packet ->addChild ('server ' )->addChild ('get_protos ' );
81
- $ this -> _client ->request ($ packet );
81
+ static :: $ _client ->request ($ packet );
82
82
}
83
83
84
84
public function testRequestShortSyntax ()
85
85
{
86
- $ response = $ this -> _client ->request ('server.get.gen_info ' );
86
+ $ response = static :: $ _client ->request ('server.get.gen_info ' );
87
87
$ this ->assertGreaterThan (0 , strlen ($ response ->gen_info ->server_name ));
88
88
}
89
89
90
90
public function testOperatorPlainRequest ()
91
91
{
92
- $ response = $ this -> _client ->server ()->request ('get.gen_info ' );
92
+ $ response = static :: $ _client ->server ()->request ('get.gen_info ' );
93
93
$ this ->assertGreaterThan (0 , strlen ($ response ->gen_info ->server_name ));
94
94
$ this ->assertEquals (36 , strlen ($ response ->getValue ('server_guid ' )));
95
95
}
96
96
97
97
public function testRequestArraySyntax ()
98
98
{
99
- $ response = $ this -> _client ->request ([
99
+ $ response = static :: $ _client ->request ([
100
100
'server ' => [
101
101
'get ' => [
102
102
'gen_info ' => '' ,
@@ -108,13 +108,13 @@ public function testRequestArraySyntax()
108
108
109
109
public function testOperatorArraySyntax ()
110
110
{
111
- $ response = $ this -> _client ->server ()->request (['get ' => ['gen_info ' => '' ]]);
111
+ $ response = static :: $ _client ->server ()->request (['get ' => ['gen_info ' => '' ]]);
112
112
$ this ->assertGreaterThan (0 , strlen ($ response ->gen_info ->server_name ));
113
113
}
114
114
115
115
public function testMultiRequest ()
116
116
{
117
- $ responses = $ this -> _client ->multiRequest ([
117
+ $ responses = static :: $ _client ->multiRequest ([
118
118
'server.get_protos ' ,
119
119
'server.get.gen_info ' ,
120
120
]);
0 commit comments