Completed
Push — add/changelog-tooling ( 86359e...64ad4d )
by
unknown
40:44 queued 31:04
created

PluginTraitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testTrait() 0 17 1
1
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
/**
3
 * Tests for the changelogger PluginTrait..
4
 *
5
 * @package automattic/jetpack-changelogger
6
 */
7
8
namespace Automattic\Jetpack\Changelogger\Tests;
9
10
use Automattic\Jetpack\Changelogger\PluginTrait;
11
use Symfony\Component\Console\Input\ArrayInput;
12
use Symfony\Component\Console\Output\NullOutput;
13
use Wikimedia\TestingAccessWrapper;
14
15
/**
16
 * Tests for the changelogger PluginTrait..
17
 *
18
 * @covers \Automattic\Jetpack\Changelogger\PluginTrait
19
 */
20
class PluginTraitTest extends TestCase {
21
22
	/**
23
	 * Test the trait.
24
	 */
25
	public function testTrait() {
26
		$mock = $this->getMockBuilder( PluginTrait::class )->getMockForTrait();
27
		$w    = TestingAccessWrapper::newFromObject( $mock );
28
29
		$this->assertSame( array(), $mock->getOptions() );
30
31
		$this->assertNull( $w->input );
32
		$this->assertNull( $w->output );
33
		$input  = new ArrayInput( array() );
34
		$output = new NullOutput();
35
		$mock->setIO( $input, $output );
36
		$this->assertSame( $input, $w->input );
37
		$this->assertSame( $output, $w->output );
38
39
		$class = get_class( $mock );
40
		$this->assertInstanceOf( $class, call_user_func( array( $class, 'instantiate' ), array() ) );
41
	}
42
43
}
44