Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
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 Spatie Newsletter facade method: whatever with:', []]); |
||
40 | $log->shouldHaveReceived('debug', ['Called Spatie Newsletter facade method: addTags with:', ['[email protected]', ['tags']]]); |
||
41 | } |
||
42 | } |
||
43 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: