forked from bmitch/churn-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubversionTest.php
More file actions
73 lines (61 loc) · 1.85 KB
/
SubversionTest.php
File metadata and controls
73 lines (61 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
declare(strict_types=1);
namespace Churn\Tests\EndToEnd;
use Churn\Command\RunCommand;
use Churn\Tests\BaseTestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
final class SubversionTest extends BaseTestCase
{
/**
* @var CommandTester
*/
private $commandTester;
/**
* Test setup
*/
#[\Override]
protected function setUp(): void
{
parent::setUp();
$application = new Application('churn-php', 'test');
$method = \method_exists($application, 'addCommand')
? 'addCommand'
: 'add';
$application->{$method}(RunCommand::newInstance());
$command = $application->find('run');
$this->commandTester = new CommandTester($command);
}
/**
* Test teardown
*/
#[\Override]
protected function tearDown(): void
{
parent::tearDown();
unset($this->commandTester);
}
/** @test */
public function it_works_with_subversion(): void
{
$exitCode = $this->commandTester->execute([
'--configuration' => '/tmp/test',
'paths' => [],
]);
$display = $this->commandTester->getDisplay();
$expected = "
___ _ _ __ __ ____ _ _ ____ _ _ ____
/ __)( )_( )( )( )( _ \( \( )___( _ \( )_( )( _ \
( (__ ) _ ( )(__)( ) / ) ((___))___/ ) _ ( )___/
\___)(_) (_)(______)(_)\_)(_)\_) (__) (_) (_)(__)
+---------+---------------+------------+-------+
| File | Times Changed | Complexity | Score |
+---------+---------------+------------+-------+
| Foo.php | 2 | 1 | 1 |
| Bar.php | 1 | 1 | 0.5 |
+---------+---------------+------------+-------+
";
self::assertSame(0, $exitCode);
self::assertSame($expected, $display);
}
}