protected function setUp() { parent::setUp(); mkdir('tests/fakehome'); chmod('tests/fakehome', 00); putenv('HOME=tests/fakehome'); $this->_saveHOME = getenv("HOME"); USVN_SVNUtils::createSvn('tests/tmp/svn directory'); USVN_SVNUtils::createStandardDirectories('tests/tmp/svn directory'); USVN_SVNUtils::checkoutSvn('tests/tmp/svn directory', 'tests/tmp/out'); file_put_contents('tests/tmp/svn directory/hooks/pre-revprop-change.bat', "@ECHO OFF\r\n"); file_put_contents('tests/tmp/svn directory/hooks/pre-revprop-change', "#!/bin/sh\nexit 0"); chmod('tests/tmp/svn directory/hooks/pre-revprop-change', 0700); $path = getcwd(); chdir('tests/tmp/out'); mkdir('trunk/testdir'); `svn add trunk/testdir`; touch('trunk/testfile'); `svn add trunk/testfile`; `svn commit --non-interactive --username toto -m Test`; touch('trunk/testfile2'); `svn add trunk/testfile2`; `svn commit --non-interactive --username tutu -m Test2`; `svn propset svn:date --revprop -r3 "1984-12-03T01:02:03.218987Z" .`; chdir($path); }
public function test_listFile() { USVN_SVNUtils::createSVN('tests/tmp/svn/test'); USVN_SVNUtils::createStandardDirectories('tests/tmp/svn/test'); USVN_SVNUtils::checkoutSvn('tests/tmp/svn/test', 'tests/tmp/out'); $path = getcwd(); chdir('tests/tmp/out'); mkdir('trunk/testdir'); `svn add trunk/testdir`; touch('trunk/testfile'); `svn add trunk/testfile`; `svn commit --non-interactive -m Test`; chdir($path); $svn = new USVN_SVN('test'); $res = $svn->listFile('/'); $this->assertEquals(3, count($res)); $this->assertContains(array("name" => "trunk", "isDirectory" => true, "path" => "/trunk/"), $res); $this->assertContains(array("name" => "branches", "isDirectory" => true, "path" => "/branches/"), $res); $this->assertContains(array("name" => "tags", "isDirectory" => true, "path" => "/tags/"), $res); $res = $svn->listFile('/trunk'); $this->assertEquals(2, count($res)); $this->assertContains(array("name" => "testdir", "isDirectory" => true, "path" => "/trunk/testdir/"), $res); $this->assertContains(array("name" => "testfile", "isDirectory" => false, "path" => "/trunk/testfile"), $res); }