|
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
|
|
|
|