TQ\Tests\Helper::executeGit PHP Method

executeGit() public static method

public static executeGit ( string $path, string $command ) : string
$path string
$command string
return string
    public static function executeGit($path, $command)
    {
        return exec(sprintf('cd %s && %s %s', escapeshellarg($path), GIT_BINARY, $command));
    }

Usage Example

コード例 #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);
     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();
 }
All Usage Examples Of TQ\Tests\Helper::executeGit