Conditions | 2 |
Paths | 2 |
Total Lines | 48 |
Code Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | public function testGetMailChimpTemplates() |
||
15 | { |
||
16 | $chimpifyCampaign = new ChimpifyCampaign(); |
||
17 | |||
18 | $mailChimp = $this->getNewMailChimpMock(); |
||
19 | $mailChimp |
||
20 | ->shouldReceive('get') |
||
21 | ->with('templates') |
||
22 | ->once(); |
||
23 | $mailChimp |
||
24 | ->shouldReceive('success') |
||
25 | ->withNoArgs() |
||
26 | ->once(); |
||
27 | |||
28 | try { |
||
29 | $chimpifyCampaign->getMailChimpTemplates($mailChimp); |
||
30 | } catch (Exception $e) { |
||
31 | $this->assertEquals('Error connecting to MailChimp API', $e->getMessage()); |
||
32 | } |
||
33 | |||
34 | $mailChimp = $this->getNewMailChimpMock(); |
||
35 | $mailChimp |
||
36 | ->shouldReceive('get') |
||
37 | ->with('templates') |
||
38 | ->once() |
||
39 | ->andReturn([ |
||
40 | 'templates' => [ |
||
41 | [ |
||
42 | 'type' => 'user', |
||
43 | 'name' => 'Template One', |
||
44 | ], |
||
45 | [ |
||
46 | 'type' => 'preset', |
||
47 | 'name' => 'Template Two', |
||
48 | ], |
||
49 | ], |
||
50 | ]); |
||
51 | $mailChimp |
||
52 | ->shouldReceive('success') |
||
53 | ->withNoArgs() |
||
54 | ->once() |
||
55 | ->andReturn(true); |
||
56 | |||
57 | $result = $chimpifyCampaign->getMailChimpTemplates($mailChimp); |
||
58 | |||
59 | $this->assertInstanceOf('ArrayList', $result); |
||
60 | $this->assertEquals(1, $result->count()); |
||
61 | } |
||
62 | |||
71 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.