Exemple #1
0
 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 testImportSVNRepositoriesOk()
 {
     try {
         $table = new USVN_Db_Table_Users();
         $obj = $table->fetchNew();
         $obj->setFromArray(array('users_login' => 'user_test', 'users_password' => 'password', 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**'));
         $obj->save();
     } catch (USVN_Exception $e) {
         print $e->getMessage() . "\n";
         $this->fail();
     }
     $path = 'tests/tmp/svn/test/';
     mkdir($path);
     USVN_SVNUtils::createSvn($path . 'test');
     USVN_SVNUtils::createSvn($path . 'test2');
     mkdir($path . 'test3');
     USVN_SVNUtils::createSvn($path . 'test3/test3');
     $options = array('recursive' => true, 'login' => 'user_test');
     $imp = new USVN_ImportSVNRepositories();
     $results = $imp->lookAfterSVNRepositoriesToImport($path, $options);
     if (count($results) != 3) {
         $this->fail();
     }
     $imp->addSVNRepositoriesToImport($results, $options);
     try {
         $imp->importSVNRepositories();
     } catch (USVN_Exception $e) {
         print $e->getMessage() . "\n";
         $this->fail();
     }
     USVN_DirectoryUtils::removeDirectory($path);
 }