File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace CzProject \GitPhp \Runners ;
4
+
5
+ use CzProject \GitPhp \IRunner ;
6
+
7
+
8
+ class OldGitRunner implements IRunner
9
+ {
10
+ /** @var IRunner */
11
+ private $ runner ;
12
+
13
+
14
+ public function __construct (IRunner $ runner = NULL )
15
+ {
16
+ $ this ->runner = $ runner !== NULL ? $ runner : new CliRunner ;
17
+ }
18
+
19
+
20
+ public function run ($ cwd , array $ args , array $ env = NULL )
21
+ {
22
+ if (($ key = array_search ('--end-of-options ' , $ args )) !== FALSE ) {
23
+ unset($ args [$ key ]);
24
+ }
25
+
26
+ return $ this ->runner ->run ($ cwd , $ args , $ env );
27
+ }
28
+
29
+
30
+ public function getCwd ()
31
+ {
32
+ return $ this ->runner ->getCwd ();
33
+ }
34
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use CzProject \GitPhp \Git ;
4
+ use CzProject \GitPhp \Runners \OldGitRunner ;
5
+ use CzProject \GitPhp \Tests \AssertRunner ;
6
+
7
+ require __DIR__ . '/bootstrap.php ' ;
8
+
9
+ $ assertRunner = new AssertRunner (__DIR__ );
10
+ $ runner = new OldGitRunner ($ assertRunner );
11
+ $ git = new Git ($ runner );
12
+
13
+ $ assertRunner ->assert (['branch ' , 'master ' ]);
14
+ $ assertRunner ->assert (['branch ' , 'develop ' ]);
15
+ $ assertRunner ->assert (['checkout ' , 'develop ' ]);
16
+ $ assertRunner ->assert (['merge ' , 'feature-1 ' ]);
17
+ $ assertRunner ->assert (['branch ' , '-d ' , 'feature-1 ' ]);
18
+ $ assertRunner ->assert (['checkout ' , 'master ' ]);
19
+
20
+ $ repo = $ git ->open (__DIR__ );
21
+ $ repo ->createBranch ('master ' );
22
+ $ repo ->createBranch ('develop ' , TRUE );
23
+ $ repo ->merge ('feature-1 ' );
24
+ $ repo ->removeBranch ('feature-1 ' );
25
+ $ repo ->checkout ('master ' );
You can’t perform that action at this time.
0 commit comments