Passed
Push — master ( b5dd0a...3bec69 )
by
unknown
07:48
created

NullDriverTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 35
c 0
b 0
f 0
wmc 3
lcom 0
cbo 5
rs 10
1
<?php
2
3
namespace DansMaCulotte\Newsletter\Test;
4
5
use DansMaCulotte\Newsletter\Drivers\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_can_be_call_with_any_method()
18
    {
19
        $subject = new NullDriver();
20
21
        $this->assertNull($subject->whatever());
22
        $this->assertNull($subject->subscription());
23
        $this->assertNull($subject->addTags('[email protected]', ['tags']));
24
    }
25
26
    /** @test */
27
    public function it_logs_the_method_call_when_log_is_set()
28
    {
29
        $subject = new NullDriver(true);
30
31
        $log = \Mockery::mock();
32
        Log::swap($log);
33
34
        $log->shouldReceive('debug')->twice();
35
36
        $this->assertNull($subject->whatever());
37
        $this->assertNull($subject->addTags('[email protected]', ['tags']));
38
39
        $log->shouldHaveReceived('debug', ['Called Newsletter facade method: whatever with:', []]);
40
        $log->shouldHaveReceived('debug', ['Called Newsletter facade method: addTags with:', ['[email protected]', ['tags']]]);
41
    }
42
}
43