register() public static method

Registers the stream wrapper with the given protocol
public static register ( string $protocol, Binary | string | null | TQ\Vcs\StreamWrapper\PathFactoryInterface $binary = null )
$protocol string The protocol (such as "git")
$binary TQ\Git\Cli\Binary | string | null | TQ\Vcs\StreamWrapper\PathFactoryInterface The Git binary or a path factory
Esempio n. 1
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     mkdir(TESTS_TMP_PATH, 0777, true);
     mkdir(TESTS_REPO_PATH_1, 0777, true);
     exec(sprintf('cd %s && %s init', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY));
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_REPO_PATH_1);
     Helper::initEmptyGitRepository(TESTS_REPO_PATH_1);
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }
Esempio n. 3
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     mkdir(TESTS_TMP_PATH, 0777, true);
     mkdir(TESTS_REPO_PATH_1, 0777, true);
     exec(sprintf('cd %s && %s init', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY));
     for ($i = 0; $i < 5; $i++) {
         $file = sprintf('file_%d.txt', $i);
         $path = TESTS_REPO_PATH_1 . '/' . $file;
         file_put_contents($path, sprintf('File %d', $i));
         exec(sprintf('cd %s && %s add %s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg($file)));
     }
     exec(sprintf('cd %s && %s commit --message=%s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg('Initial commit')));
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_REPO_PATH_1);
     Helper::initEmptyGitRepository(TESTS_REPO_PATH_1);
     for ($i = 0; $i < 5; $i++) {
         $file = sprintf('file_%d.txt', $i);
         $path = TESTS_REPO_PATH_1 . '/' . $file;
         file_put_contents($path, sprintf('File %d', $i));
         Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($file)));
     }
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Initial commit')));
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_TMP_PATH);
     $repositories = array(TESTS_REPO_PATH_1, TESTS_REPO_PATH_2, TESTS_REPO_PATH_3);
     foreach ($repositories as $n => $repository) {
         Helper::createDirectory($repository);
         Helper::initEmptyGitRepository($repository);
         for ($i = 0; $i < 5; $i++) {
             $file = sprintf('file_%d.txt', $i);
             $path = $repository . '/' . $file;
             file_put_contents($path, sprintf('Repository %d - File %d', $n + 1, $i + 1));
             Helper::executeGit($repository, sprintf('add %s', escapeshellarg($file)));
         }
         Helper::executeGit($repository, sprintf('commit --message=%s', escapeshellarg('Initial commit')));
     }
     clearstatcache();
     $binary = new Binary(GIT_BINARY);
     StreamWrapper::register('git', $binary);
     StreamWrapper::getRepositoryRegistry()->addRepositories(array('repo1' => Repository::open(TESTS_REPO_PATH_1, $binary, false), 'repo2' => Repository::open(TESTS_REPO_PATH_2, $binary, false)));
 }
Esempio n. 6
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     mkdir(TESTS_TMP_PATH, 0777, true);
     mkdir(TESTS_REPO_PATH_1, 0777, true);
     exec(sprintf('cd %s && %s init', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY));
     $path = TESTS_REPO_PATH_1 . '/test.txt';
     file_put_contents($path, 'File 1');
     exec(sprintf('cd %s && %s add %s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg($path)));
     exec(sprintf('cd %s && %s commit --message=%s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg('Commit 1')));
     $path = TESTS_REPO_PATH_1 . '/directory';
     mkdir($path, 0777);
     file_put_contents($path . '/test.txt', 'Directory File 1');
     exec(sprintf('cd %s && %s add %s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg($path)));
     exec(sprintf('cd %s && %s commit --message=%s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg('Commit 2')));
     $path = TESTS_REPO_PATH_1 . '/test.txt';
     file_put_contents($path, 'File 1 New');
     exec(sprintf('cd %s && %s add %s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg($path)));
     exec(sprintf('cd %s && %s commit --message=%s', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY, escapeshellarg('Commit 3')));
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_TMP_PATH);
     Helper::createDirectory(TESTS_REPO_PATH_1);
     Helper::initEmptyGitRepository(TESTS_REPO_PATH_1);
     $path = TESTS_REPO_PATH_1 . '/test.txt';
     file_put_contents($path, 'File 1');
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path)));
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Commit 1')));
     $path = TESTS_REPO_PATH_1 . '/directory';
     Helper::createDirectory($path);
     file_put_contents($path . '/test.txt', 'Directory File 1');
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path)));
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Commit 2')));
     $path = TESTS_REPO_PATH_1 . '/test.txt';
     file_put_contents($path, 'File 1 New');
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path)));
     Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Commit 3')));
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }