TestCommandTest::testExecute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace tests\Tivnet\WPDB\Command;
4
5
use PHPUnit\Framework\TestCase;
6
use Symfony\Component\Console\Application;
7
use Symfony\Component\Console\Tester\CommandTester;
8
use Tivnet\WPDB\Command\HiCommand;
9
10
require_once __DIR__ . '/../../../bootstrap.php';
11
12
/**
13
 * Class TestCommandTest
14
 * @package tests\Tivnet\WPDB\Command
15
 */
16
class TestCommandTest extends TestCase {
17
18
	/**
19
	 * Test if command returns expected string
20
	 */
21
	public function testExecute() {
22
		$application = new Application();
23
		$application->add( new HiCommand() );
24
25
		$command       = $application->find( 'hi' );
26
		$commandTester = new CommandTester( $command );
27
		$commandTester->execute( array( 'command' => $command->getName() ) );
28
29
		$this->assertRegExp( '/Hi World!/', $commandTester->getDisplay() );
30
	}
31
32
}
33