-
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathPanConfigurationTest.php
More file actions
119 lines (100 loc) · 3.43 KB
/
Copy pathPanConfigurationTest.php
File metadata and controls
119 lines (100 loc) · 3.43 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
use Pan\PanConfiguration;
it('have a max of 50 analytics by default', function (): void {
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});
it('can set the max number of analytics to store', function (): void {
PanConfiguration::maxAnalytics(100);
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 100,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});
it('can set the max number of analytics to unlimited', function (): void {
PanConfiguration::unlimitedAnalytics();
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => PHP_INT_MAX,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});
it('can set the allowed analytics names to store', function (): void {
PanConfiguration::allowedAnalytics(['help-modal', 'contact-modal']);
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => ['help-modal', 'contact-modal'],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});
it('sets an empty array of allowed analytics names by default', function (): void {
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});
it('can set the prefix url', function (): void {
PanConfiguration::routePrefix('new-pan');
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => [],
'route_prefix' => 'new-pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});
it('can set the tenant field', function (): void {
PanConfiguration::tenantField('team_id');
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => 'team_id',
'tenant_id' => null,
]);
});
it('can set the tenant id', function (): void {
PanConfiguration::tenantId(1);
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => 1,
]);
});
it('may reset the configuration to its default values', function (): void {
PanConfiguration::maxAnalytics(99);
PanConfiguration::allowedAnalytics(['help-modal', 'contact-modal']);
PanConfiguration::routePrefix('new-pan');
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 99,
'allowed_analytics' => ['help-modal', 'contact-modal'],
'route_prefix' => 'new-pan',
'tenant_field' => null,
'tenant_id' => null,
]);
PanConfiguration::reset();
expect(PanConfiguration::instance()->toArray())->toBe([
'max_analytics' => 50,
'allowed_analytics' => [],
'route_prefix' => 'pan',
'tenant_field' => null,
'tenant_id' => null,
]);
});