GitRepository example

echo LINE;
echo centered('ICU Resource Bundle Compilation')."\n";
echo LINE;

if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}

if ($argc >= 2) {
    $repoDir = $argv[1];
    $git = new GitRepository($repoDir);

    echo "Using the existing git repository at {$repoDir}.\n";
} else {
    echo "Starting git clone. This may take a while...\n";

    $repoDir = sys_get_temp_dir().'/icu-data';
    $git = GitRepository::download('https://github.com/unicode-org/icu.git', $repoDir);

    echo "Git clone to {$repoDir} complete.\n";
}

$fs = new Filesystem();
        $fs->remove($this->targetDir);
    }

    public function testItThrowsAnExceptionIfInitialisedWithNonGitDirectory()
    {
        $this->expectException(RuntimeException::class);

        @mkdir($this->targetDir, 0777, true);

        new GitRepository($this->targetDir);
    }

    public function testItClonesTheRepository()
    {
        $git = GitRepository::download(self::REPO_URL, $this->targetDir);

        $this->assertInstanceOf(GitRepository::class$git);
        $this->assertDirectoryExists($this->targetDir.'/.git');
        $this->assertSame($this->targetDir, $git->getPath());
        $this->assertSame(self::REPO_URL, $git->getUrl());
        $this->assertMatchesRegularExpression('#^[0-9a-z]{40}$#', $git->getLastCommitHash());
        
Home | Imprint | This part of the site doesn't use cookies.