1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* VersionControl_HG |
4
|
|
|
* Simple OO implementation for Mercurial. |
5
|
|
|
* |
6
|
|
|
* PHP Version 5.4 |
7
|
|
|
* |
8
|
|
|
* @copyright 2014 Siad Ardroumli |
9
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
10
|
|
|
* @link http://siad007.github.io/versioncontrol_hg |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Siad007\VersionControl\HG\Tests\Command; |
14
|
|
|
|
15
|
|
|
use Siad007\VersionControl\HG\Factory; |
16
|
|
|
|
17
|
|
|
class BackoutCommandTest extends \PHPUnit_Framework_TestCase |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @test |
21
|
|
|
*/ |
22
|
|
|
public function backoutCommand() |
23
|
|
|
{ |
24
|
|
|
$backoutCmd = Factory::createBackout(); |
25
|
|
|
$backoutCmd->setRevision('revision'); |
26
|
|
|
$backoutCmd->setMerge(true); |
27
|
|
|
$backoutCmd->setTool('tool'); |
28
|
|
|
$backoutCmd->addInclude('includePattern'); |
29
|
|
|
$backoutCmd->addExclude('excludePattern'); |
30
|
|
|
$backoutCmd->setMessage('text'); |
31
|
|
|
$backoutCmd->setLogfile('logfile'); |
32
|
|
|
$backoutCmd->setDate('date'); |
33
|
|
|
$backoutCmd->setUser('user'); |
34
|
|
|
|
35
|
|
|
$revision = '\'revision\''; |
36
|
|
|
$expected = 'hg backout --merge --tool ' . escapeshellarg('tool') . ' --include includePattern --exclude excludePattern --message ' . escapeshellarg('text') . ' --logfile ' . escapeshellarg('logfile') . ' --date ' . escapeshellarg('date') . ' --user ' . escapeshellarg('user') . ' '; |
37
|
|
|
|
38
|
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
39
|
|
|
$revision = str_replace("'", '"', $revision); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
$this->assertSame($revision, $backoutCmd->getRevision()); |
43
|
|
|
$this->assertSame($expected . $revision, $backoutCmd->asString()); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|