-
Notifications
You must be signed in to change notification settings - Fork 6
/
UserTestCase.php
76 lines (61 loc) · 2.66 KB
/
UserTestCase.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
73
74
75
76
<?php
namespace KazooTests\Applications\Callflow;
use \KazooTests\TestCase;
use \MakeBusy\Kazoo\Applications\Crossbar\TestAccount;
abstract class UserTestCase extends TestCase
{
public static $a_user;
public static $a_device_1;
public static $a_device_2;
public static $b_user;
public static $b_device_1;
public static $b_device_2;
public static $c_user;
public static $c_device_1;
public static $c_device_2;
public static $offline_user;
public static $offline_device_1;
public static $offline_device_2;
public static $offnet_resource;
public static $emergency_resource;
public static $ring_group;
const A_NUMBER = '2000';
const B_NUMBER = '2001';
const C_NUMBER = '2002';
const OFFLINE_NUMBER = '2003';
const EMERGENCY_NUMBER = '911';
const RINGGROUP_NUMBER = '2111';
const CALL_FWD_ENABLE = '*72';
const CALL_FWD_DISABLE = '*73';
const OFFNET_NUMBER = "15553335678";
public static function setUpCase() {
parent::setUpCase();
self::$a_user= self::$account->createUser();
self::$a_user->createUserCallFlow([self::A_NUMBER]);
self::$b_user= self::$account->createUser();
self::$b_user->createUserCallFlow([self::B_NUMBER]);
self::$c_user= self::$account->createUser();
self::$c_user->createUserCallFlow([self::C_NUMBER]);
self::$offline_user= self::$account->createUser();
self::$offline_user->createUserCallFlow([self::OFFLINE_NUMBER]);
self::$a_device_1 = self::$a_user->createDevice("auth", TRUE);
self::$a_device_2 = self::$a_user->createDevice("auth", TRUE);
self::$b_device_1 = self::$b_user->createDevice("auth", TRUE);
self::$b_device_2 = self::$b_user->createDevice("auth", TRUE);
self::$c_device_1 = self::$c_user->createDevice("auth", TRUE);
self::$c_device_2 = self::$c_user->createDevice("auth", TRUE);
self::$offline_device_1 = self::$offline_user->createDevice("auth", FALSE);
self::$offline_device_2 = self::$offline_user->createDevice("auth", FALSE);
self::$offnet_resource = self::$account->createResource("carrier", ["^\\+1(\d{10})$"], "+1");
self::$emergency_resource = self::$account->createResource("carrier", ["^(911)$"], null, TRUE);
$b_user_id = self::$b_user->getId();
$offline_user_id = self::$offline_user->getId();
self::$ring_group = self::$account->createRingGroup(
[ self::RINGGROUP_NUMBER ],
[
["id" => $b_user_id, "type" => "user"],
["id" => $offline_user_id, "type" => "user"]
]
);
}
}