Skip to content

Commit e0349cb

Browse files
committed
SP-126 Add a few basic tests
1 parent 8a418e4 commit e0349cb

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/BitPaySDK/Util/RESTcli/RESTcli.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,17 @@ class RESTcli
3131
* @var GuzzleHttpClient
3232
*/
3333
protected GuzzleHttpClient $client;
34+
3435
/**
3536
* @var string
3637
*/
3738
protected string $baseUrl;
39+
3840
/**
3941
* @var PrivateKey
4042
*/
4143
protected PrivateKey $ecKey;
44+
4245
/**
4346
* @var string
4447
*/

test/unit/BitPaySDK/ClientTest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,24 @@ public function testWithData()
110110
self::assertInstanceOf(Client::class, $result);
111111
}
112112

113+
/**
114+
* @throws BitPayApiException
115+
*/
116+
public function testWithDataAndXBitPayPlatformInfoHeader()
117+
{
118+
$tokens = $this->createMock(Tokens::class);
119+
$result = $this->getTestedClassInstance()::createWithData(
120+
Env::TEST,
121+
__DIR__ . '/bitpay_private_test.key',
122+
$tokens,
123+
'YourMasterPassword',
124+
null,
125+
'MyPlatform_v1.0.0'
126+
);
127+
128+
self::assertInstanceOf(Client::class, $result);
129+
}
130+
113131
public function testWithDataException()
114132
{
115133
$instance = $this->getTestedClassInstance();
@@ -135,6 +153,20 @@ public function testWithFileJsonConfig(): Client
135153
return $result;
136154
}
137155

156+
/**
157+
* @throws BitPayApiException
158+
*/
159+
public function testWithFileJsonConfigAndXBitPayPlatformInfoHeader(): Client
160+
{
161+
$instance = $this->getTestedClassInstance();
162+
$result = $instance::createWithFile(
163+
__DIR__ . '/BitPay.config-unit.json',
164+
'MyPlatform_v1.0.0'
165+
);
166+
self::assertInstanceOf(Client::class, $result);
167+
return $result;
168+
}
169+
138170
/**
139171
* @throws BitPayGenericException
140172
*/
@@ -145,6 +177,19 @@ public function testWithFileYmlConfig()
145177
self::assertInstanceOf(Client::class, $result);
146178
}
147179

180+
/**
181+
* @throws BitPayGenericException
182+
*/
183+
public function testWithFileYmlConfigAndXBitPayPlatformInfoHeader()
184+
{
185+
$instance = $this->getTestedClassInstance();
186+
$result = $instance::createWithFile(
187+
__DIR__ . '/BitPay.config-unit.yml',
188+
'MyPlatform_v1.0.0'
189+
);
190+
self::assertInstanceOf(Client::class, $result);
191+
}
192+
148193
public function testWithFileException()
149194
{
150195
$instance = $this->getTestedClassInstance();

0 commit comments

Comments
 (0)