-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigTest.php
85 lines (68 loc) · 1.95 KB
/
ConfigTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
require __DIR__ . '/../vendor/autoload.php';
use Ay4t\RestClient\Config\Config;
use PHPUnit\Framework\TestCase;
class ConfigTest extends TestCase
{
/**
* @test
*/
public function testKonstruktorDenganApiKeySekretKeyDanApiUrl()
{
$apiKey = '1234567890';
$secretKey = 'abcdefghij';
$apiUrl = 'https://example.com/api';
$config = new Config($apiKey, $secretKey, $apiUrl);
$this->assertEquals($apiKey, $config->apiKey);
$this->assertEquals($secretKey, $config->secretKey);
$this->assertEquals($apiUrl, $config->apiUrl);
}
/**
* @test
*/
public function testKonstruktorDenganApiKeyKosong()
{
$this->expectException(\InvalidArgumentException::class);
new Config('', 'abcdefghij', 'https://example.com/api');
}
/**
* @test
*/
public function testKonstruktorDenganSecretKeyKosong()
{
$this->expectException(\InvalidArgumentException::class);
new Config('1234567890', '', 'https://example.com/api');
}
/**
* @test
*/
public function testKonstruktorDenganApiUrlKosong()
{
$this->expectException(\InvalidArgumentException::class);
new Config('1234567890', 'abcdefghij', '');
}
/**
* @test
*/
public function testKonstruktorDenganApiKeyTidakValid()
{
$this->expectException(\InvalidArgumentException::class);
new Config('abc', 'abcdefghij', 'https://example.com/api');
}
/**
* @test
*/
public function testKonstruktorDenganSecretKeyTidakValid()
{
$this->expectException(\InvalidArgumentException::class);
new Config('1234567890', 'abc', 'https://example.com/api');
}
/**
* @test
*/
public function testKonstruktorDenganApiUrlTidakValid()
{
$this->expectException(\InvalidArgumentException::class);
new Config('1234567890', 'abcdefghij', 'abc');
}
}