Skip to content

Commit d07372f

Browse files
authored
Merge pull request #118 from ruscoe/fix-tests
Fix tests after version 3 restructuring
2 parents fe0244a + c99b27d commit d07372f

17 files changed

+297
-131
lines changed

tests/MailchimpAutomationsTest.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class MailchimpAutomationsTest extends TestCase {
1010
* Tests library functionality for automations.
1111
*/
1212
public function testGetAutomations() {
13-
$mc = new MailchimpAutomations();
13+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
14+
$mc = new MailchimpAutomations($api_user);
1415
$mc->getAutomations();
1516

1617
$this->assertEquals('GET', $mc->getClient()->method);
@@ -23,7 +24,8 @@ public function testGetAutomations() {
2324
public function testGetWorkflow() {
2425
$workflow_id = '57afe96172';
2526

26-
$mc = new MailchimpAutomations();
27+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
28+
$mc = new MailchimpAutomations($api_user);
2729
$mc->getWorkflow($workflow_id);
2830

2931
$this->assertEquals('GET', $mc->getClient()->method);
@@ -36,7 +38,8 @@ public function testGetWorkflow() {
3638
public function testGetWorkflowEmails() {
3739
$workflow_id = '57afe96172';
3840

39-
$mc = new MailchimpAutomations();
41+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
42+
$mc = new MailchimpAutomations($api_user);
4043
$mc->getWorkflowEmails($workflow_id);
4144

4245
$this->assertEquals('GET', $mc->getClient()->method);
@@ -50,7 +53,8 @@ public function testGetWorkflowEmail() {
5053
$workflow_id = '57afe96172';
5154
$workflow_email_id = 'a87de7d1e5';
5255

53-
$mc = new MailchimpAutomations();
56+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
57+
$mc = new MailchimpAutomations($api_user);
5458
$mc->getWorkflowEmail($workflow_id, $workflow_email_id);
5559

5660
$this->assertEquals('GET', $mc->getClient()->method);
@@ -64,7 +68,8 @@ public function testGetWorkflowEmailSubscribers() {
6468
$workflow_id = '57afe96172';
6569
$workflow_email_id = 'a87de7d1e5';
6670

67-
$mc = new MailchimpAutomations();
71+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
72+
$mc = new MailchimpAutomations($api_user);
6873
$mc->getWorkflowEmailSubscribers($workflow_id, $workflow_email_id);
6974

7075
$this->assertEquals('GET', $mc->getClient()->method);
@@ -79,7 +84,8 @@ public function testGetWorkflowEmailSubscriber() {
7984
$workflow_email_id = 'a87de7d1e5';
8085
$email = '[email protected]';
8186

82-
$mc = new MailchimpAutomations();
87+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
88+
$mc = new MailchimpAutomations($api_user);
8389
$mc->getWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email);
8490

8591
$this->assertEquals('GET', $mc->getClient()->method);
@@ -94,7 +100,8 @@ public function testAddWorkflowEmailSubscriber() {
94100
$workflow_email_id = 'a87de7d1e5';
95101
$email = '[email protected]';
96102

97-
$mc = new MailchimpAutomations();
103+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
104+
$mc = new MailchimpAutomations($api_user);
98105
$mc->addWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email);
99106

100107
$this->assertEquals('POST', $mc->getClient()->method);

tests/MailchimpCampaignsTest.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class MailchimpCampaignsTest extends TestCase {
1515
* Tests library functionality for campaigns information.
1616
*/
1717
public function testGetCampaigns() {
18-
$mc = new MailchimpCampaigns();
18+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
19+
$mc = new MailchimpCampaigns($api_user);
1920
$mc->getCampaigns();
2021

2122
$this->assertEquals('GET', $mc->getClient()->method);
@@ -28,7 +29,8 @@ public function testGetCampaigns() {
2829
public function testGetCampaign() {
2930
$campaign_id = '42694e9e57';
3031

31-
$mc = new MailchimpCampaigns();
32+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
33+
$mc = new MailchimpCampaigns($api_user);
3234
$mc->getCampaign($campaign_id);
3335

3436
$this->assertEquals('GET', $mc->getClient()->method);
@@ -48,7 +50,8 @@ public function testAddCampaign() {
4850
'from_name' => 'Customer Service',
4951
];
5052

51-
$mc = new MailchimpCampaigns();
53+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
54+
$mc = new MailchimpCampaigns($api_user);
5255
$mc->addCampaign($type, $recipients, $settings);
5356

5457
$this->assertEquals('POST', $mc->getClient()->method);
@@ -71,7 +74,8 @@ public function testAddCampaign() {
7174
public function testGetCampaignContent() {
7275
$campaign_id = '42694e9e57';
7376

74-
$mc = new MailchimpCampaigns();
77+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
78+
$mc = new MailchimpCampaigns($api_user);
7579
$mc->getCampaignContent($campaign_id);
7680

7781
$this->assertEquals('GET', $mc->getClient()->method);
@@ -87,7 +91,8 @@ public function testSetCampaignContent() {
8791
'html' => '<p>The HTML to use for the saved campaign.</p>',
8892
];
8993

90-
$mc = new MailchimpCampaigns();
94+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
95+
$mc = new MailchimpCampaigns($api_user);
9196
$mc->setCampaignContent($campaign_id, $parameters);
9297

9398
$this->assertEquals('PUT', $mc->getClient()->method);
@@ -106,7 +111,8 @@ public function testSetCampaignContent() {
106111
public function testGetSendChecklist() {
107112
$campaign_id = '42694e9e57';
108113

109-
$mc = new MailchimpCampaigns();
114+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
115+
$mc = new MailchimpCampaigns($api_user);
110116
$mc->getSendChecklist($campaign_id);
111117

112118
$this->assertEquals('GET', $mc->getClient()->method);
@@ -127,7 +133,8 @@ public function testUpdateCampaign() {
127133
'from_name' => 'Customer Service',
128134
];
129135

130-
$mc = new MailchimpCampaigns();
136+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
137+
$mc = new MailchimpCampaigns($api_user);
131138
$mc->updateCampaign($campaign_id, $type, $recipients, $settings);
132139

133140
$this->assertEquals('PATCH', $mc->getClient()->method);
@@ -154,7 +161,8 @@ public function testSendTest() {
154161
];
155162
$send_type = 'html';
156163

157-
$mc = new MailchimpCampaigns();
164+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
165+
$mc = new MailchimpCampaigns($api_user);
158166
$mc->sendTest($campaign_id, $emails, $send_type);
159167

160168
$this->assertEquals('POST', $mc->getClient()->method);
@@ -173,7 +181,8 @@ public function testSchedule() {
173181
'batch_count' => 100,
174182
];
175183

176-
$mc = new MailchimpCampaigns();
184+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
185+
$mc = new MailchimpCampaigns($api_user);
177186
$mc->schedule($campaign_id, $schedule_time, $timewarp, $batch_delivery);
178187

179188
$this->assertEquals('POST', $mc->getClient()->method);
@@ -193,7 +202,8 @@ public function testSchedule() {
193202
public function testUnschedule() {
194203
$campaign_id = 'b03bfc273a';
195204

196-
$mc = new MailchimpCampaigns();
205+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
206+
$mc = new MailchimpCampaigns($api_user);
197207
$mc->unschedule($campaign_id);
198208

199209
$this->assertEquals('POST', $mc->getClient()->method);
@@ -206,7 +216,8 @@ public function testUnschedule() {
206216
public function testSend() {
207217
$campaign_id = 'b03bfc273a';
208218

209-
$mc = new MailchimpCampaigns();
219+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
220+
$mc = new MailchimpCampaigns($api_user);
210221
$mc->send($campaign_id);
211222

212223
$this->assertEquals('POST', $mc->getClient()->method);
@@ -219,7 +230,8 @@ public function testSend() {
219230
public function testDelete() {
220231
$campaign_id = '42694e9e57';
221232

222-
$mc = new MailchimpCampaigns();
233+
$api_user = new Mailchimp(['api_user' => null, 'api_key' => null]);
234+
$mc = new MailchimpCampaigns($api_user);
223235
$mc->delete($campaign_id);
224236

225237
$this->assertEquals('DELETE', $mc->getClient()->method);

0 commit comments

Comments
 (0)