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