more refactoring; now the package hook starts to make sense
[pharext/pharext] / tests / src / pharext / GitSourceDirTest.php
1 <?php
2
3 namespace pharext;
4
5 require_once __DIR__."/../../autoload.php";
6
7 use pharext\Cli\Args as CliArgs;
8 use pharext\Cli\Command as CliCommand;
9
10 class Cmd implements Command
11 {
12 use CliCommand;
13 function __construct() {
14 $this->args = new CliArgs;
15 }
16 function run($argc, array $argv) {
17 }
18 }
19
20 class GitSourceDirTest extends \PHPUnit_Framework_TestCase
21 {
22 /**
23 * @var GitSourceDir
24 */
25 protected $source;
26
27 protected function setUp() {
28 $this->source = new SourceDir\Git(".");
29 }
30
31 public function testGetBaseDir() {
32 $this->assertSame($this->source->getBaseDir(), ".");
33 }
34
35 public function testIterator() {
36 $git_files = `git ls-tree --name-only -r HEAD | xargs -I{} -n1 echo \$(pwd)/{}`;
37 $dir_files = implode("\n", iterator_to_array($this->source->getIterator()))."\n";
38 $this->assertSame($git_files, $dir_files);
39 }
40 }