-
Notifications
You must be signed in to change notification settings - Fork 626
/
Copy pathTrackingSettingsTest.php
100 lines (80 loc) · 3.08 KB
/
TrackingSettingsTest.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
* This file tests TrackingSettings.
*/
namespace SendGrid\Tests\Unit;
use SendGrid\Mail\TrackingSettings;
use SendGrid\Mail\ClickTracking;
use SendGrid\Mail\OpenTracking;
use SendGrid\Mail\SubscriptionTracking;
use SendGrid\Mail\Ganalytics;
use PHPUnit\Framework\TestCase;
/**
* This class tests TrackingSettings.
*
* @package SendGrid\Tests
*/
class TrackingSettingsTest extends TestCase
{
public function testConstructor()
{
$trackingSettings = new TrackingSettings(
new ClickTracking(true, true),
new OpenTracking(true, 'sub_tag'),
new SubscriptionTracking(true, 'text', '<p>html_text</p>', 'sub_tag'),
new Ganalytics(true)
);
$this->assertTrue($trackingSettings->getClickTracking()->getEnableText());
$this->assertTrue($trackingSettings->getOpenTracking()->getEnable());
$this->assertTrue($trackingSettings->getSubscriptionTracking()->getEnable());
$this->assertTrue($trackingSettings->getGanalytics()->getEnable());
}
public function testSetClickTracking()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setClickTracking(true, true);
$this->assertTrue($trackingSettings->getClickTracking()->getEnable());
}
public function testSetClickTrackingOnInstance()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setClickTracking(new ClickTracking(true, true));
$this->assertTrue($trackingSettings->getClickTracking()->getEnable());
}
public function testSetOpenTracking()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setOpenTracking(true);
$this->assertTrue($trackingSettings->getOpenTracking()->getEnable());
}
public function testSetOpenTrackingOnOpenTrackingInstance()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setOpenTracking(new OpenTracking(true));
$this->assertTrue($trackingSettings->getOpenTracking()->getEnable());
}
public function testSetSubscriptionTracking()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setSubscriptionTracking(true);
$this->assertTrue($trackingSettings->getSubscriptionTracking()->getEnable());
}
public function testSetSubscriptionTrackingOnSubscriptionTrackingInstance()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setSubscriptionTracking(new SubscriptionTracking(true));
$this->assertTrue($trackingSettings->getSubscriptionTracking()->getEnable());
}
public function testSetGanalytics()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setGanalytics(true);
$this->assertTrue($trackingSettings->getGanalytics()->getEnable());
}
public function testSetGanalyticsOnGanalyticsInstance()
{
$trackingSettings = new TrackingSettings();
$trackingSettings->setGanalytics(new Ganalytics(true));
$this->assertTrue($trackingSettings->getGanalytics()->getEnable());
}
}