-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathSmsapiClientIntegrationTestCase.php
More file actions
53 lines (43 loc) · 1.58 KB
/
Copy pathSmsapiClientIntegrationTestCase.php
File metadata and controls
53 lines (43 loc) · 1.58 KB
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
<?php
declare(strict_types=1);
namespace Smsapi\Client\Tests;
use RuntimeException;
use Smsapi\Client\Curl\SmsapiHttpClient;
use Smsapi\Client\Service\SmsapiComService;
use Smsapi\Client\Service\SmsapiPlService;
class SmsapiClientIntegrationTestCase extends SmsapiClientTestCase
{
/**
* @beforeClass
*/
public static function prepare()
{
self::$apiToken = Config::get('API token');
if (self::$apiToken === null) {
self::markTestSkipped('Missing API token - create "tests-resources/config/config.yml"');
}
if (!is_string(self::$apiToken)) {
throw new RuntimeException('Invalid API token');
}
$apiUri = Config::get('API URI');
$smsapiHttpClient = new SmsapiHttpClient();
$serviceName = Config::get('Service name');
if ($serviceName === ServiceName::SMSAPI_PL) {
self::$smsapiService = $smsapiHttpClient->smsapiPlServiceWithUri(self::$apiToken, $apiUri);
} elseif ($serviceName === ServiceName::SMSAPI_COM) {
self::$smsapiService = $smsapiHttpClient->smsapiComServiceWithUri(self::$apiToken, $apiUri);
}
}
protected static function skipIfServiceIsNotCom()
{
if (!(self::$smsapiService instanceof SmsapiComService)) {
self::markTestSkipped('Feature available for COM service only.');
}
}
protected static function skipIfServiceIsNotPl()
{
if (!(self::$smsapiService instanceof SmsapiPlService)) {
self::markTestSkipped('Feature available for PL service only.');
}
}
}