6
6
use GuzzleHttp \Handler \MockHandler ;
7
7
use GuzzleHttp \HandlerStack ;
8
8
use GuzzleHttp \Psr7 \Response ;
9
- use Faker \Factory as Faker ;
10
9
use PHPUnit \Framework \TestCase ;
11
10
use UKFast \SDK \DDoSX \DomainVerificationClient ;
12
11
use UKFast \SDK \Exception \ValidationException ;
13
12
14
13
class DomainVerificationTest extends TestCase
15
14
{
16
- protected $ faker ;
17
-
18
- protected function setUp ()
19
- {
20
- parent ::setUp ();
21
-
22
- $ this ->faker = Faker::create ();
23
- }
24
-
25
-
26
15
/**
27
16
* @test
28
17
*/
29
18
public function verify_domain_via_dns ()
30
19
{
31
- $ domainName = $ this -> faker -> domainName ;
20
+ $ domainName = ' example.com ' ;
32
21
$ mock = new MockHandler ([
33
22
new Response (200 ),
34
23
new Response (422 , [], json_encode ([
@@ -47,15 +36,15 @@ public function verify_domain_via_dns()
47
36
$ this ->assertTrue ($ client ->verifyByDns ($ domainName ));
48
37
49
38
$ this ->expectException (ValidationException::class);
50
- $ client ->verifyByDns ($ this -> faker -> domainName );
39
+ $ client ->verifyByDns (' example.com ' );
51
40
}
52
41
53
42
/**
54
43
* @test
55
44
*/
56
45
public function verify_domain_via_file_upload ()
57
46
{
58
- $ domainName = $ this -> faker -> domainName ;
47
+ $ domainName = ' example.com ' ;
59
48
$ mock = new MockHandler ([
60
49
new Response (200 ),
61
50
new Response (422 , [], json_encode ([
@@ -74,16 +63,16 @@ public function verify_domain_via_file_upload()
74
63
$ this ->assertTrue ($ client ->verifyByDns ($ domainName ));
75
64
76
65
$ this ->expectException (ValidationException::class);
77
- $ client ->verifyByDns ($ this -> faker -> domainName );
66
+ $ client ->verifyByDns (' example.com ' );
78
67
}
79
68
80
69
/**
81
70
* @test
82
71
*/
83
72
public function download_verification_file ()
84
73
{
85
- $ filename = $ this -> faker -> word . ' .txt ' ;
86
- $ verificationString = $ this -> faker -> word . PHP_EOL . $ this -> faker -> word ;
74
+ $ filename = ' test .txt ' ;
75
+ $ verificationString = ' test1 ' . PHP_EOL . ' test2 ' ;
87
76
$ contentType = 'text/plain; charset=UTF-8 ' ;
88
77
89
78
$ mock = new MockHandler ([
@@ -96,7 +85,7 @@ public function download_verification_file()
96
85
$ guzzle = new Client (['handler ' => HandlerStack::create ($ mock )]);
97
86
$ client = new DomainVerificationClient ($ guzzle );
98
87
99
- $ verificationFile = $ client ->getVerificationFile ($ this -> faker -> domainName );
88
+ $ verificationFile = $ client ->getVerificationFile (' example.com ' );
100
89
101
90
$ this ->assertEquals ($ filename , $ verificationFile ->getName ());
102
91
$ this ->assertEquals ($ verificationString , $ verificationFile ->getStream ()->getContents ());
0 commit comments