-
Notifications
You must be signed in to change notification settings - Fork 6
/
DeviceTestCase.php
70 lines (56 loc) · 2.39 KB
/
DeviceTestCase.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
<?php
namespace KazooTests\Applications\Callflow;
use \KazooTests\TestCase;
use \MakeBusy\Kazoo\Applications\Crossbar\TestAccount;
abstract class DeviceTestCase extends TestCase
{
protected static $a_device;
protected static $b_device;
protected static $c_device;
protected static $register_device;
protected static $no_device;
protected static $offnet_resource;
protected static $emergency_resource;
protected static $ring_group;
protected static $realm;
const A_NUMBER = '5552221001';
const A_EXT = '1001';
const B_NUMBER = '5552221002';
const B_EXT = '1002';
const C_NUMBER = '5022221003';
const C_EXT = '1003';
const NO_NUMBER = '5552221100';
const NO_EXT = '1100';
const RINGGROUP_EXT = '1111';
const MILLIWATT_NUMBER = '5555555551';
const CALL_FWD_ENABLE = '*72';
const CALL_FWD_DISABLE = '*73';
const OFFNET_NUMBER = '5552345678';
const EMERGENCY_NUMBER = '911';
const RESTRICTED_NUMBER = '6845551234';
public static function setUpCase() {
parent::setUpCase();
self::$realm = self::$account->getAccountRealm();
self::$a_device = self::$account->createDevice("auth");
self::$a_device->createCallflow([self::A_EXT, self::A_NUMBER]);
self::$b_device = self::$account->createDevice("auth");
self::$b_device->createCallflow([self::B_EXT, self::B_NUMBER]);
self::$c_device = self::$account->createDevice("auth");
self::$c_device->createCallflow([self::C_EXT, self::C_NUMBER]);
self::$no_device = self::$account->createDevice("auth", FALSE);
self::$no_device->createCallflow([self::NO_EXT, self::NO_NUMBER]);
self::$register_device = self::$account->createDevice("auth");
self::$offnet_resource = self::$account->createResource("carrier", ["^\\+1(\d{10})$"], "+1");
self::$emergency_resource = self::$account->createResource("carrier", ["^(911)$"], null, true);
self::$ring_group = self::$account->createRingGroup(
[ self::RINGGROUP_EXT ],
[
["id" => self::$b_device->getId(), "type" => "device"],
["id" => self::$no_device->getId(),"type" => "device"]
]
);
}
public static function getTestAccount() {
return self::$account;
}
}