LoggerCallableTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 9 1
A testInvoke() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zenify\DoctrineBehaviors\Tests\Loggable;
6
7
use PHPUnit\Framework\TestCase;
8
use Zenify\DoctrineBehaviors\Contract\Loggable\LoggerInterface;
9
use Zenify\DoctrineBehaviors\Loggable\LoggerCallable;
10
11
12
class LoggerCallableTest extends TestCase
13
{
14
15
	/**
16
	 * @var string
17
	 */
18
	private $message;
19
20
	/**
21
	 * @var LoggerCallable
22
	 */
23
	private $loggerCallable;
24
25
26
	protected function setUp()
27
	{
28
		$loggerMock = $this->prophesize(LoggerInterface::class);
29
		$that = $this;
30
		$loggerMock->process('message')->will(function ($args) use ($that) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
			$that->message = 'someMessage';
32
		});
33
		$this->loggerCallable = new LoggerCallable($loggerMock->reveal());
34
	}
35
36
37
	public function testInvoke()
38
	{
39
		$loggerCallable = $this->loggerCallable;
40
		$loggerCallable('message');
41
		$this->assertSame('someMessage', $this->message);
42
	}
43
44
}
45