Completed
Push — master ( d48601...03ac5e )
by Jeroen De
13s queued 10s
created

testCallbackIsInvoked()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Onoi\MessageReporter\Tests\Unit;
4
5
use Onoi\MessageReporter\CallbackMessageReporter;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * @covers \Onoi\MessageReporter\CallbackMessageReporter
10
 * @group onoi-message-reporter
11
 * @license GNU GPL v2+
12
 */
13
class CallbackMessageReporterTest extends TestCase {
14
15
	public function testCallbackIsInvoked() {
16
		$messages = [];
17
18
		$reporter = new CallbackMessageReporter(
19
			function ( $message ) use ( &$messages ) {
20
				$messages[] = $message;
21
			}
22
		);
23
24
		$reporter->reportMessage( 'foo' );
25
		$reporter->reportMessage( 'bar' );
26
27
		$this->assertSame(
28
			[
29
				'foo',
30
				'bar'
31
			],
32
			$messages
33
		);
34
	}
35
36
}
37