Completed
Pull Request — master (#220)
by
unknown
01:17
created

NullDriverTest::it_can_be_call_with_any_method()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Newsletter\Test;
4
5
use Spatie\Newsletter\NullDriver;
6
use Illuminate\Support\Facades\Log;
7
8
class NullDriverTest extends \PHPUnit\Framework\TestCase
9
{
10
    protected function tearDown(): void
11
    {
12
        parent::tearDown();
13
        \Mockery::close();
14
    }
15
16
    /** @test */
17
    public function it_logs_the_method_call_when_log_is_set()
18
    {
19
        $subject = new NullDriver(true);
20
21
        $log = \Mockery::mock();
22
        Log::swap($log);
23
24
        $log->shouldReceive('debug')->twice();
25
26
        $this->assertNull($subject->unsubscribe('[email protected]', 'test list'));
27
        $this->assertNull($subject->addTags(['tags'], '[email protected]'));
28
29
        $log->shouldHaveReceived(
30
            'debug', ['Called Spatie Newsletter facade method: unsubscribe with:', ['[email protected]', 'test list']]
31
        );
32
        $log->shouldHaveReceived(
33
            'debug',
34
            ['Called Spatie Newsletter facade method: addTags with:', [['tags'], '[email protected]']]
35
        );
36
    }
37
}
38