Fix up Git_Repo->log() to actually work.
[phpgit.git] / tests / GitTest.php
blob605a157444f465955f2fd0e40399d8e1962e40d5
1 <?php
3 Mock::generatePartial(
4 'Git',
5 'GitPartialMock',
6 array('execute'));
8 class GitTest extends UnitTestCase
10 function testTransformArgs() {
11 $git = new Git('..');
12 $result = $git->transformArgs(array(
13 'v' => true,
14 's' => 'ours',
15 'no-commit' => true,
16 'message' => 'test'
17 ));
18 $expect = array(
19 '-v', '-s ours', '--no-commit', '--message=test',
21 $this->assertIdentical($result, $expect);
24 function testEscape() {
25 $git = new Git('..');
26 $result = $git->escape("foo's");
27 $expect = "foo\\\\'s";
28 $this->assertIdentical($result, $expect);
31 function testCall() {
32 $git = new GitPartialMock();
33 $git->__construct('dir');
34 $git->expectOnce('execute', array('git --git-dir=dir cherry-pick -s f533ebca --no-commit'));
35 $git->setReturnValue('execute', $expect = 'Result');
36 $result = $git->cherryPick('f533ebca', array('--no-commit', 's' => true));
37 $this->assertIdentical($result, $expect);