<commit_before><?php

$repo_clone_url = '{ user: "%1$s", team: "%2$s", project: "%3$s" }';
$user = 'bees';
$team = 'ABC';
$project = 'wasps';
$expected_url = "{ user: \"$user\", team: \"$team\", project: \"$project\" }";

$config = Configuration::getInstance();
$config->override('repo_clone_url', $repo_clone_url);
$config->override('modules', array('proj'));

$config->override("user.default", "death");
$config->override("user.default.teams", array(1, 2, $team));
$config->override("auth_module", "single");

// do a quick authentication
$auth = AuthBackend::getInstance();
test_true($auth->authUser($user,'face'), "authentication failed");

// setup the required input keys
$input = Input::getInstance();
$input->setInput("team", $team);
$input->setInput("project", $project);

$mm = ModuleManager::getInstance();
$mm->importModules();
$proj = $mm->getModule('proj');

$proj->dispatchCommand('info');

$output = Output::getInstance();
$repoUrl = $output->getOutput('repoUrl');
test_nonnull($repoUrl, 'Failed to get repoUrl from output');

test_equal($repoUrl, $expected_url, "Wrong repo url data output");<commit_msg>Move test logic into a function for re-use.<commit_after><?php

$repo_clone_url = '{ user: "%1$s", team: "%2$s", project: "%3$s" }';
$user = 'bees';
$team = 'ABC';
$project = 'wasps';

$config = Configuration::getInstance();
$config->override('repo_clone_url', $repo_clone_url);
$config->override('modules', array('proj'));

$config->override("user.default", "death");
$config->override("user.default.teams", array(1, 2, $team));
$config->override("auth_module", "single");

// do a quick authentication
$auth = AuthBackend::getInstance();
test_true($auth->authUser($user,'face'), "authentication failed");

// setup the required input keys
$input = Input::getInstance();
$input->setInput("team", $team);

function check_project($project, $expected_url) {
    $input = Input::getInstance();
    $input->setInput("project", $project);

    $mm = ModuleManager::getInstance();
    $mm->importModules();
    $proj = $mm->getModule('proj');
    $proj->dispatchCommand('info');

    $output = Output::getInstance();
    $repoUrl = $output->getOutput('repoUrl');
    test_nonnull($repoUrl, 'Failed to get repoUrl from output');

    test_equal($repoUrl, $expected_url, "Wrong repo url data output");
}

check_project('wasps', "{ user: \"$user\", team: \"$team\", project: \"wasps\" }");
{'fraction_non_alphanumeric': 0.22157434402332363, 'fraction_numerical': 0.004164931278633903, 'mean_word_length': 6.553459119496855, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3264200', 'n_tokens_mistral': 777, 'n_tokens_neox': 765, 'n_words': 169}