|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the GitCommandBundle package. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Paul Schweppe <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace VersionControl\GitCommandBundle\Tests\GitCommands\Command; |
|
12
|
|
|
|
|
13
|
|
|
use VersionControl\GitCommandBundle\Tests\GitCommandTestCase; |
|
14
|
|
|
use VersionControl\GitCommandBundle\GitCommands\GitDiffParser; |
|
15
|
|
|
use VersionControl\GitCommandBundle\Entity\GitDiff; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Description of GitBranchCommandTest. |
|
19
|
|
|
* |
|
20
|
|
|
* @author fr_user |
|
21
|
|
|
*/ |
|
22
|
|
|
class GitDiffParserTest extends GitCommandTestCase |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Test Getting commit files. |
|
26
|
|
|
*/ |
|
27
|
|
|
public function testGetCommitDiff() |
|
28
|
|
|
{ |
|
29
|
|
|
$diffString = |
|
30
|
|
|
'diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php |
|
31
|
|
|
index b9b5a2a..53b3b2d 100644 |
|
32
|
|
|
--- a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php |
|
33
|
|
|
+++ b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php |
|
34
|
|
|
@@ -50,6 +50,7 @@ class ProjectHistoryController extends BaseProjectController |
|
35
|
|
|
|
|
36
|
|
|
$currentPage = $request->query->get(\'page\', 1); |
|
37
|
|
|
$filter = false; |
|
38
|
|
|
+ $keyword = \'\'; |
|
39
|
|
|
//Search |
|
40
|
|
|
/*$keyword = $request->query->get(\'keyword\', false); |
|
41
|
|
|
$filter= $request->query->get(\'filter\', false); |
|
42
|
|
|
@@ -103,7 +104,7 @@ class ProjectHistoryController extends BaseProjectController |
|
43
|
|
|
\'totalCount\' => $this->gitLogCommand->getTotalCount(), |
|
44
|
|
|
\'limit\' => $this->gitLogCommand->getLimit(), |
|
45
|
|
|
\'currentPage\' => $this->gitLogCommand->getPage()+1, |
|
46
|
|
|
- //\'keyword\' => $keyword, |
|
47
|
|
|
+ \'keyword\' => $keyword, |
|
48
|
|
|
\'filter\' => $filter, |
|
49
|
|
|
\'searchForm\' => $searchForm->createView() |
|
50
|
|
|
));'; |
|
51
|
|
|
|
|
52
|
|
|
$diffParser = new GitDiffParser($diffString); |
|
53
|
|
|
$diffs = $diffParser->parse(); |
|
54
|
|
|
|
|
55
|
|
|
$this->assertCount(1, $diffs,'Diff count does not equal expected 17. Actual:'.count($diffs).print_r($diffs,true)); |
|
56
|
|
|
foreach ($diffs as $diff) { |
|
57
|
|
|
$this->assertInstanceOf(GitDiff::class, $diff); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|