GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

UtilTest   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 339
Duplicated Lines 13.57 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 0
Metric Value
wmc 19
lcom 1
cbo 8
dl 46
loc 339
rs 10
c 0
b 0
f 0

19 Methods

Rating   Name   Duplication   Size   Complexity  
A testAutoApplySSL() 0 27 1
A testGetDCVEMailAddressList() 0 24 1
A testResendDCVEMail() 0 9 1
A testEnterDCVCode() 0 15 1
A testAutoRevokeSSL() 0 6 1
A testAutoReplaceSSL() 0 14 1
A testAutoUpdateDcv() 0 14 1
A testProvideEvDetails() 0 10 1
A testGetMdcDomainDetails() 0 16 1
A testCheckRequestString() 0 20 1
A testRequestException() 9 9 1
A testArgumentException() 10 10 1
A testAccountException() 9 9 1
A testCsrException() 9 9 1
A testUnknownApiException() 9 9 1
A testUnknownException() 0 6 1
A testCollectSslStatus() 0 12 1
A testUpdateUserEvClickThrough() 0 11 1
A testCollectSslPeriod() 0 30 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Checkdomain\Comodo\Tests;
3
4
use Checkdomain\Comodo\Model\Result\AutoApplyResult;
5
use Checkdomain\Comodo\Model\Result\AutoReplaceResult;
6
use Checkdomain\Comodo\Model\Result\GetDCVEMailAddressListResult;
7
use Checkdomain\Comodo\Model\Result\GetMDCDomainDetailsResult;
8
9
class UtilTest extends AbstractTest
10
{
11
    /**
12
     * test for applying SSL
13
     */
14
    public function testAutoApplySSL()
15
    {
16
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...eryTime' => '123456'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
17
            'errorCode'            => 1,
18
            'totalCost'            => 12.98,
19
            'orderNumber'          => '123456789',
20
            'certificateID'        => 'abc123456',
21
            'expectedDeliveryTime' => '123456'
22
        ])));
23
24
        $result = $util->autoApplySSL([
25
            'test'                => 'Y',
26
            'product'             => 287,
27
            'serverSoftware'      => 2,
28
            'csr'                 => ('-----BEGIN CERTIFICATE REQUEST-----base64-----END CERTIFICATE REQUEST-----'),
29
            'isCustomerValidated' => 'Y',
30
            'showCertificateID'   => 'Y',
31
            'days'                => 365,
32
        ]);
33
34
        $this->assertInstanceOf(AutoApplyResult::class, $result);
35
        $this->assertEquals('12.98', $result->getTotalCost());
36
        $this->assertEquals('123456', $result->getExpectedDeliveryTime());
37
        $this->assertEquals('abc123456', $result->getCertificateID());
38
        $this->assertEquals('123456789', $result->getOrderNumber());
39
        $this->assertFalse($result->getPaid());
40
    }
41
42
    /**
43
     * test for getting dvc mail addresses
44
     */
45
    public function testGetDCVEMailAddressList()
46
    {
47
        // simulated response Text
48
        $responseText = '0'.chr(10)
49
            .'domain_name	www.test-domain.org'.chr(10)
50
            .'whois_email	 [email protected]'.chr(10)
51
            .'level2_email	 [email protected]'.chr(10)
52
            .'level2_email	 [email protected]'.chr(10)
53
            .'level3_email	 [email protected]'.chr(10)
54
            .'level3_email	 [email protected]'.chr(10);
55
56
        $util = $this->createUtil($this->createGuzzleClient($responseText));
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClient($responseText) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
57
58
        $result = $util->getDCVEMailAddressList(['domainName' => 'www.test-domain.org']);
59
60
        $this->assertInstanceOf(GetDCVEMailAddressListResult::class, $result);
61
        $this->assertEquals(['[email protected]'], $result->getWhoisEmail());
62
        $this->assertEquals('www.test-domain.org', $result->getDomainName());
63
        $this->assertEquals(['[email protected]', '[email protected]'], $result->getLevel2Emails());
64
        $this->assertEquals(
65
            ['[email protected]', '[email protected]'],
66
            $result->getLevel3Emails()
67
        );
68
    }
69
70
    /**
71
     * test for resending dcv mail
72
     */
73
    public function testResendDCVEMail()
74
    {
75
        $util = $this->createUtil($this->createGuzzleClient('errorCode=0'));
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClient('errorCode=0') targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
76
77
        $this->assertTrue($util->resendDCVEMail([
78
            'orderNumber'     => '1234567',
79
            'dcvEmailAddress' => '[email protected]',
80
        ]));
81
    }
82
83
    /**
84
     * test for entering dcv code
85
     */
86
    public function testEnterDCVCode()
87
    {
88
        // simulated response Text
89
        $responseText = '<html><body><p>You have entered the correct Domain Control Validation code. '
90
            .'Your certificate will now be issued and emailed to you shortly. '
91
            .'Please close this window now.'
92
            .'</p></body></html>';
93
94
        $util = $this->createUtil($this->createGuzzleClient($responseText));
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClient($responseText) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
95
96
        $this->assertTrue($util->enterDcvCode([
97
            'orderNumber' => '1234567',
98
            'dcvCode'     => 'testtesttest',
99
        ]));
100
    }
101
102
    /**
103
     * test for revoke ssl
104
     */
105
    public function testAutoRevokeSSL()
106
    {
107
        $util = $this->createUtil($this->createGuzzleClient('errorCode=0'));
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClient('errorCode=0') targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
108
109
        $this->assertTrue($util->autoRevokeSSL(['orderNumber' => '1234567']));
110
    }
111
112
    /**
113
     * test for auto replacing ssl
114
     */
115
    public function testAutoReplaceSSL()
116
    {
117
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...teID' => 'abc123456'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
118
            'errorCode'            => 0,
119
            'expectedDeliveryTime' => 0,
120
            'certificateID'        => 'abc123456',
121
        ])));
122
123
        $result = $util->autoReplaceSSL(['orderNumber' => '1234567']);
124
125
        $this->assertInstanceOf(AutoReplaceResult::class, $result);
126
        $this->assertEquals('0', $result->getExpectedDeliveryTime());
127
        $this->assertEquals('abc123456', $result->getCertificateID());
128
    }
129
130
    /**
131
     * test for auto updating dcv method
132
     */
133
    public function testAutoUpdateDcv()
134
    {
135
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...teID' => 'abc123456'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
136
            'errorCode'            => 0,
137
            'expectedDeliveryTime' => 0,
138
            'certificateID'        => 'abc123456',
139
        ])));
140
141
        $this->assertTrue($util->autoUpdateDCV([
142
            'orderNumber'        => '1234567',
143
            'newDCVEmailAddress' => '[email protected]',
144
            'newMethod'          => 'EMAIL',
145
        ]));
146
    }
147
148
    /**
149
     * test for providing ev details
150
     */
151
    public function testProvideEvDetails()
152
    {
153
        $util = $this->createUtil($this->createGuzzleClient('errorCode=0'));
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClient('errorCode=0') targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
154
155
        $this->assertTrue($util->autoUpdateDCV([
156
            'orderNumber'     => '1234567',
157
            'certReqForename' => 'John',
158
            'certReqSurname'  => 'Test',
159
        ]));
160
    }
161
162
    /**
163
     * test for getting current dcv method
164
     */
165
    public function testGetMdcDomainDetails()
166
    {
167
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...atus' => 'Validated'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
168
            'errorCode'    => 0,
169
            '1_domainName' => 'test.com',
170
            '1_dcvMethod'  => 'EMAIL',
171
            '1_dcvStatus'  => 'Validated',
172
        ])));
173
174
        $result = $util->getMDCDomainDetails(['orderNumber' => '1234567']);
175
176
        $this->assertInstanceOf(GetMDCDomainDetailsResult::class, $result);
177
        $this->assertEquals('test.com', $result->getDomainName());
178
        $this->assertEquals('EMAIL', $result->getDcvMethod());
179
        $this->assertEquals('Validated', $result->getDcvStatus());
180
    }
181
182
    /**
183
     * test, if request-string is correctly formatted
184
     */
185
    public function testCheckRequestString()
186
    {
187
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...'totalCost' => 12.45))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
188
            'errorCode'            => 0,
189
            'certificateID'        => 'abc1231556',
190
            'expectedDeliveryTime' => 0,
191
            'orderNumber'          => 12345678,
192
            'totalCost'            => 12.45,
193
        ])));
194
195
        $result = $util->autoApplySSL([
196
            'orderNumber'     => '1234567',
197
            'dcvMethod'       => 'EMAIL',
198
        ]);
199
200
        $this->assertEquals(
201
            'orderNumber=1234567&dcvMethod=EMAIL&responseFormat=1&showCertificateID=Y',
202
            $result->getRequestQuery()
203
        );
204
    }
205
206
    /**
207
     * @expectedException \Checkdomain\Comodo\Model\Exception\RequestException
208
     */
209 View Code Duplication
    public function testRequestException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
210
    {
211
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...=> 'Invalid Request'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
212
            'errorCode'    => -1,
213
            'errorMessage' => 'Invalid Request',
214
        ])));
215
216
        $util->autoApplySSL([]);
217
    }
218
219
    /**
220
     * @expectedException \Checkdomain\Comodo\Model\Exception\ArgumentException
221
     */
222 View Code Duplication
    public function testArgumentException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
223
    {
224
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...=> 'Invalid Request'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
225
            'errorCode'    => -2,
226
            'errorItem'    => 'field',
227
            'errorMessage' => 'Invalid Request',
228
        ])));
229
230
        $util->autoApplySSL([]);
231
    }
232
233
    /**
234
     * @expectedException \Checkdomain\Comodo\Model\Exception\AccountException
235
     */
236 View Code Duplication
    public function testAccountException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
237
    {
238
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...=> 'Invalid Request'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
239
            'errorCode'    => -15,
240
            'errorMessage' => 'Invalid Request',
241
        ])));
242
243
        $util->autoApplySSL([]);
244
    }
245
246
    /**
247
     * @expectedException \Checkdomain\Comodo\Model\Exception\CsrException
248
     */
249 View Code Duplication
    public function testCsrException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
250
    {
251
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...=> 'Invalid Request'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
252
            'errorCode'    => -5,
253
            'errorMessage' => 'Invalid Request',
254
        ])));
255
256
        $util->autoApplySSL([]);
257
    }
258
259
    /**
260
     * @expectedException \Checkdomain\Comodo\Model\Exception\UnknownApiException
261
     */
262 View Code Duplication
    public function testUnknownApiException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
263
    {
264
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...=> 'Invalid Request'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
265
            'errorCode'    => -14,
266
            'errorMessage' => 'Invalid Request',
267
        ])));
268
269
        $util->autoApplySSL([]);
270
    }
271
272
    /**
273
     * @expectedException \Checkdomain\Comodo\Model\Exception\UnknownException
274
     */
275
    public function testUnknownException()
276
    {
277
        $util = $this->createUtil($this->createGuzzleClient('Internal Server Error'));
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...Internal Server Error') targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
278
279
        $util->autoApplySSL([]);
280
    }
281
282
    /**
283
     * test, for getting status of certificate
284
     */
285
    public function testCollectSslStatus()
286
    {
287
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...eStatus' => 'Issued'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
288
            'errorCode'         => 1,
289
            'orderNumber'       => 12345678,
290
            'certificateStatus' => 'Issued',
291
        ])));
292
293
        $result = $util->collectSsl(['showExtStatus' => 'Y']);
294
295
        $this->assertEquals('Issued', $result->getCertificateStatus());
296
    }
297
298
299
    /**
300
     * test, for getting status of certificate
301
     */
302
    public function testUpdateUserEvClickThrough()
303
    {
304
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien... => 0, 'status' => 1))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
305
            'errorCode' => 0,
306
            'status'    => 1,
307
        ])));
308
309
        $result = $util->updateUserEvClickThrough([]);
310
311
        $this->assertEquals(1, $result->getStatus());
312
    }
313
314
    /**
315
     * test, for getting period of certificate
316
     */
317
    public function testCollectSslPeriod()
318
    {
319
        $caCertificate = ['-----BEGIN CERTIFICATE-----'.chr(10).'123'.chr(10).'-----END CERTIFICATE-----'];
320
        $certificate = '-----BEGIN CERTIFICATE-----'.chr(10).'234'.chr(10). '-----END CERTIFICATE-----';
321
322
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...CallBackStatus' => 2))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
323
            'errorCode'         => 1,
324
            'orderNumber'       => 12345678,
325
            'notBefore'         => 1388576001,
326
            'notAfter'          => 1420112001,
327
            'csrStatus'         => 4,
328
            'certificateStatus' => 3,
329
            'validationStatus'  => 1,
330
            'certificate'       => 234,
331
            'caCertificate'     => 123,
332
            'ovCallBackStatus'  => 2,
333
        ])));
334
335
        $result = $util->collectSsl([]);
336
337
        $this->assertEquals($caCertificate, $result->getCaCertificate());
338
        $this->assertEquals($certificate, $result->getCertificate());
339
        $this->assertEquals('1', $result->getValidationStatus());
340
        $this->assertEquals('2', $result->getOvCallBackStatus());
341
        $this->assertEquals('3', $result->getCertificateStatus());
342
        $this->assertEquals('4', $result->getCsrStatus());
343
        $this->assertEquals('12345678', $result->getOrderNumber());
344
        $this->assertEquals('01.01.2014', $result->getNotBefore()->format('d.m.Y'));
345
        $this->assertEquals('01.01.2015', $result->getNotAfter()->format('d.m.Y'));
346
    }
347
}
348