| 1 | <?php |
||
| 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 |