Code Duplication    Length = 18-20 lines in 3 locations

tests/MailChimp/NewsletterTest.php 3 locations

@@ 50-67 (lines=18) @@
47
    }
48
49
    /** @test */
50
    public function it_can_subscribe_someone()
51
    {
52
        $email = '[email protected]';
53
54
        $url = 'lists/123/members';
55
56
        $this->mailChimpApi->shouldReceive('success')->andReturn(true);
57
        $this->mailChimpApi->shouldReceive('post')->withArgs([
58
            $url,
59
            [
60
                'email_address' => $email,
61
                'status' => 'subscribed',
62
                'email_type' => 'html',
63
            ],
64
        ]);
65
66
        $this->newsletter->subscribe($email);
67
    }
68
69
    /** @test */
70
    public function it_throws_an_exception_if_subscribing_someone_fails()
@@ 97-114 (lines=18) @@
94
    }
95
96
    /** @test */
97
    public function it_can_subscribe_someone_as_pending()
98
    {
99
        $email = '[email protected]';
100
101
        $url = 'lists/123/members';
102
103
        $this->mailChimpApi->shouldReceive('success')->andReturn(true);
104
        $this->mailChimpApi->shouldReceive('post')->withArgs([
105
            $url,
106
            [
107
                'email_address' => $email,
108
                'status' => 'pending',
109
                'email_type' => 'html',
110
            ],
111
        ]);
112
113
        $this->newsletter->subscribePending($email);
114
    }
115
116
    /** @test */
117
    public function it_throws_an_exception_if_subscribing_someone_as_pending_fails()
@@ 262-281 (lines=20) @@
259
    }
260
261
    /** @test */
262
    public function it_can_subscribe_someone_to_an_alternative_list()
263
    {
264
        $email = '[email protected]';
265
266
        $url = 'lists/456/members';
267
268
        $this->mailChimpApi->shouldReceive('success')->andReturn(true);
269
        $this->mailChimpApi->shouldReceive('post')
270
            ->once()
271
            ->withArgs([
272
                $url,
273
                [
274
                    'email_address' => $email,
275
                    'status' => 'subscribed',
276
                    'email_type' => 'html',
277
                ],
278
            ]);
279
280
        $this->newsletter->subscribe($email, [], 'list2');
281
    }
282
283
    /** @test */
284
    public function it_can_subscribe_or_update_someone_to_an_alternative_list()