| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,78 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Telnyx; |
|
| 4 |
+ |
|
| 5 |
+/** |
|
| 6 |
+ * @internal |
|
| 7 |
+ * @covers \Telnyx\Telnyx |
|
| 8 |
+ */ |
|
| 9 |
+final class TelnyxTest extends \Telnyx\TestCase |
|
| 10 |
+{
|
|
| 11 |
+ /** @var array */ |
|
| 12 |
+ protected $orig; |
|
| 13 |
+ |
|
| 14 |
+ /** |
|
| 15 |
+ * @before |
|
| 16 |
+ */ |
|
| 17 |
+ public function saveOriginalValues() |
|
| 18 |
+ {
|
|
| 19 |
+ $this->orig = [ |
|
| 20 |
+ 'caBundlePath' => Telnyx::$caBundlePath, |
|
| 21 |
+ ]; |
|
| 22 |
+ } |
|
| 23 |
+ |
|
| 24 |
+ /** |
|
| 25 |
+ * @after |
|
| 26 |
+ */ |
|
| 27 |
+ public function restoreOriginalValues() |
|
| 28 |
+ {
|
|
| 29 |
+ Telnyx::$caBundlePath = $this->orig['caBundlePath']; |
|
| 30 |
+ } |
|
| 31 |
+ |
|
| 32 |
+ public function testCABundlePathAccessors() |
|
| 33 |
+ {
|
|
| 34 |
+ Telnyx::setCABundlePath('path/to/ca/bundle');
|
|
| 35 |
+ static::assertSame('path/to/ca/bundle', Telnyx::getCABundlePath());
|
|
| 36 |
+ } |
|
| 37 |
+ |
|
| 38 |
+ public function testAppInfo() {
|
|
| 39 |
+ $app_info = []; |
|
| 40 |
+ $app_info['name'] = 'test_app'; |
|
| 41 |
+ $app_info['partner_id'] = 'partner_id'; |
|
| 42 |
+ $app_info['url'] = 'url/to/app'; |
|
| 43 |
+ $app_info['version'] = '123'; |
|
| 44 |
+ |
|
| 45 |
+ Telnyx::setAppInfo($app_info['name'], $app_info['version'], $app_info['url'], $app_info['partner_id']); |
|
| 46 |
+ static::assertSame($app_info, Telnyx::getAppInfo()); |
|
| 47 |
+ } |
|
| 48 |
+ |
|
| 49 |
+ public function testSetsGets() |
|
| 50 |
+ {
|
|
| 51 |
+ Telnyx::setApiKey('TEST89328');
|
|
| 52 |
+ static::assertSame('TEST89328', Telnyx::getApiKey());
|
|
| 53 |
+ |
|
| 54 |
+ Telnyx::setLogger(new \Telnyx\Util\DefaultLogger()); |
|
| 55 |
+ $this->assertInstanceOf(\Telnyx\Util\LoggerInterface::class, Telnyx::getLogger()); |
|
| 56 |
+ |
|
| 57 |
+ Telnyx::setClientId('CLIENTID455654');
|
|
| 58 |
+ static::assertSame('CLIENTID455654', Telnyx::getClientId());
|
|
| 59 |
+ |
|
| 60 |
+ Telnyx::setPublicKey('PUBLICKEY293847');
|
|
| 61 |
+ static::assertSame('PUBLICKEY293847', Telnyx::getPublicKey());
|
|
| 62 |
+ |
|
| 63 |
+ Telnyx::setApiVersion(2); |
|
| 64 |
+ static::assertSame(2, Telnyx::getApiVersion()); |
|
| 65 |
+ |
|
| 66 |
+ Telnyx::setVerifySslCerts(true); |
|
| 67 |
+ static::assertSame(true, Telnyx::getVerifySslCerts()); |
|
| 68 |
+ |
|
| 69 |
+ Telnyx::setAccountId('ACCOUNT38749');
|
|
| 70 |
+ static::assertSame('ACCOUNT38749', Telnyx::getAccountId());
|
|
| 71 |
+ |
|
| 72 |
+ Telnyx::setEnableTelemetry(false); |
|
| 73 |
+ static::assertSame(false, Telnyx::getEnableTelemetry()); |
|
| 74 |
+ |
|
| 75 |
+ Telnyx::setMaxNetworkRetries(4); |
|
| 76 |
+ static::assertSame(4, Telnyx::getMaxNetworkRetries()); |
|
| 77 |
+ } |
|
| 78 |
+} |