Skip to content

Instantly share code, notes, and snippets.

@fables-tales
Created July 18, 2010 10:03
Show Gist options
  • Save fables-tales/480280 to your computer and use it in GitHub Desktop.
Save fables-tales/480280 to your computer and use it in GitHub Desktop.
<?php
//delete any existing repos
if (is_dir("/tmp/test-repos"))
{
exec("rm -rf /tmp/test-repos");
}
//create the tld and manufacture a git repo
exec("mkdir -p /tmp/test-repos/beedogs");
//override the configuration
$config = Configuration::getInstance();
$config->override("repopath", "/tmp/test-repos");
$config->override("user.default", "death");
$config->override("user.default.groups", array("beedogs", "failcakes"));
$config->override("auth_module", "single");
$config->override("modules", array("proj"));
//do a quick authentication
$auth = AuthBackend::getInstance();
test_true($auth->authUser('',''), "authentication failed");
//setup the required input keys
$input = Input::getInstance();
$input->setInput("team", "beedogs");
$input->setInput("project", "ponies");
$mm = ModuleManager::getInstance();
$mm->importModules();
test_equal($mm->moduleExists("proj"), true, "proj module does not exist");
$repopath = $config->getConfig("repopath") . "/" . $input->getInput("team") . "/" . $input->getInput("project");
print_r($repopath);
//create a git repo
GitRepository::createRepository($repopath);
$proj = $mm->getModule("proj");
$proj->dispatchCommand("del");
print_r(is_dir($repopath));
test_equal(is_dir($repopath), FALSE, "deleted repo existed");
if (is_dir("/tmp/test-repos"))
{
exec("rm -rf /tmp/test-repos");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment