-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTKGMServiceTest.php
72 lines (62 loc) · 1.94 KB
/
TKGMServiceTest.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
<?php
namespace Burakaktna\TKGMService\Tests;
use Burakaktna\TKGMService\Contracts\ITKGMService;
use Burakaktna\TKGMService\TKGMService;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
class TKGMServiceTest extends TestCase
{
protected ITKGMService $tkgmService;
protected function setUp(): void
{
$mock = new MockHandler([
new Response(200, [], '{"success":true, "data":[]}'),
new Response(200, [], '{"success":true, "data":[]}'),
new Response(200, [], '{"success":true, "data":[]}'),
new Response(200, [], '{"success":true, "data":[]}')
]);
$handlerStack = HandlerStack::create($mock);
$client = new Client(['handler' => $handlerStack]);
$this->tkgmService = new TKGMService($client);
}
/**
* @throws GuzzleException
*/
public function testGetProvinces(): void
{
$response = $this->tkgmService->getProvinces();
$this->assertTrue($response->success);
$this->assertIsArray($response->data);
}
/**
* @throws GuzzleException
*/
public function testGetDistricts(): void
{
$response = $this->tkgmService->getDistricts(1);
$this->assertTrue($response->success);
$this->assertIsArray($response->data);
}
/**
* @throws GuzzleException
*/
public function testGetNeighborhoods(): void
{
$response = $this->tkgmService->getNeighborhoods(1);
$this->assertTrue($response->success);
$this->assertIsArray($response->data);
}
/**
* @throws GuzzleException
*/
public function testParcelInquiry(): void
{
$response = $this->tkgmService->parcelInquiry(1, 1, 1);
$this->assertTrue($response->success);
$this->assertIsArray($response->data);
}
}